All Collections
FunnelEnvy Optimizely X Client Side interaction
FunnelEnvy Optimizely X Client Side interaction
Arun Sivashankaran avatar
Written by Arun Sivashankaran
Updated over a week ago

To send FunnelEnvy audiences to Optimizely X you'll need to add a small script to the site (backstage.js). This controls the interaction between the FunnelEnvy backend and Optimizely X.

The following components are relevant to understanding how these elements interact:

  • backstage.js - The client side javascript snippet provided by FunnelEnvy

  • client cache - A local storage based cache on the visitors browser

  • FunnelEnvy platform - The backend API that classifies the user based on data sources and configured audience conditions, returning visitor data in the form of audiences and other meta data.

  • Opt X JS - Optimizely's Javascript API for the Optimizely X platform.

FunnelEnvy sets Optimizely X Custom Attributes to associate a visitor with a particular Optimizely X audience. The Custom Attribute and audience is created through the Optimizely X REST API, and the backstage.js sets the attribute for a particular visitor in real time when the "classified" audiences are returned from the FunnelEnvy API.

The sequence of events in the browser is depicted in the following diagram and described below:

  1. backstage.js checks the local cache for any cached audiences. If cached audiences exist these are returned

  2. [on cache miss] backstage.js calls the FunnelEnvy platform API for data about the current visitor. The backend uses the visitor information to 'classify' and existing conditions to 'classify' the user into zero or more audiences.

  3. the local cache is updated with the classified audience data

  4. If any of the classified audiences is associated with an Optimizely X audience an attribute is set through the Optimizely X Javascript API using the User JS method.

Did this answer your question?