This code has been specifically created for Vue 2. Some modifications may be required for it to work correctly in Vue 3.
What are events?
Events are actions that users take on your app or website. They unlock powerful features, such as recommendations, personalization, smarter search results, and analytics that help you optimize your user experience. For more information, see Get started with click and conversion events.How to send events
InstantSearch widgets can automatically send certain events if you enable theinsights
option when setting up your app.
For a full guide to implementing events, see Send events with InstantSearch.
Default events
With theinsights
middleware, your InstantSearch widgets send default events.
To check the default events, go to the Events Debugger.
For more information, see Validate your events.
Default click events for refinement widgets
The following widgets sendclick
events (“Filter Applied”) when users select a refinement.
Custom widgets use connectors to send the same events.
Widget | Connector |
---|---|
ais-hierarchical-menu | connectHierarchicalMenu |
ais-menu | connectMenu |
ais-menu-select | connectMenu |
ais-rating-menu | connectRatingMenu |
ais-refinement-list | connectRefinementList |
ais-toggle-refinement | connectToggleRefinement |
Numeric refinement widgets don’t send
clicked
events as the clickedFilters
event does not apply to numeric filters. This is relevant for connectNumericMenu
- and connectRange
-based widgets.Default view events for results widgets
The following widgets sendview
events (“Hits Viewed”) for the visible items in the search results.
Custom widgets using the connectors send the same events.
Widget | Connector |
---|---|
ais-autocomplete | connectAutocomplete |
ais-hits | connectHits |
ais-infinite-hits | connectInfiniteHits |
Default click events for results widgets
The following widgets sendclick
events (“Hit Clicked”) when users click a search result.
Widget | Connector |
---|---|
hits | ais-hits |
infiniteHits | ais-infinite-hits |
click
events aren’t sent when using ais-hits
or ais-infinite-hits
. If you’re using connectors, make sure to set up click
events on them.
Vue