Customization guidesManage user preferences

JavaScript

Manage end-user usage tracking and privacy settings.

Scenario

In some cases, based on end-user location/preferences you may want to disable some analytics/cookies. In order to achieve this, you need to modify these widget configuration properties:

PropertyTypeDescription
optOutAnalyticalCookiesbooleanOption to disable cookies used for tracking a user's Inkeep usage behavior across multiple browser sessions. Only same-domain cookies are used. Default: false.
optOutAllAnalyticsbooleanOption to disable all usage analytics, even anonymous ones like clicking on a source. Default: false.
optOutFunctionalCookiesbooleanOption to disable cookies that are used for functionality like remembering whether the user was last using AI chat or Search modes. Default: false.
remoteErrorLogsLevelRemoteErrorLogsLevelThe level of remote error logging for Inkeep's monitoring service. Default: RemoteErrorLogsLevel.IdentifiableErrors.

In the example below we have a single checkbox where the user can opt out of all analytics. This pattern can be used more granularly to map your own customer preference system to ours, for example for cookie and tracking consent preferences.

Note
Note
By default, Inkeep does not collect IP addresses, device IDs, or other device-based information from components of the Inkeep uikit library.

Example

JavaScript example:

// instantiate inkeepWidget using Inkeep.embed()
// be sure to set any necessary initial values for optOutAnalyticalCookies, optOutAllAnalytics, optOutFunctionalCookies, remoteErrorLogsLevel if the user's preference is already known
// ...
 
const optOutAnalyticsInput = document.getElementById("optOutAnalytics");
 
// event listener for when user's preference changes
optOutAnalyticsInput.addEventListener("change", (e) => {
  const shouldOptOut = e.target.checked;
 
  embeddedChat.render({
    baseSettings: {
      optOutAnalyticalCookies: shouldOptOut,
      optOutAllAnalytics: shouldOptOut,
      optOutFunctionalCookies: shouldOptOut,
      remoteErrorLogsLevel: shouldOptOut
        ? 0 // None
        : 2, // Identifiable Errors
    },
  });
});

HTML example:

<input type="checkbox" id="optOutAnalytics" />
<label for="optOutAnalytics">Opt out of all analytics</label>

On this page