Skip to content

Instantly share code, notes, and snippets.

@tomfuertes
Last active May 10, 2017 15:33
Show Gist options
  • Save tomfuertes/d6d48c6b26cf3ab86804 to your computer and use it in GitHub Desktop.
Save tomfuertes/d6d48c6b26cf3ab86804 to your computer and use it in GitHub Desktop.
link and log exp's
(function() {
var $ = optimizely.$;
$.each(optimizely.allExperiments, function(id, experiment) {
var data = {
name: experiment.name
};
if (experiment.enabled) data['enabled'] = true;
console.group(data);
if (experiment.variation_ids) $.each(
experiment.variation_ids,
function(idx, variation) {
var data = {
v: optimizely.allVariations[variation].name
};
if (optimizely.variationMap[id] === idx) data.on = true;
console.log([
location.protocol, '//', location.hostname,
location.pathname, location.search ? location.search + '&' : '?',
'optimizely_x', id, '=', idx, location.hash
].join(''), data);
});
console.groupEnd();
});
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment