Skip to content

Commit a787555

Browse files
add code to repo
1 parent 45b4152 commit a787555

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed
Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
/**
2+
* Adobe Analytics Integration
3+
* [Installed in Project JS]
4+
*/
5+
var adobeIntegrator = {
6+
LISTVAR: "YOUR-LISTVAR-HERE, ie: 'list3'",
7+
campaignArray: [],
8+
assignCampaigns: function(sVariable) {
9+
sVariable[this.LISTVAR] = sVariable[this.LISTVAR] || [];
10+
for (var i = this.campaignArray.length - 1; i >= 0; i--) {
11+
sVariable[this.LISTVAR].push(this.campaignArray[i]);
12+
this.campaignArray.splice(i, 1);
13+
}
14+
},
15+
trackDelayedCampaigns: function(sVariable) {
16+
sVariable[this.LISTVAR] = sVariable[this.LISTVAR] || [];
17+
sVariable.linkTrackVars += ("," + this.LISTVAR);
18+
for (var i = this.campaignArray.length-1; i >= 0; i--) {
19+
sVariable[this.LISTVAR].push(this.campaignArray[i]);
20+
this.campaignArray.splice(i, 1);
21+
}
22+
sVariable.tl(true, "o", "OptimizelyLayerDecision");
23+
},
24+
formatActiveExperiments: function() {
25+
var expList = [],
26+
expObj = window.optimizelyEdge.get('state').getActiveExperiments();
27+
for (var exp in expObj) {
28+
expList.push(expObj[exp].id + ":" + expObj[exp].variation.id);
29+
}
30+
return expList;
31+
},
32+
init: function() {
33+
var activeExperimentsArray = this.formatActiveExperiments();
34+
if (activeExperimentsArray.length) this.campaignArray = activeExperimentsArray;
35+
}
36+
};
37+
38+
adobeIntegrator.init();
39+
40+
window.OptimizelyEdgeIntegrators = {
41+
get: function(name) {
42+
if (name === 'adobe') {
43+
return adobeIntegrator;
44+
}
45+
throw new Error(name + ' is not a supported module');
46+
}
47+
}
48+
49+

0 commit comments

Comments
 (0)