Integrate Convert Experiences with Active Campaign

Introduction

Integrating Active Campaign with Convert Experiences allows you to send Convert data in the Active Campaign and segment your contacts based on Convert values.

For each experiment, the integration will pass along the experiment name and variation name that the Visitor is currently bucketed into (if any). 

Add Tracking Code Snippets

Make sure the Convert tracking code and the Active Campaign tracking code are installed on your page. Convert Tracking Code can be found in Project Settings:

You should find your Active Campaign tracking code by logging into your Active Campaign account and go to Tracking. Find here instructions on how to enable Active Campaign Site Tracking.

Important

Enable Active Campaign Event Tracking

Next, you should enable your Active Campaign Event Tracking by following these instructions

Add the Integration Code

Copy this code, after the two tracking codes, to activate the integration:

var refObject = window['convert']['data']['experiments']
	for (var key in window["convert"]["currentData"]["experiments"]) {
			if (!window["convert"]["currentData"]["experiments"].hasOwnProperty(key)) {
				continue;
	}}
            
    var currentExperiment = window["convert"]["currentData"]["experiments"][key];
    var curExperimentName = refObject[key] && refObject[key].n ? refObject[key].n : "unknown experiment name";
    curExperimentName = curExperimentName.replace("Test #", "Test ");
    var curVariant = currentExperiment['variation_name'] ? currentExperiment['variation_name'] : "unknown variant";
    curVariant = curVariant.replace("Var #", "Variation ");
    
    
    // your ActiveCampaign id. You can get this from your AC settings 
    var actid = "1000077108"; 

    // your event key, also in AC settings
    var eventKey = "93f120c55fa6caf9dabc1430d8b4232efead5dfe"; 
    
    // Name for event you want to track.
    var event = "Convert Experiences Variation Name";
    
    var eventData = curVariant;
    
    
    // build the eventString based on the variables you just edited above ☝
    var eventString = "actid=" + actid 
                    + "&key=" + eventKey 
                    + "&event=" + event 
                    + "&eventdata" + eventData;

  // send the event to the ActiveCampaign API with our event values
  var xhttp = new XMLHttpRequest();
  xhttp.open("POST", "https://trackcmp.net/event", true);
  xhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  xhttp.send(eventString);

Verify Installation

The easiest way to verify that your integration code is correctly installed is to go to Tracking and then Event Tracking and see your new event in the list:

You can use then these events as described here.

Have more questions? Submit a request

Comments