---
title: Optimizely
description: 
product: data
token_estimate: 1250
---
# Optimizely

> For AI agents: a documentation index is available at [/docs/llms.txt](/docs/llms.txt). Append `.md` to any page URL for markdown, or send `Accept: text/markdown`.

Integrating Optimizely's experiment tools with Amplitude Analytics lets you share user data in real time. It helps non-technical product and marketing team members do full-circle tracking, analysis, and engagement across web and mobile apps.

This integration is available to all customers who have access to Optimizely's Custom Analytics Integration feature.

## Prerequisites

Be sure you have the most recent Amplitude Browser SDK implemented. You must place the Amplitude snippet before the Optimizely snippet.

## Set up the integration

To integrate Optimizely with Amplitude, follow these steps:

1. Log in to your Optimizely account, select a project, and navigate to _Settings > Integrations_. The URL should follow this format: `https://app.optimizely.com/v2/projects/[PROJECT_ID]/settings/integrations`.
2. From the _Create Analytics Integration_ dropdown, select **Using JSON**.
3. Insert the following code:

   ```json
     {
       "plugin_type":"analytics_integration",
       "name":"Amplitude Analytics Integration",
       "form_schema":[
         {
           "default_value":"[Optimizely Experiment]",
           "field_type":"text",
           "name":"property_prefix",
           "label":"User Property Prefix: A user property for your experiment will be sent in an identify call. The user property will be prefixed with this prefix.",
           "options":null
         },
         {
           "default_value":"n",
           "field_type":"dropdown",
           "name":"send_event",
           "label":"Send Event: Optionally send an event with campaign, experiment, and variation info",
           "options":{
             "choices":[
               {
                 "value":"n",
                 "label":"No (not needed)"
               },
               {
                 "value":"y",
                 "label":"Yes"
               }
             ]
           }
         },
         {
           "default_value":"User in Experiment",
           "field_type":"text",
           "name":"event_name",
           "label":"Event Name (optional)",
           "options":null
         }
       ],
       "description":"Send an identify call to amplitude identifying the experiment variation the user is seeing. Also, optionally send an event to amplitude that the user is in an experiment.\n\nSettings:",
       "options":{
         "track_layer_decision":"// VERSION 0.2.0\n// Last Updated: June 2026\n// For Amplitude Browser SDK 2.x (@amplitude/analytics-browser)\n\nvar dataSent = false;\nvar MAX_ATTEMPTS = 9;\nvar RETRY_DELAY_MS = 1000;\n\nfunction getCampaignInfo() {\n return window.optimizely\n .get(\"state\")\n .getDecisionObject({ campaignId: campaignId });\n}\n\nfunction logEvent() {\n var campaignInfo = getCampaignInfo();\n\n if (campaignInfo) {\n var eventProperties = {\n \"[Optimizely Campaign]\": campaignInfo.campaign,\n \"[Optimizely Experiment]\": campaignInfo.experiment,\n \"[Optimizely Variation]\": campaignInfo.variation,\n \"[Optimizely Holdback]\": campaignInfo.holdback\n };\n window.amplitude.track(extension.event_name, eventProperties);\n }\n}\n\nfunction identifyCall() {\n var campaignInfo = getCampaignInfo();\n\n if (campaignInfo) {\n var identify = new window.amplitude.Identify().set(\n extension.property_prefix + \" \" + campaignInfo.experiment,\n campaignInfo.variation\n );\n window.amplitude.identify(identify);\n }\n}\n\nfunction sendData() {\n if (!dataSent) {\n identifyCall();\n if (extension.send_event === \"y\") {\n logEvent();\n }\n }\n dataSent = true;\n}\n\nfunction sendToAmplitude(call) {\n if (call >= MAX_ATTEMPTS) {\n return;\n }\n\n if (window.amplitude && typeof window.amplitude.track === \"function\") {\n return sendData();\n }\n\n return setTimeout(function() {\n sendToAmplitude(call + 1);\n }, RETRY_DELAY_MS);\n}\nsendToAmplitude(0);"
       }
     }
       
   ```
4. Turn on the integration from Optimizely's Project Settings page. It's listed as _Amplitude Analytics Integration_.
5. Navigate to an experiment that's generating data you want in Amplitude. In the Optimizely experiment settings panel, go to _Integrations_, and enable _Tracked_ for the Amplitude Analytics Integration. You can also adjust the following settings:

   1. **User Property Prefix**: Optimizely sends a user property to Amplitude to identify users bucketed into the Optimizely experiment. This prefix makes these properties easier to identify in Amplitude.
   2. **Send Event \[Optional\]**: When enabled, sends an event every time an experiment fires. Set to yes or no.
   3. **Event Name \[Optional\]**: If you've selected to send an event, use this setting to specify it. Example: "Viewed Experiment".
6. Save your settings.
7. When the Optimizely experiment runs and collects data, the user properties for this experiment appear in Amplitude.

