Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save jamesspittal/d153f3d62d465ed9e5974c903336189b to your computer and use it in GitHub Desktop.
Save jamesspittal/d153f3d62d465ed9e5974c903336189b to your computer and use it in GitHub Desktop.
(function getABTest() {
var abTestName = '',
abTestVariation = '',
abTest = 'No test',
abTestExperiments = optimizely.allExperiments[Object.keys(optimizely.variationMap)];
if (abTestExperiments) {
abTestVariation = Object.keys(optimizely.variationNamesMap).map(function(el) { return optimizely.variationNamesMap[el]; })[0];
abTestName = abTestExperiments.name;
abTest = abTestName + ': ' + abTestVariation;
}
return abTest;
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment