Usage
Examples
Google Analytics Integration
Custom Analytics with Debounce
Track Pagination
Options
Function called when search parameters change. Use this to send data to your analytics platform.Parameters:
formattedParameters: Search parameters serialized as a query stringstate: The complete search state objectresults: The last received search results
Number of milliseconds to wait after the last search keystroke before calling
pushFunction. This debounces rapid changes.Whether to trigger
pushFunction when the user clicks on the page or navigates away. Useful for capturing analytics before the user leaves.Whether to trigger
pushFunction when InstantSearch initializes. If false, analytics are only sent after user interactions.Whether to trigger
pushFunction when the page changes. By default, pagination changes are not tracked separately.Push Function Details
TheformattedParameters string contains serialized refinements in the format:
Migration to Insights Middleware
To migrate from the analytics widget to the insights middleware:Learn more about the migration in the upgrade guide.
Behavior
The widget:- Listens to search state changes (query, refinements, pagination)
- Waits for the configured
delayafter the last change - Calls
pushFunctionwith serialized parameters - Skips duplicate calls (won’t send identical data twice)
triggerOnUIInteraction is enabled:
- Sends analytics on page clicks
- Sends analytics before page unload