Sending events / Guides

Events unlock Algolia’s most powerful features. To select the best way to track events, see Get started with click and conversion events. This page describes tools and methods to check for errors.

Browser developer tools

To check your frontend implementation, use your browser’s built-in developer tools.

Check the search-insights library

Open the Network tab of your browser’s developer tools and check that the search-insights library loads without errors.

Chrome DevTools network tab shows the search insights library loads correctly with a status 200

Open the Console and run:

1
window.aa

If the search-insights library loads, you should see:

1
ƒ (){(t.aa.queue=t.aa.queue||[]).push(arguments)}

If the search-insights library isn’t loaded, you’ll see undefined as output.

Check the userToken

To check if the userToken is set, open the Console and run:

1
window.aa('getUserToken', null, (_, token) => console.log(token))

You should see the current user token as an output.

If you’re using the cookie-based anonymous userToken from the search-insights library, open the Application tab of your browser’s developer tools (Storage in Firefox or Safari) and go to Cookies.

The search-insights library stores the generated userToken in the _ALGOLIA cookie.

The browser developer tools show the ALGOLIA cookie with an anonymous user token

For more information, see Identify users.

Test sending an event to the Insights API

You can send a test event from your browser’s developer tools. For example, to send a view event, open the Console and run:

1
2
3
4
5
6
window.aa('viewedObjectIDs', {
  'eventType': 'view',
  'eventName': 'Test View Event',
  'index': 'TestIndex',
  'objectIDs': ['test-object']
})

You shouldn’t see an error in the console. To check the corresponding API request, open the Network tab and check for the POST request to the Insights API.

The Network tab in the browser developer tools shows the POST request to the Insights API

If the status is 200, the API request was successful. Check the Events Debugger in the Algolia dashboard to see how the event was received by the Insights API.

In the Chrome browser, you might see a warning in the Console: Cross-Origin Read Blocking (CORB) blocked cross-origin response. This isn’t an error and doesn’t prevent the event from being sent. When testing, you can ignore this warning.

Events Hub

The Events Hub lets you check the status of your event tracking at a glance. It displays the number of events received by the Insights API in the last 90 days. You can also check the error rate to ensure your events are valid.

To check the status of your events collection, follow these steps:

  1. Go to the Algolia dashboard and select your Algolia application.
  2. On the left sidebar, select Data sources.
  3. Go to Events and select the Hub tab.

    Events Hub page in the Algolia dashboard with five line graphs for total events, clicks, conversions, views, and errors.

The Events Hub refreshes once a day. To see a livestream of events from your app or website, use the Events Debugger.

If the Events Hub shows a warning message: Failed to retrieve events from the Insights API, check that you’re not using an ad blocker on the Events Hub. Turn off your ad blocker and reload the page.

Events Debugger

The Events Debugger shows the livestream of your events as the Insights API receives them:

  1. Go to the Algolia dashboard and select your Algolia application.
  2. On the left sidebar, select Data sources.
  3. Go to Events and select the Debugger tab.

    Events Debugger page in the Algolia dashboard with a table of incoming events.

Use the search box or click the Filter events button to filter the list of events. For example, enter httpCode=422 in the search box to show only the events with the HTTP status code 422.

If the Events Debugger doesn’t show any events although you’re sending them, check that you’re not using an ad blocker. Turn off your ad blocker and reload the page.

Events status

In the Events Debugger, you can check the properties of the events, which user agent sent the event, and the status of the event:

Valid
The event can be used for all Algolia features.
Warning
The event is only used for some Algolia features. For example, view events are only processed by Personalization.
Error
The event wasn’t valid. Check the event details to find out why.

Events details

Select any event in the Events Debugger to see its details.

Event details for a valid event without errors. The list of attributions show that the event can be used with all Algolia features.

You can check the following details:

Event Validity
If there are errors, such as a missing userToken parameter, or if you use a number instead of a string as a parameter value, you can see the error message under Errors.
Under Attributions you can see, where the event can be used. Events with the status Warning can’t be used in all Algolia features. For more information, see Event types.
HTTP Data
Details about the HTTP request sending the event, such as the referrer, user agent, and Insights library version.
User Timeline
A list of events sent by the same user.
Query Details
If the event includes a query ID, you can see the associated Search API request with the matching query ID.
Did you find this page helpful?