Skip to content

Commit 1a5a090

Browse files
author
Gaurav Nanda
authored
Track every VWO experiment only once (#588)
* Track every VWO experiment only once * Update HISTORY.md * Bump version to 2.4.4
1 parent e275cba commit 1a5a090

File tree

3 files changed

+13
-4
lines changed

3 files changed

+13
-4
lines changed

integrations/visual-website-optimizer/HISTORY.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
2.4.4 / 2021-04-23
2+
==================
3+
4+
* Fix for VWO tracking, Send track call once per experiment.
5+
16
2.4.2 / 2021-02-09
27
==================
38

integrations/visual-website-optimizer/lib/index.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ VWO.prototype.roots = function() {
116116
var analytics = this.analytics;
117117
var self = this;
118118
var identifyCalled = false;
119+
var experimentsTracked = {};
119120
rootExperiments(function(err, data) {
120121
each(data, function(experimentId, variationName) {
121122
var uuid = window.VWO.data.vin.uuid;
@@ -131,9 +132,12 @@ VWO.prototype.roots = function() {
131132
analytics.identify({vwoUserId: uuid});
132133
identifyCalled = true;
133134
}
134-
analytics.track('Experiment Viewed', props, {
135-
context: { integration: integrationContext }
136-
});
135+
if (!experimentsTracked[experimentId]) {
136+
analytics.track('Experiment Viewed', props, {
137+
context: { integration: integrationContext }
138+
});
139+
experimentsTracked[experimentId] = true;
140+
}
137141
});
138142
}, this.options.trackOnlyABExperiments);
139143
};

integrations/visual-website-optimizer/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@segment/analytics.js-integration-visual-website-optimizer",
33
"description": "The Visual Website Optimizer analytics.js integration.",
4-
"version": "2.4.3",
4+
"version": "2.4.4",
55
"keywords": [
66
"analytics.js",
77
"analytics.js-integration",

0 commit comments

Comments
 (0)