Last active
March 11, 2016 12:15
-
-
Save lkraav/58954601159ce0a28ea9 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(){ | |
// @version 2016.03.11 | |
var experimentID = COPY_PASTE_ID_FROM_URL; | |
window.optimizely = window.optimizely || []; | |
// avoid firing in editor | |
if (window.optimizely.activeExperiments.indexOf(experimentID.toString()) == -1) return; | |
if (typeof window.optimizely.data.experiments[experimentID] !== 'undefined') { | |
var experimentName = experimentID + ' ' + window.optimizely.data.experiments[experimentID].name; | |
var variationName = window.optimizely.data.state.variationNamesMap[experimentID]; | |
// google analytics events | |
window._gaq = window._gaq || []; | |
window._gaq.push(['_trackEvent', 'Optimizely', experimentName, variationName, 0, true]); | |
// hotjar recordings tags | |
window.hj = window.hj || function() {(hj.q = hj.q || []).push(arguments)}; | |
window.hj('tagRecording', [experimentName, variationName]); | |
} | |
})(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ga-universal-optimizely https://gist.github.com/lkraav/2ac6f6aef6d3d0a2fb71