search
To initialize the Insights client,
you need your Algolia application ID and your API key with search
permissions.
You can find both in your Algolia dashboard.
Starting from v2.4.0, you an also pass credentials as headers for each call.
If youβre using the client with InstantSearch or Autocomplete,
credentials are inferred from the search client.
init
method to set global options for the Insights client,
for example, set the userToken
parameter to send it with every event.
To update parameters later, use the partial
option.
For more information about events, see Get started with events.
If the user is signed in, set the authenticated user token,
which should come from your system.
JavaScript
JavaScript
setAuthenticatedUserToken
.
Parameters
Search API key of your Algolia application.
Identifier of your Algolia application.
Pseudonymous identifier for authenticated users.See also: User token
Donβt include personally identifiable information in user tokens.
Cookie duration in milliseconds. The default is 6 months.For Personalization,
at least 3 months (7,776,000,000Β ms) are recommended.
URL of your server for routing requests before forwarding them to Algolia.
Whether to partially update the configuration while preserving existing options.
Use this to update the settings of a running client without having to specify all options again.
Analytics region, one of:
de
us
Whether to store the anonymous user token in a browser cookie.In some jurisdictions, you need to obtain user consent
before using cookies.
Make sure to obtain it before you set this option to
true
.
Storing cookies on a userβs device may require consent.Set this parameter to true
when using Personalization.
See also: Persistent user tokenWhether to exclude users who opted out from analytics.Set this parameter to
true
when users request to not be tracked.Anonymous user identifier.See also: User token