Skip to content

CNIL consent exemption and visual experiment targeting

Latest

Choose a tag to compare

@jakewski jakewski released this 02 Dec 02:19
Immutable release. Only release title and notes can be modified.

New: consent_mode: 'exempt'

A consent mode for sites that rely on CNIL's audience-measurement exemption. Before the visitor consents, the SDK sends only anonymous audience measurement:

mixpanel.init(TOKEN, { consent_mode: 'exempt', autocapture: true });
// ...after the visitor accepts:
mixpanel.opt_in_tracking();
  • Before consent: nothing is stored. Only page views, clicks, scrolls and page exits ($mp_web_page_view, $mp_click, $mp_scroll, $mp_page_leave) are sent, and only with properties that can't identify the visitor:
    • URLs are cut down to origin and path.
    • $browser_version is cut down to the major version.
    • time is rounded down to the hour.
    • Each event carries $mp_exempt: true.
  • How exempt events are sent: one per request, never batched or queued. before_send_events doesn't run on them. on_track does, before the filter.
  • consent_exempt_allowlist ({events: [], properties: []}) adds to the events and properties sent before consent. Anything you list here is sent without consent.
  • After opt_in_tracking(): tracking works as under 'require_consent'.
  • New mixpanel.object_to_tracking() is for the objection link in your privacy policy. It stops all tracking, including exempt measurement. opt_out_tracking() stops full tracking but leaves the visitor exempt. opt_in_tracking() and clear_opt_in_out_tracking() lift an objection. Outside 'exempt', object_to_tracking() works the same as opt_out_tracking().

Visual experiments (beta)

  • Target URL rules: variants can now target pages with URL patterns (*, **, :name segments) or regexes, plus query-param and hash rules. Variants without a Target URL rule still match on origin and pathname.
  • Navigation: targeting is checked again on every navigation, including changes to only the query string or hash. Moving between pages that match the same variants no longer removes and re-applies the changes.
  • Editor preview follows the experiment's target to every matching page, and still shows on the page where it was authored.
  • Exposure tracking is now the same for every variant: $experiment_started fires once the page matches and one of the variant's exposure selectors is present (or on the URL match alone if it has none). Control and treatment are now counted the same way, which prevents sample-ratio mismatch. Visual exposures now include $matched_url.

Fixes

  • identify() with a new distinct id now resets feature flags before fetching them again. Before, flag state carried over to the new user, so $experiment_started could be sent with a variant that user never qualified for. whenReady() and getVariant() called right after identify() now wait for the new flags.
  • Visual experiment changes are now restored correctly when the page removes, re-inserts or moves elements.