Created
May 18, 2016 17:58
-
-
Save simondahla/bc44a6ccba17d369141847b3a3c635dd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function() { | |
if (window.optimizely) { | |
var o = optimizely; | |
if (o.activeExperiments && o.allExperiments) { | |
for (var i = 0; i < o.activeExperiments.length; i++) { | |
var experimentId = o.activeExperiments[i]; | |
var experiment = o.allExperiments[experimentId]; | |
if (experiment && experiment.universal_analytics) { | |
var slot = experiment.universal_analytics.slot; | |
if (slot == 3) { // you would fill this in with the slot you are using in Optimizely for this experiment. | |
if (o.variationIdsMap && o.variationNamesMap) { | |
return experimentId + ': ' + o.variationNamesMap[experimentId]; | |
} | |
} | |
} | |
} | |
} | |
} | |
return undefined; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment