Repository navigation
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_versionis cut down to the major version.timeis 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_eventsdoesn't run on them.on_trackdoes, 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()andclear_opt_in_out_tracking()lift an objection. Outside'exempt',object_to_tracking()works the same asopt_out_tracking().
Visual experiments (beta)
- Target URL rules: variants can now target pages with URL patterns (
*,**,:namesegments) 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_startedfires 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_startedcould be sent with a variant that user never qualified for.whenReady()andgetVariant()called right afteridentify()now wait for the new flags.- Visual experiment changes are now restored correctly when the page removes, re-inserts or moves elements.