Skip to content

Google Tag Manager Custom Template – Algolia Search Insights

David Vallejo

Algolia is a company that offers a Search_as_a_service tools. They offer a Real Time services, which can be improved by sending events about users interactions over the products your site like add to carts, adds to wishlists, clicks after search, filters use, or conversion.

For this task they offer a the Search Insights JS library.

This library currently allows to track 3 main types of events:
Clicks (clickedObjectIDsAfterSearch , clickedObjectIDs, clickedFilters)
Conversions (convertedObjectIDsAfterSearch, convertedObjectIDs, convertedFilters)
Views (viewedFilters, viewedObjectIDs)

From now on you can setup your Algolia’s Search Insights, via Google Tag manager using a Custom Template.

At this first Release the following functionality is implemented on the Custom Templates


  • viewedFilters
  • viewedObjectIDs
  • clickedObjectIDsAfterSearch
  • clickedObjectIDs
  • clickedFilters
  • convertedObjectIDsAfterSearch
  • convertedObjectIDs
  • convertedFilters

Events Variables

  • userToken
  • index
  • eventName
  • objectIDs
  • filters
  • queryID
  • positions

Advanced Settings

  • Manage if the current user has Opted Out
  • Override the default cookie duration (default value 6 months)
  • Region value setting from the Init Tag
  • User Token persistance. You can define the User Token within the Init tag and it will be persisted to the subsecuent events sent to Algolia Search Insights

Where do I get the Custom Template