React InstantSearch.js Setting user token with SSR

Hi,

we use findResultsState from react-instantsearch-dom/server to fetch Algolia API with SSR.

In Algolia Analytics it looks like it doesn’t forward token through SSR query. It also shows this error:

Warning: Number of users is low compared to volume of searches
The number of unique users seems low compared to the volume of searches. This can happen if user tokens are not forwarded to Algolia at search time, and can result in incorrect search queries and user count to be reported. Consider forwarding a token to improve your analytics reports!

Is there any way to forward token (or IP address?) through findResultsState?

Thanks.

Hi @driverama – are you explicitly setting userToken in the searchState your passing into findResultsState on the server side?

For instance, in this example you would insert the userToken here:

  const searchState = {
    query: 'iPhone',
    userToken: tokeValue,
    page: 5,
    refinementList: {
      brand: ['Apple'],
    },
  };

  const resultsState = await findResultsState(App, {
    ...props,
    searchState,
  });