API Reference / API Methods / Insights / Clicked Object IDs After Search

Clicked Object IDs After Search

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

About this method

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.

Send a click event to capture a query and its clicked items and positions.

Unlike clickedObjectIDs, ClickedObjectIDsAfterSearch takes a queryID.

Examples

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

$insights->user("user-1")->clickedObjectIDsAfterSearch(
  'your_event_name',
  'your_index_name',
  ['objectID1', 'objectID2'],
  [17, 19],
  'queryID'
);

Parameters

userToken
type: string
Required

A user identifier.

Format: alpha numeric string [a-zA-Z0-9_-=/+]{1,128}

Length: between 1 and 64 characters.

eventName
type: string
Required

Name of the event.

It’s best to follow the event naming guidelines.

Format: any ASCII character except control characters.

Length: between 1 and 64 characters.

indexName
type: string
Required

Name of the index related to the click.

objectIDs
type: string[]
Required

A list of up to 20 objectIDs.

This list is often just one click (objectID), but there are cases where users can select multiple objects (for instance, selecting multiple options and then clicking “Submit”).

positions
type: uint[]
Required

Position of the click in the list of Algolia search results.

  • The first object in the list of search results has a position of 1 (not zero), the second has a position of 2, etc.
  • The position value must be absolute, not relative to the result page. For example, when clicking on the third record on the second result page, assuming 10 results per page, the position should be 13, not 3.
queryID
type: string
Required

Algolia queryID in the search response when using clickAnalytics

Format: hexadecimal string [a-f0-9]

Length: 32 characters.

Response

No response

Did you find this page helpful?