Not receiving events from createAlgoliaInsightsPlugin for autocomplete

I’ve been trying to send events in an Autocomplete component. However it’s not working. I’m following this guide to implement it.

Any ideas why it isn’t? Would very much appreciate your help.

Here is a Code Sandbox

Hi @kylj

I just hit a similar issue for a website I was working on. In my case I had remembered to load the insights client and the plugin:

import insightsClient from 'search-insights';
import { createAlgoliaInsightsPlugin } from '@algolia/autocomplete-plugin-algolia-insights';

I had configured the insights plugin:

// Configure our Algolia Insight client to send click and conversion events
insightsClient('init', { appId, apiKey, useCookie: true });
const algoliaInsightsPlugin = createAlgoliaInsightsPlugin({ insightsClient });

And I had remembered to include it in my autocomplete initialization

plugins: [loadVideoPlugin,algoliaInsightsPlugin,querySuggestionsPlugin],

But I had forgotten to turn on insights for my sources!

        getItems({ query }) {
          return getAlgoliaResults({
            queries: [
                indexName: 'devcon-22-sessions',
                params: {
                  clickAnalytics: true,
                  attributesToSnippet: ['videoTitle:10', 'text:10'],
                  snippetEllipsisText: '…',
                  hitsPerPage: 10,
                  distinct: 2

Maybe this is the step you missed too?

Hi @chuck.meyer ,
You were right! Turns out this was the case. It’s working now. Thank you.

1 Like