segmentio/analytics.js-integrations

Duplicate "Experiment Viewed" events for VWO integration

codenamerhubarb opened this issue · 1 comments

I've created a Visual Website Optimizer (VWO) A/B test with the VWO destination Segment integration.
I've noticed in the Segment debugger for my website (React with analytics.js) that the "Experiment Viewed" track event is often coming through doubled or tripled, even for the control variation, just milliseconds apart.
These events all have a unique messageId and timestamps.
I have tried changing various settings both in VWO and Segment but the issue persists.
Any ideas?

image
image

As a workaround, I turned off Send experiment data to other tools (as a track call) in the Segment VWO integration and instead added this to the Campaign code (the code that is executed after applying changes for all variations) on the VWO website:

var hasCampaignData = !!_vwo_campaignData; var hasAnalytics = !!window.analytics; if (hasAnalytics && hasCampaignData) { window.analytics.track("Experiment Viewed", { experimentId: '5', variationName: _vwo_campaignData[5].n }); }

This works much better. No more duplicated events.