Skip to content

Instantly share code, notes, and snippets.

@Nils-van-Kleef
Created November 27, 2017 15:59
Show Gist options
  • Save Nils-van-Kleef/dbc2eea069dd6adbe43753f2f51d5f7b to your computer and use it in GitHub Desktop.
Save Nils-van-Kleef/dbc2eea069dd6adbe43753f2f51d5f7b to your computer and use it in GitHub Desktop.
Integration of Econda with Optimizely. Use in Custom Analytics Integrations (or Project JavaScript).
// Pre conditions :
// 1: Econda-Tracking-Script is loaded before
(function(){
var decObject = window.optimizely.get("state").getDecisionObject({campaignId: campaignId});
if( typeof window.emos3 !== 'undefined'){
window.emos3.send({ type: 'event', abtest: [ [decObject.experiment , decObject.variation] ] });
} else if (typeof(window.emosPropertiesEvent)== "function"){
window.emosPropertiesEvent({ type: 'event', abtest: [ [decObject.experiment , decObject.variation] ] });
} else {
console.log("Problem: econda A/B Test Tracking is activated but tracking library is not yet loaded. Could not send data to econda.");
}
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment