Skip to content

wingify/vwo-segment-analytics-next

VWO Segment (analytics-next) integration

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.

Package installation

# via npm
npm install vwo-segment-analytics-next

# also install Segment's browser SDK
npm install @segment/analytics-next

Usage

This 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.

Requirements

  • Segment initialized using @segment/analytics-next
  • VWO SmartCode installed and exposing the VWO command queue
  • Browser environment (no Node.js/server-side support)

How it works

This plugin follows the VWO SmartCode pattern:

(function () {
  window.VWO = window.VWO || [];
  VWO.push([
    'onVariationApplied',
    function (data) {
      // ...
    },
  ]);
})();

It:

  • Hooks into VWO’s onVariationApplied command
  • Extracts account, experiment, and variation details from _vwo_acc_id and _vwo_exp
  • Reads the VWO UUID from the _vwo_uuid cookie (when available)
  • Sends a track event via @segment/analytics-next
  • Prevents duplicate firing per experiment/variation in a single page view

Peer dependency

"peerDependencies": {
  "@segment/analytics-next": "^1.0.0"
}

Code of Conduct

Code of Conduct

Contributing

Contributing

License

Apache License, Version 2.0

Copyright 2026 Wingify Software Pvt. Ltd.

About

Forward VWO experiment impressions to Segment using @segment/analytics-next

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors