Dev GuideAPI Reference
Dev GuideAPI ReferenceUser GuideProduct feedbackGitHubNuGetDev CommunitySubmit a ticketLog In

Integrate FullStory

Integrate Optimizely Web Experimentation and FullStory to get insights into how users interact with your Optimizely experiments and ideas for new experiments to run.

This integration is built and maintained by FullStory. Add the FullStory recording snippet to your site, then pass in the experiment, campaign, and variations names and IDs. Contact FullStory support.

📘

Note

Before you integrate FullStory, contact your Optimizely Customer Success Manager and confirm that the Custom Analytics feature is turned on for your account.

Add the FullStory recording snippet to your site

You have two options for adding the FullStory recording snippet to your site:

  • Add the FullStory recording snippet directly to your site (recommended).
  • Use Optimizely Web Experimentation to add the FullStory recording snippet to your site.

Option 1: Add the FullStory recording snippet directly to your site

  1. Create a FullStory account.
  2. Click the link in the FullStory confirmation email to confirm your account.
  3. Log in to your FullStory account, go to Settings, and copy your recording snippet.
  4. Paste your recording snippet into the <head> element in your content management system (CMS) or directly into your application’s code.

📘

Note

Place the FullStory recording snippet above your Optimizely snippet.

FullStory now starts recording sessions for your site visitors.

Option 2: Use Optimizely Web Experimentation to add the FullStory recording snippet to your site

Although you should add FullStory directly to your website, you also can add the FullStory snippet via Optimizely Web Experimentation. 

  1. Create a FullStory account.
  2. Click the link in the FullStory confirmation email to confirm your account.
  3. Log in to your FullStory account, go to Settings, and copy your recording snippet.
  1. Go to Optimizely Settings > JavaScript.
  1. Paste the FullStory recording snippet in the Project JavaScript field.

    📘

    Note

    Do not include the <script> tags.

FullStory now starts recording sessions for your site visitors.

Pass in experiment/variation names and IDs

When running an A/B experiment or multivariate testing, you may want to compare how visitors interact with the different variations of your pages. By passing custom events from Optimizely to FullStory, you can see and compare user sessions by experiment name and variant name. Use OmniSearch in Fullstory to find sessions that ran with Optimizely Experiments.

After you add FullStory to your site, you can pass in experiment and variation names and IDs.

  1. Go to your Web Experimentation > Settings and uncheck Mask descriptive names in project code and third-party integrations (under Privacy in Snippet Settings).
  1. Click Save.
  2. Go to Settings > Integrations and click Create Analytics Integration....
  1. Select Using Visual Editor in the drop-down list.
  2. Enter a name for the integration (for example, "FullStory IDs") and select Create Custom Analytics Integration.
  3. Copy the following code, paste it in the custom field, and click Save.
(function () {
 function _fs() { return window[window['_fs_namespace']]; }
 utils = window.optimizely.get('utils');
 utils.waitUntil(function () {
   return typeof _fs() === 'function';
 }).then(function () {
   var campaignStates = window.optimizely.get('state').getCampaignStates({ isActive: true });
   for (var campaignId in campaignStates) {
     var c = campaignStates[campaignId];
     if (c.isInCampaignHoldback !== true) {
       var payload = {};
       payload.campaign = {};
       payload.campaign.id_str = campaignId;
       payload.campaign.name_str = c.campaignName;
       if (c.experiment) {
         payload.experiment = {};
         payload.experiment.id_str = c.experiment.id;
         payload.experiment.name_str = c.experiment.name;
       }
       if (c.variation) {
         payload.variation = {};
         payload.variation.id_str = c.variation.id;
         payload.variation.name_str = c.variation.name;
       }
       _fs().event('Experiment', payload, 'Optimizely');
     }
   }
 });
})();
  1. Enable the custom integration you just created by going to Settings > Integrations and toggling Enable Integration to on.
  1. Go to Experiments and click the name of your experiment. Under Manage Experiments, select Integrations and select the Tracked checkbox for the FullStory integration that you just created and then click Save.

Repeat this in each experiment where you want the FullStory integration to run.

You can search by experiment and variation name and IDs in FullStory. Just search for "experiment", "campaign", or "variation" and the values for those fields in FullStory.

How to find experiment and variation IDs in Optimizely.

Pass in additional user data (optional)

If you want to pass in additional profile data, you can do so with FullStory’s setUserVars API. To pass in usernames or emails for users that you have already identified, use FullStory’s identify API. Once complete, add the script you have created to your pages by following the instructions you used to add the FullStory snippet (Option 1).

Switch from custom variables to custom events

Earlier iterations of this integration used FullStory’s custom variables API. Current iteration is custom events API. If you are integrating with Optimizely Web Experimentation and FullStory for the first time, you do not need to worry about old experiments. 

If you use custom variables for experiments, you should update your integration to use custom events. If you have experiments that are currently running, continue using the old integration without making changes to the experiment. Create a new integration using custom events (following the instructions in this guide) and use it for all new experiments going forward.

Why use custom events?

Over time, you may run many experiments on your site. Custom events provide an easier and more elegant search experience when you have run multiple experiments or have multiple users who have engaged in many experiments. Any older experiments that you run with custom variables are still available to you once you switched to custom events.