insights
import { createInsightsMiddleware } from 'instantsearch.js/es/middlewares'; createInsightsMiddleware({ insightsClient: null | InsightsClient, insightsInitParams?: object, onEvent?: (event: InsightsEvent, aa: null | InsightsClient) => void, });
About this widget
The createInsightsMiddleware
creates an insights middleware to help you achieve the following:
- Set the
userToken
for insights purposes (Click Analytics, Personalization, etc.) - Automatically send events from built-in widgets. You can turn this off if needed
- Send events from your own custom widgets
Requirements
- Use
search-insights
v1.6.2 or later. - Use Vue InstantSearch v3.7.0 or later.
Examples
1
2
3
4
5
6
7
8
9
import {
createInsightsMiddleware
} from 'instantsearch.js/es/middlewares';
createInsightsMiddleware({
insightsClient,
insightsInitParams,
onEvent,
});
Options
insightsClient
|
type: null|InsightsClient
Required
The middleware leverages |
||
Copy
|
|||
insightsInitParams
|
type: object
Optional
When given, the With With To learn more about the parameters of |
||
Copy
|
|||
onEvent
|
type: (event: InsightsEvent, aa: null | InsightsClient) => void
default: undefined
Optional
By default, the middleware sends events to Algolia using the provided If you want to use The
|
||
Copy
|
Custom events
Connectors
|
Many of the InstantSearch connectors expose the Here’s a list of connectors that expose
|
||
Copy
|