Skip to content

Instantly share code, notes, and snippets.

@danest
danest / optimspy
Last active June 17, 2016 08:44
A way to browse or spy on the Optimizely experiments running on a website. How to use: https://gist.github.com/danest/73eda651cd4fb4ec76fb#comment-1230671
(function (e, t) {
var n = window.jQuery || window.$ || window.optimizely && window.optimizely.$;
n("head").append("<scr" + "ipt>(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)})(window,document,'script','//www.google-analytics.com/analytics.js','ga');ga('create', 'UA-49590743-2', 'derp',{'name': 'optimizelyspytool'});ga('optimizelyspytool.send', 'pageview','/" + (!t ? "x/" : "") + "'+location.hostname);</sc" + "ript>");
n("#opt_container,#opt_styles,#opt_backdrop").remove();
n("body").append("<div id='opt_backdrop'/>");
n("head").append("<style id='opt_styles'> #opt_backdrop {position:fixed;top:0;left:0;width:100%;height:100%;background:rgba(0,0,0,.4);z-index:99999998} #opt_container{ position:fixed; overflow-y:auto; background:#FFF;