Guides / Sending events

Once you know which events you want to collect, you need to determine how to send events to Algolia. The Insights API is flexible to handle as many event sources as possible.

If you use Algolia’s front-end libraries or platform integrations, you can benefit from their integrated handling of events.

How to send events depends on your use case and the technology you’re already using. The following sections can help you decide which method you should use to send events to the Algolia Insights API.

You want to send historical data or send events in batches

You can send historical events you collected with other analytics providers to Algolia Insights. This reduces the time until features like Personalization, Click and Conversion Analytics, and Recommend are ready to use.

It’s most efficient to send these events in batches.

You’re using a data platform to track events

If you already use or plan on using Segment, mParticle or Google Tag Manager, you can use Algolia’s connectors to send real-time events to Algolia Insights.

The Segment connector sets up Algolia Insights as a destination for events. With Segment, you can send events from your front end, or your back end. mParticle follows the same principle, you can set Algolia as an output. For Google Tag Manager, you can use the official Algolia Insights template. With Google Tag Manager, you can send events from your front end. You can use the Algolia API client to send events to Algolia Insights from your back end.

You’re using an ecommerce platform

If you use Shopify, Magento, or Salesforce Commerce Cloud with their default front end, you can use Algolia’s official integrations.

If you’re using a headless ecommerce platform, see Sending events from your front end.

You’re sending events from your front end

Both Autocomplete and InstantSearch provide methods to send events to Algolia Insights.

If you want to send events manually, you can use the search-insights library.

You’re sending events from your back end

Algolia’s API clients provide methods to send events to Algolia Insights. If you’re doing back-end search, you can use the API methods to send events. You can also use the API clients, if you want to send events in batches or import historical events into Algolia Insights.

Did you find this page helpful?