Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,16 @@
**2.87.0** (1 Dec 2026)

- Adds `consent_mode: 'exempt'` for CNIL's audience-measurement exemption. Until `opt_in_tracking()`, the SDK stores nothing and sends only anonymous page views, clicks, scrolls and page exits (`$mp_web_page_view`, `$mp_click`, `$mp_scroll`, `$mp_page_leave`) with a fixed set of non-identifying properties: URLs are cut to origin and path, `$browser_version` is truncated to the major version, `time` is rounded down to the hour, and each event carries `$mp_exempt: true`. Exempt events are sent one per request, never batched or queued, and skip `before_send_events` (`on_track` still runs, before the filter). Remote settings are fetched in this mode so they can turn on the autocapture the events come from. After an opt-in, tracking works as under `'require_consent'`; `opt_out_tracking()` stops full tracking but leaves the visitor exempt.
- Adds a `consent_exempt_allowlist` config (`{events: [], properties: []}`) that adds events and properties to what `'exempt'` sends before consent. Anything listed is sent without consent.
- Adds `mixpanel.object_to_tracking()` for the objection link in a privacy policy. It stops all tracking, exempt measurement included; `opt_in_tracking()` and `clear_opt_in_out_tracking()` lift it, `opt_out_tracking()` does not. Outside `'exempt'` it works as `opt_out_tracking()`. A stored objection counts as opted out in `has_opted_out_tracking()`. It is included in the snippet and wrapper stubs.
- Visual experiments: variants are now matched on the structured Target URL rule (`$mp.target`) when present: a main URL pattern (`*`, `**`, `:name` segments) or anchored regex on origin and pathname, plus optional query-param and hash rules. Variants without a target keep the origin + pathname match on `$mp.url`.
- Visual experiments: targeting is re-evaluated on every navigation, including query- and hash-only changes. Navigating between pages that match the same variants no longer reverts and reapplies the changes.
- Visual experiments: the editor preview now follows the edited experiment's target to every matching page, and still shows on the page where it was authored.
- Visual experiments: `$experiment_started` now fires the same way for every variant, control included: once the page matches and one of the variant's `$mp.exposureSelectors` is in the DOM, or on the URL match alone when it has none. Previously control fired on URL match while treatment waited for a change to land, which could cause sample-ratio mismatch. Selector presence is judged before treatment changes apply, and missing selectors are watched for until the next navigation, delivery or reset. Visual exposures now include `$matched_url` (with `mp_preview_token` redacted).
- Visual experiments: fixes elements the page removes and re-inserts keeping or losing a variant's changes incorrectly, and fixes `setText` revert pulling children the page had moved elsewhere back under the original parent.
- Fixes `identify()` with a new distinct id carrying feature flag state over to the new user: activated first-time-event variants and tracked exposures carried over, so `$experiment_started` could be sent with a variant the new user never earned. `identify()` now resets flags (clearing stored variants) before refetching, and `whenReady()`/`getVariant()` called right after wait for the refetch.
- Moves URL matching (`urlMatchesRegexList` and the new Target URL matcher) into a shared `url-matching` module.

**2.86.0** (13 Nov 2026)

- Adds beta support for no-code visual experiments, behind a new `visual_experiments` init option (default `false`). With `flags` also enabled, the SDK applies a variant's visual changes when the variant's authored page matches the current page by origin and pathname, including after SPA navigations, and re-applies them as the page re-renders. Supported changes are `setAttribute`, `setText`, `setStyle`, `setClasses`, `setAttributes` and `hide`; other types are ignored, as is any variant whose changes exceed 32K characters.
Expand Down
1 change: 0 additions & 1 deletion dist/async-modules/mixpanel-recorder-DFwi_jd3.min.js.map

This file was deleted.

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/async-modules/mixpanel-recorder-DddVDjoQ.min.js.map

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

var Config = {
LIB_VERSION: '2.86.0'
LIB_VERSION: '2.87.0'
};
var RECORDER_GLOBAL_NAME = '__mp_recorder';

Expand Down Expand Up @@ -20737,17 +20737,6 @@

var NOOP_FUNC = function () {};

var urlMatchesRegexList = function (url, regexList) {
var matches = false;
for (var i = 0; i < regexList.length; i++) {
if (url.match(regexList[i])) {
matches = true;
break;
}
}
return matches;
};

var JSONStringify = null, JSONParse = null;
if (typeof JSON !== 'undefined') {
JSONStringify = JSON.stringify;
Expand Down Expand Up @@ -22104,6 +22093,27 @@
}
}

/* eslint camelcase: "off" */


/**
* Whether a URL matches any entry of a regex list. Matching is unanchored
* (url.match(entry)), unlike the anchored Target URL matcher.
* @param {string} url
* @param {Array<RegExp|string>} regexList
* @returns {boolean}
*/
var urlMatchesRegexList = function (url, regexList) {
var matches = false;
for (var i = 0; i < regexList.length; i++) {
if (url.match(regexList[i])) {
matches = true;
break;
}
}
return matches;
};

/**
* This is a port of the open rrweb network plugin in this PR https://github.com/rrweb-io/rrweb/pull/1105
* the hope is that eventually this can be replaced with the official plugin once it's published (and we sync the mixpanel rrweb fork)
Expand Down Expand Up @@ -23514,12 +23524,14 @@
* @property {function(): boolean} allowsPersistence whether the services may write to browser
* storage: consent allows storing, and disable_persistence is off. Without it they keep their data
* in memory.
* @property {function(): boolean} allowsExemptMeasurement whether 'exempt' events go out and remote
* settings are fetched before consent
*/


/**
* @param {function(string): boolean} allowsFunc whether consent allows 'api_calls', 'send',
* 'fetch' or 'store' now
* 'fetch', 'store' or 'exempt_measurement' now
* @param {function(string): *} getConfigFunc
* @returns {ConsentGate}
*/
Expand All @@ -23545,6 +23557,9 @@
},
allowsPersistence: function() {
return gate.allowsStoring() && !getConfigFunc('disable_persistence');
},
allowsExemptMeasurement: function() {
return allowsFunc('exempt_measurement');
}
};
return gate;
Expand All @@ -23554,7 +23569,7 @@
* The consent gate the recorder bundle builds when it starts, and hands to its services. The core
* passes the bundle only its instance, so this asks the core's _consent_allows by its quoted name,
* the bundle being built separately. A core without it only knows the opt-out, through
* has_opted_out_tracking().
* has_opted_out_tracking(), and has no exempt mode.
* @param {Object} mixpanelInstance
* @returns {ConsentGate}
*/
Expand All @@ -23565,6 +23580,9 @@
if (typeof consentAllows === 'function') {
return !!consentAllows.call(mixpanelInstance, capability);
}
if (capability === 'exempt_measurement') {
return false;
}
return capability !== 'api_calls' || !mixpanelInstance.has_opted_out_tracking();
},
function(key) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
}

var Config = {
LIB_VERSION: '2.86.0'
LIB_VERSION: '2.87.0'
};

// Window global names for async modules
Expand Down

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions dist/async-modules/mixpanel-targeting-DB9MirjQ.min.js.map

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion dist/async-modules/mixpanel-targeting-Df1HAI3P.min.js.map

This file was deleted.

Loading
Loading