Skip to content

New consent_mode init option

Choose a tag to compare

@jakewski jakewski released this 06 Nov 21:52
· 20 commits to master since this release
Immutable release. Only release title and notes can be modified.

New: consent_mode: 'require_consent'

A stricter consent mode for sites that must collect consent before anything is stored or sent:

mixpanel.init(TOKEN, { consent_mode: 'require_consent' });
// ...after the visitor accepts:
mixpanel.opt_in_tracking();
  • Before consent: nothing is stored or sent. That covers events, people and group updates, feature flag fetches, remote settings and session recording. An identify() made before consent is held and applied on opt-in.
  • On opt_out_tracking() or Do Not Track (unless ignore_dnt is set): the SDK stops on the page at once and deletes stored identifiers, queued batches and persisted flag variants. Unsent session replay data stays on the device and is only uploaded once consent is given again.
  • Where the decision is stored: with the identity persistence (persistence config), so subdomains that share the cookie also share the decision. opt_out_tracking_cookie_prefix still names the stored flag.
  • Unrecognized values: an unknown consent_mode is treated as 'require_consent', so a typo collects nothing.

Upgrading from the opt_out_* configs

  • If you leave consent_mode unset, opt-out works exactly as in 2.84.0.
  • opt_out_tracking_by_default only applies when consent_mode is unset. Setting consent_mode to anything, including 'no_consent_required', turns it off.
  • Under require_consent, these are ignored:
    • opt_out_tracking_by_default, opt_out_tracking_persistence_type and opt_out_persistence_by_default
    • the persistence options of opt_in_tracking() and opt_out_tracking()
    • delete_user: an opt-out removes local data only and doesn't delete the user's profile on the server.

Fixes

  • After opt_out_tracking(), a later set_config() call no longer starts writing super properties to cookie or localStorage again.
  • Session replays keep the spaces between inline elements. Before, the mask function dropped them and adjacent words ran together.
  • init() no longer creates an empty mixpanelFlagsDb IndexedDB database when no flag variants have been saved.