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
About this widget
Theanalytics
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
A function that is called every time the query 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
The number of milliseconds between the last search keystroke and calling
pushFunction
.JavaScript
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