Skip to main content
This widget is deprecated and only supported in InstantSearch.js versions 1.9 to 4.8. Use the insights middleware instead. For details, see the upgrade guide.
Signature

Import

See this widget in action

Preview this widget and its behavior.

About this widget

The analytics widget pushes the current state of the search to the analytics platform of your choice. It requires the implementation of a function that pushes the data. This widget doesn’t render a UI.

Examples

Google Analytics

JavaScript

Google Tag Manager

JavaScript

Segment.io

JavaScript

Kissmetrics

JavaScript

Options

pushFunction
function
required
A function that is called every time the or refinements changes. You need to add the logic to push the data to your analytics platform.The function takes three parameters:
  • formattedParameters. Contains the search parameters, serialized as a query string.
  • state. Contains the whole search state.
  • results. The last received results.
JavaScript
delay
number
default:3000
The number of milliseconds between the last search keystroke and calling pushFunction.
JavaScript
triggerOnUIInteraction
boolean
Triggers pushFunction after click on page or redirecting the page. This is useful if you want the pushFunction to be called for the last actions before users leaves the current page, even if the delay wasn’t reached.
JavaScript
Triggers pushFunction when InstantSearch is initialized. This means the pushFunction might be called even though users didn’t perfom any search-related action.
JavaScript
Last modified on May 19, 2026