insights
import {
  createInsightsMiddleware
} from 'instantsearch.js/es/middlewares';
createInsightsMiddleware({
  insightsClient: null | InsightsClient,
  insightsInitParams?: object,
  onEvent?: (event: InsightsEvent, aa: null | InsightsClient) => void,
});
        About this widget
Starting from v4.9.0, you can use the insights option instead of setting up the Insights middleware yourself.
The createInsightsMiddleware creates an insights middleware to help you achieve the following:
- Set the 
userTokenfor 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-insightsv1.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
| Parameter | Description | ||
|---|---|---|---|
          
            insightsClient
          
         | 
        
           
                
                type: null|InsightsClient
                
               
              
                
                    Optional
                
               
          The Insights client is used to send events. It synchronizes the user token between search and analytics calls. To disable   | 
      ||
| 
           
Copy
 
       | 
      |||
          
            insightsInitParams
          
         | 
        
           
                
                type: object
                
               
              
                
                    Optional
                
               
          Insights parameters to forward to the Insights client’s  With  With   | 
      ||
| 
           
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
| Parameter | Description | ||
|---|---|---|---|
          
            Connectors
          
         | 
        
           Many of the InstantSearch connectors expose the  Here’s a list of connectors that expose  
  | 
      ||
| 
           
Copy
 
 | 
      |||