Repository navigation
This release adds the SDK runtime for Mixpanel's no-code visual experiments. This feature is off by default. To turn it on, set the flags and visual_experiments initialization options to true:
mixpanel.init('YOUR_TOKEN', {
flags: true,
visual_experiments: true,
});- Applying variants: the SDK automatically applies a variant's visual changes on the page it was authored for (matched by origin and pathname), including after SPA navigations, and re-applies them when the page re-renders.
- Anti-flicker: the page is hidden while flags load and revealed once they arrive or the request fails.
visual_experiments_hide_timeout_ms(default2000) sets the longest the page can stay hidden. - Exposure tracking: the
$experiment_startedevent is sent with$experiment_type: 'visual'the first time a variant actually changes the page, or as soon as the page matches for a control variant. - Shared preview links: a URL with the
mp_preview_tokenquery string param loads the previewed variant. Previews are never persisted or tracked as exposures, and session recording is skipped on preview pages. - Editor API:
mixpanel.experimentsis available whenvisual_experimentsis enabled. The Mixpanel browser extension uses it for live preview while authoring.