This article will help you:
  • Integrate Segment to send custom events and revenue data to Optimizely
  • Implement the Optimizely snippet if you're using Segment

Segment is a customer data hub — a single place to collect and route your data with one click. When you track data with Segment’s API, you can automatically send it to over 160 tools for analytics and marketing, as well as a hosted schematized SQL database.

With Segment’s Optimizely integration, you’ll be able to automatically send all the conversion events you’re tracking with Segment to Optimizely. You’ll use these events to create conversion events, goals, and custom audiences. Segment also automatically sends a `track` event when a customer views an experiment to all of your other tools, which allows you to do more advanced analysis of your experiments in tools like Kissmetrics, Mixpanel, and more.

Sample Use Cases

  • Analyze how experiments performed across audiences and for downstream KPIs in Mixpanel
  • Analyze how experiments affect LTV of customers in Omniture
  • Extend web experiments and messaging to email campaigns in Marketo
  • See how users interact with experiment variations with heat maps and playback videos in FullStory

Enabling Optimizely in Segment

Sign up or log into your Segment account. Find the Optimizely integration in the Dashboard. Flip the switch on and add Segment’s javascript snippet below Optimizely’s snippet. Segment’s Javascript snippet can be found here.


You can make sure that your Optimizely experiment is running by looking at Segment’s debugger, and search for events and look through all event data using Segment’s filtering feature. Additionally, you’ll be able to improve the quality and consistency of your customer data with Segment’s tracking plan.

Load Optimizely Synchronously

Placing Optimizely in the <head> tag of your site allows it to load before any elements on the page, including your analytics scripts. Optimizely loads synchronously so that it can apply visual changes to your website before other scripts run, including your analytics platform. That means you need to load Optimizely separately from the Segment library, which loads asynchronously.

Drop Optimizely’s javascript snippet onto the page outside of Segment as the first item in the head tag. As soon as you do that, Segment will send custom events through to Optimizely to help you measure A/B test conversions, and Segment will pass the A/B test experiment variations through to your other tools for deeper downstream analysis.

If you have any questions about Segment, you can reach out to them at