API client / Methods / Insights

Converted object IDs after search

Required API Key: any key with the search ACL
Method signature
$insights->user(string userToken)->convertedObjectIDsAfterSearch(
  string eventName,
  string indexName,
  array objectIDs,
  string queryID
)

We released a new version of the PHP API client in public beta. Read the beta documentation for more information.

We released a new version of the JavaScript API client in public beta. Read the beta documentation for more information.

We released a new version of the Java API client in public beta. Read the beta documentation for more information.

You’re currently reading the JavaScript API client v4 documentation. Check the migration guide to learn how to upgrade from v3 to v4. You can still access the v3 documentation.

You’re currently reading the Ruby API client v2 documentation. Check the migration guide to learn how to upgrade from v1 to v2. You can still access the v1 documentation.

About this method

Send a conversion event related to an Algolia request.

Use this event to track when users convert after a previous Algolia request. For example, a user clicks on an item in the search results to view the product detail page. Then, the user adds the item to their shopping cart.

If you use Algolia to build your category pages, you’ll also use the convertedObjectIDsAfterSearch event.

Sending this event is useful for:

Related methods:

Examples

Read the Algolia CLI documentation for more information.

1
2
3
4
5
6
7
8
9
10
11
$insights = Algolia\AlgoliaSearch\InsightsClient::create
  'YourApplicationID',
  'YourSearchOnlyAPIKey'
);

$insights->user("user-123456")->convertedObjectIDsAfterSearch(
  'your_event_name',
  'your_index_name',
  ['objectID-1', 'objectID-2'],
  'queryID'
);

Parameters

userToken
type: string
pattern: [A-Za-z0-9_-=]{1,128}
Required

A pseudonymous or anonymous user identifier.

Never include personal identifiable information in user tokens.

Related: user token

eventName
type: string
pattern: [\x20-\x7E]{1,64}
Required

The name of the specific event.

Format: 1-64 ASCII characters, except control characters.

To maximize the impact of your events, you should use consistent event names and consistent formatting—for example, “Product Added To Cart” (always in title case).

For example, you can adopt Segment’s object-action framework.

indexName
type: string
Required

The name of the Algolia index.

Format: same as the index name used by the search engine.

Some API clients use index instead of indexName.

objectIDs
type: array
items: string
Required

An array of object identifiers for items of an Algolia index.

You can include up to 20 objectID.

queryID
type: string
pattern: [a-f0-9]{32}
Required

A unique identifier for a search query.

A queryID is required for events related to search or browse requests.

If you add clickAnalytics: true as a search request parameter, the queryID is included in the API response.

Related: Keep track of query IDs

Response

This method doesn't return a response.

Did you find this page helpful?