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. Default: false.
optOutFunctionalCookiesbooleanOption to disable cookies that are used for functionality. 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.

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>