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:
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.
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:
backstage.js checks the local cache for any cached audiences. If cached audiences exist these are returned
[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.
the local cache is updated with the classified audience data