GenAI Chat Tracking

Preferabli relies on browser storage for performance, analytics, and functional data collection and tracking. The GenAI Embeddable Widget supports an Opt Out Tracking control to disable tracking based on cookie consent or privacy preferences.

Preferabli relies on browser localStorage for performance, analytics and functional data collection and tracking. Each of the Preferabli plugins utilizes an Opt Out Tracking function to disable localStorage. In the case of an opt-out cookie/privacy policy, you can switch the opt_out_tracking setting from false to true when the user elects to opt-out. In the case of an opt-in cookie/privacy policy, you can initialize the plugin with opt_out_tracking set to true by default, and then switch the setting to false when the user elects to opt-in.


Script Tag Attributes

data-opt-out-tracking

Type: String
Required: No
Default: "false"

Set to "true" to opt the user out of tracking on initialization. Use this when your site uses an opt-in cookie/privacy policy and tracking should stay disabled until the user consents.

<script
  src="%SCRIPT_URL%/genai-embeddable-widget.js"
  data-api-key="%API_KEY%"
  data-opt-out-tracking="true"
></script>

Programmatic Options (WidgetInitConfig)

optOutTracking

Type: Boolean
Required: No
Default: false

Allows you to opt a user out of tracking based on cookie consent or privacy preferences.
When enabled, tracking-related data will not be collected for the session.

This is typically triggered after a user declines cookies or opts out via a privacy control.

var widget = new GenAIEmbeddableWidget({
  apiKey: '%API_KEY%',
  optOutTracking: true, // disable tracking on initialization
});

// after the user accepts the tracking / cookie policy
widget.optOutTracking(false);

Notes:

  • Can be toggled dynamically after initialization via optOutTracking(optOut) or the genai-widget:opt-out-tracking event
  • Recommended to integrate with your site's cookie consent manager
  • Applies to all instances of Preferabli Widgets

Widget Control Events

genai-widget:opt-out-tracking

Opts the user out of (or back into) tracking at runtime. Pass detail.optOut as true to disable tracking, or false to enable it.

window.dispatchEvent(new CustomEvent('genai-widget:opt-out-tracking', {
  detail: { optOut: true },
}));

// enable tracking after the user accepts the cookie / privacy policy
window.dispatchEvent(new CustomEvent('genai-widget:opt-out-tracking', {
  detail: { optOut: false },
}));

Public Methods

optOutTracking(optOut)

Opts the user out of (or back into) tracking.

Parameters:

  • optOut (Boolean) — true to disable tracking; false to enable tracking
var widget = new GenAIEmbeddableWidget({
  apiKey: '%API_KEY%',
  optOutTracking: true, // disable tracking on initialization
});

// enable tracking after the tracking policy is accepted
widget.optOutTracking(false);

Did this page help you?