This document describes how to integrate Permutive segments into the Optimizely platform for the purposes of site-side personalisation.

There are many use cases for passing audiences into Optimizely but the primary one is to tailor content and conduct experimentation testing (A/B, multivariate, etc) in order to drive engagement by understanding what works better for specific audiences. This leads to a range of results including; increased stickiness, increase in conversion rates, improving ad viewability (through an integration with Moat) and eliminating guesswork for key business decisions.

The Integration

By using the following code snippet, Optimizely is able pull in from localStorage and understand which segment a user falls into.

var kvs = localStorage.getItem('_psegs');
var segments = kvs ? JSON.parse(kvs) : [];

Inside the Optimizely UI the user will need to implement the below using Project JS.

This means the JS code will run before the Optimizely code and add the segment ids from localStorage to the Optimizely snippet.

Still inside the Optimizely UI, in Audiences, the user will need to target the relevant Permutive segment id. The audience inside Optimizely is created as below using their drag and drop functionality for custom JS as a 'Standard Condition' from a drop down menu on the right of their interface.

Custom JavaScript Audience conditions allow you to target your 'experiment' for a uniquely defined set of pages or visitors.

The corresponding segment id will need to be added by a user familiar with the Permutive dashboard in order to see the segment they wish to target along with the id.


The Permutive user will need to set up the specific (or choose existing) segments that they wish to use for the Optimizely audience.

Please contact techsupport@permutive.com if you have any questions.

Did this answer your question?