Skip to content

Commit

Permalink
override properties with custom campaign properties
Browse files Browse the repository at this point in the history
  • Loading branch information
prabrishac committed Jul 27, 2020
1 parent b11815e commit 24dea89
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions integrations/Optimizely/browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,8 @@ class Optimizely {

// If customCampaignProperties is provided overide the props with it.
// If valid customCampaignProperties present it will override existing props.
const data = window.optimizely && window.optimizely.get("data");
// const data = window.optimizely && window.optimizely.get("data");
const data = campaignState;
if (data && this.customCampaignProperties.length > 0) {
for (
let index = 0;
Expand All @@ -88,8 +89,9 @@ class Optimizely {
) {
const rudderProp = this.customCampaignProperties[index].from;
const optimizelyProp = this.customCampaignProperties[index].to;
if (typeof data[optimizelyProp] !== "undefined") {
props[rudderProp] = data[optimizelyProp];
if (typeof props[optimizelyProp] !== "undefined") {
props[rudderProp] = props[optimizelyProp];
delete props[optimizelyProp];
}
}
}
Expand Down

0 comments on commit 24dea89

Please sign in to comment.