This plugin allows you to send VWO experiment data to Segment using the modern @segment/analytics-next browser SDK.
It listens to VWO experiment events in the browser and automatically forwards them to Segment as tracking events.
# via npm
npm install vwo-segment-analytics-next
# also install Segment's browser SDK
npm install @segment/analytics-nextThis plugin works with Segment’s @segment/analytics-next library.
Initialize VWOSegment with your Segment Analytics instance:
import { AnalyticsBrowser } from '@segment/analytics-next';
import VWOSegment from 'vwo-segment-analytics-next';
// In your app bootstrap file
const [analytics] = await AnalyticsBrowser.load({
writeKey: 'YOUR_SEGMENT_WRITE_KEY',
});
// Optional: identify the user (for example, session-based)
analytics.identify('USER_OR_SESSION_ID');
// Initialize plugin
const vwoSegment = new VWOSegment({ analytics });
vwoSegment.init();Ensure that the code is rendered and executed exclusively on the client side, as this plugin is designed for browser/client-side functionality only.
- Segment initialized using
@segment/analytics-next - VWO SmartCode installed and exposing the
VWOcommand queue - Browser environment (no Node.js/server-side support)
This plugin follows the VWO SmartCode pattern:
(function () {
window.VWO = window.VWO || [];
VWO.push([
'onVariationApplied',
function (data) {
// ...
},
]);
})();It:
- Hooks into VWO’s
onVariationAppliedcommand - Extracts account, experiment, and variation details from
_vwo_acc_idand_vwo_exp - Reads the VWO UUID from the
_vwo_uuidcookie (when available) - Sends a
trackevent via@segment/analytics-next - Prevents duplicate firing per experiment/variation in a single page view
"peerDependencies": {
"@segment/analytics-next": "^1.0.0"
}Copyright 2026 Wingify Software Pvt. Ltd.