Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Grab the Optimizely experiment information uisng javasacript and tag experiments in LuckyOrange
var experimentID = window['optimizely'].data.state.activeExperiments[0];
var variationIndex = window['optimizely'].data.state.variationMap[experimentID];
var variationName = window['optimizely'].data.state.variationNamesMap[experimentID];
var variationID = window['optimizely'].data.state.variationIdsMap[experimentID];
var experiment_name = window['optimizely'].data.experiments[experimentID].name;
if (optimizely_experiment_id === "optimizely_experiment_id_i_wanna_track"){
var _loq = window._loq || []; // ensure queue available
_loq.push(["tag_recording", window['optimizely'].data.experiments[experimentID].name +"-"+window['optimizely'].data.state.variationIdsMap[experimentID]]); // this will tag, won't star, and will append the tag
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.