CPD Integration for Experify
Customer Data Platforms (CDPs) are an important part of the modern marketer’s tech stack. As a third-party service that your website visitors will interact with, Experify enables you to augment a visitor's CDP record with event data reflecting the visitor’s usage of your Experify offering. This data can be useful for various reasons:
identifying flaws in your Experify integration
tracking the effectiveness of your Experify offering
augmenting visitor data for improved targeting
…
The below documentation describes the technical integration of this functionality.
Sending Experify events to data collectors
We use the command pattern for configuration and execution of custom event handlers.
Setup
Create a file experifyEventTracking.js
and include it in your website. Make sure that the experify.js
script will be loaded as well, together with potentially any other CDP-related scripts (such as e.g. Klaviyo's klaviyo.js
or Segment's analytics.js
).
The following code snippets and examples are to be added to your experifyEventTracking.js
.
(We suggest adding your Experify event tracking to such a separate javascript file for easier maintainability, but ultimately it is up to you where you add the needed code, and strictly speaking, creating experifyEventTracking.js
isn’t necessary.)
Initialize Experify Tracking
Initialize the global ExperifyApi
object. This object must be initialized before any handlers (see below) are registered.
ExperifyApi = window["ExperifyApi"] || [];
Define callback functions
In order to track events with the below handlers, you will have to define the callback function that should be executed when an event happens and send associated event data to your data collector.
Your callback function will have access to an object called event
of the following type:
event = { eventName: string timestamp: bigint }
Below are simple callback function examples for two famous CDPs. Define these, or any other callback function you want to use, in experifyEventTracking.js.
Example Callback 1: Send event data to Klaviyo
If you want to send data to your Klaviyo CDP, and you already have the klaviyo.js installed on your website, a simple callback function to associate the Experify event with your CDP record could look something like this:
function myExperifyTrackingCallback(event) { klaviyo.push(['track', event['eventName']]) }
Please note the Klaviyo developer documentation.
Example Callback 2: Send event data to Segment
If you want to send data to your Segment CDP, and you already have the Segment analytics.js installed on your website, a simple callback function to associate the Experify event with your CDP record could look something like this:
function myExperifyTrackingCallback(event) { analytics.track(event['eventName']) }
Please note the Segment developer documentation.
Clearly, you can define whatever callback function you like, above are just two simple examples.
Available Event types
Below you will find a list of available event types that can be sent to your data collector.
openedExperifyPlugin
Fires when Experify Plugin is opened by the user (for example by clicking the button).
ExperifyApi.push(["addHandler", "openedExperifyPlugin", function(event) { //Your code after successful Experify Plugin open }]);
where event
is defined as:
{ "eventName": "openedExperifyPlugin", "timestamp": 1681803782584 //Event timestamp millis }
clickedExperifyUserStory
Fires when user clicked any profile inside Experify Plugin.
ExperifyApi.push(["addHandler", "clickedExperifyUserStory", function(event) { //Your code after successful user story click }]);
where event
is defined as:
{ "eventName": "clickedExperifyUserStory", "timestamp": 1681803782584 //Event timestamp millis }
sentContactRequest
Fires when new contact request is sent, so new conversation has started.
ExperifyApi.push(["addHandler", "sentContactRequest", function(event) { //Your code after successful contact request sent }]);
where event
is defined as:
{ "eventName": "sentContactRequest", "timestamp": 1681803782584 //Event timestamp millis }
Example experifyEventTracking.js
Here is an example experifyEventTracking.js
, assuming you want to track events openedExperifyPlugin
and clickedExperifyUserStory
and sentContactRequest
and you are using Klaviyo as your CDP.
//experifyEventTracking.js //Define callback function function myExperifyTrackingCallback(event) { klaviyo.push(['track', event['eventName']]) }; //Initialize Experify tracking object ExperifyApi = window["ExperifyApi"] || []; //Attach handlers ExperifyApi.push(["addHandler", "openedExperifyPlugin", myExperifyTrackingCallback]); ExperifyApi.push(["addHandler", "clickedExperifyUserStory", myExperifyTrackingCallback]); ExperifyApi.push(["addHandler", "sentContactRequest", myExperifyTrackingCallback]);