Documentation Index
Fetch the complete documentation index at: https://algolia.com/llms.txt
Use this file to discover all available pages before exploring further.
Required ACL: search
Use this method to automatically send the authenticatedUserToken with every event.
For more information, see User token.
Examples
For more information about initializing the JavaScript Insights client aa,
see Initialize the Insights client.
import aa from "search-insights";
aa("init", {
appId: "YourApplicationID",
apiKey: "YourSearchOnlyAPIKey",
useCookie: true,
});
When user logs in, set the authenticated user token to the user ID coming from your system.
aa("setAuthenticatedUserToken", "YourUserID");
Now, both the anonymous and authenticated tokens will be sent with each event to ensure that data collected when users weren’t authenticated isn’t lost.
When users log out, you can unset the authenticated token by passing undefined.
aa("setAuthenticatedUserToken", undefined);
Parameters
authenticatedUserToken
string | undefined
required
Pseudonymous identifier for authenticated users.Don’t include personally identifiable information in user tokens.
See also: User token