Tracking Twitter Interactions in Convert Experiments

THIS ARTICLE WILL HELP YOU:

Introduction

One of the things that Convert Experiments allows you to do, is to add social media elements to your pages such as Facebook "Like" buttons, Twitter "Follow" buttons, and Google "+1" buttons. This guide will show you how to (i) add these elements to your website using the Convert Visual Editor and how to (ii) track these social media elements e.g. "Twitter follows" as a goal.

For sake of simplicity, we will use the "Twitter follows" in the steps described below.

Add Official Twitter Plugin in your Website

Install the official Twitter plugin, in our case we want the Follow button which is accessible here.

Install Twitter SDK for Javascript in your Website

Include the Twitter for Websites JavaScript once in your page template for optimal web page performance and to enable tracking of Twitter widget JavaScript events. The widget.js script is available here:

<script>window.twttr = (function(d, s, id) {
var js, fjs = d.getElementsByTagName(s)[0],
t = window.twttr || {};
if (d.getElementById(id)) return t;
js = d.createElement(s);
js.id = id;
js.src = "https://platform.twitter.com/widgets.js";
fjs.parentNode.insertBefore(js, fjs);

t._e = [];
t.ready = function(f) {
t._e.push(f);
};

return t;
}(document, "script", "twitter-wjs"));</script>

Add Twitter Interactions Tracking Code in your Website

Add following Twitter interactions tracking code just after your Twitter official plugin:

<script>
//Define Call Back functions
function followIntentToAnalytics (intentEvent) {
window._conv_q = window._conv_q || [];
_conv_q.push(["triggerConversion", "GOAL_ID"]);
}
// Wait for the asynchronous resources to load twttr.ready(function (twttr) { // Now bind our custom intent events twttr.events.bind('follow', followIntentToAnalytics); });
</script>

Create Convert JS Goal

You need to create a JS goal. Give it a descriptive name e.g. Twitter Follows and get the goal ID (to replaced the code in previous step):

View Conversions in Convert Report

Once you've added this code to your page and added the goal to your experiment, Convert will begin tracking conversions immediately for running experiments.