Skip to content

Instantly share code, notes, and snippets.

@simondahla
Last active November 29, 2019 11:21
Show Gist options
  • Save simondahla/b0f1226be8cf57680be9 to your computer and use it in GitHub Desktop.
Save simondahla/b0f1226be8cf57680be9 to your computer and use it in GitHub Desktop.
$(function() {
var experimentID = optimizely.data.state.activeExperiments[0];
var experimentName = experimentID;
if (typeof optimizely.data.experiments[experimentID] !== 'undefined') {
experimentName = optimizely.data.experiments[experimentID].name;
}
var variationName = optimizely.data.state.variationNamesMap[experimentID];
ga('send', 'event', 'ABEvent', experimentName, variationName, 1, {'nonInteraction': true});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment