We presented the slides below at Infusionsoft Partnercon. If you saw the presentation, thanks for coming out! If you didn’t, all of the slides, notes, code snippets and more are below. If you have questions or comments, please let us know by filling out our contact form.
The Presentation
Form Abandonment Code
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// NOTE: this assumes you have loaded jQuery | |
$(document).ready(function() { | |
// REPLACE 'UNIQUE_FORM_ID' BELOW WITH THE ID OF YOUR FORM | |
$('#UNIQUE_FORM_ID input').blur(function () { | |
if($(this).val().length > 0) { | |
_gaq.push(['_trackEvent', 'Form: FORM NAME HERE','input_exit_full', $(this).attr('name')]); | |
} | |
else { | |
_gaq.push(['_trackEvent', 'Form: FORM NAME HERE','input_exit_empty', $(this).attr('name')]); | |
} | |
}); | |
}); |
YouTube Play as Google Analytics Event
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//NOTE: you must also include https://ajax.googleapis.com/ajax/libs/swfobject/2.2/swfobject.js | |
var tag = document.createElement('script'); | |
tag.src = "https://www.youtube.com/player_api?enablejsapi=1&version=3&showinfo=0"; | |
var firstScriptTag = document.getElementsByTagName('script')[0]; | |
firstScriptTag.parentNode.insertBefore(tag, firstScriptTag); | |
var player; | |
function onYouTubePlayerAPIReady() { | |
player = new YT.Player('target_div_id', { //replace target_div_id with the id of the div the video should render in | |
height: '480', | |
width: '640', | |
videoId: 'XXXXX', //REPLACE THIS WITH YOUR VIDEO ID | |
events: { | |
'onReady': onPlayerReady, | |
'onStateChange': onPlayerStateChange | |
} | |
}); | |
} | |
function onPlayerStateChange(event) { | |
if (event.data == YT.PlayerState.PLAYING) { | |
_gaq.push(['_trackEvent', 'Videos', 'Play', player.getVideoUrl() ]); | |
} | |
if (event.data == YT.PlayerState.ENDED) { | |
_gaq.push(['_trackEvent', 'Videos', 'Completed', player.getVideoUrl() ]); | |
} | |
} |
Track Twitter Button Clicks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This assumes that you have included the Tweet button via the standard Twitter JS include | |
// Thanks to Google for most of this code, see the Social Interaction Analytics guide at | |
// https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSocial | |
// To track a Tweet, subscribe to the tweet event (note the additional function required | |
// to determine the query parameter being sent to Twitter): | |
function trackTwitter(intent_event) { | |
if (intent_event) { | |
var opt_pagePath; | |
if (intent_event.target && intent_event.target.nodeName == 'IFRAME') { | |
opt_target = extractParamFromUri(intent_event.target.src, 'url'); | |
} | |
_gaq.push(['_trackSocial', 'twitter', 'tweet', opt_pagePath]); | |
} | |
} | |
twttr.ready(function (twttr) { | |
twttr.events.bind('tweet', trackTwitter); | |
}); | |
function extractParamFromUri(uri, paramName) { | |
if (!uri) { | |
return; | |
} | |
var regex = new RegExp('[\\?&#]' + paramName + '=([^&#]*)'); | |
var params = regex.exec(uri); | |
if (params != null) { | |
return unescape(params[1]); | |
} | |
return; | |
} |
Track Facebook Like/Unlike/Share Button Clicks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// This assumes Facebook buttons are using the Facebook Javascript SDK. | |
// Thanks to Google for most of this code, see the Social Interaction Analytics guide at | |
// https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSocial | |
// Facebook provides a Javascript event framework that allows you to subscribe to events | |
// happening within the Facebook Javascript SDK and provides data accordingly. | |
// To track a like, subscribe to the edge.create event and then use the callback to | |
// execute the Analytics tracking code: | |
FB.Event.subscribe('edge.create', function(targetUrl) { | |
_gaq.push(['_trackSocial', 'facebook', 'like', targetUrl]); | |
}); | |
// To track an unlike, subscribe to the edge.remove event and then use the callback to | |
// execute the Analytics tracking code: | |
FB.Event.subscribe('edge.remove', function(targetUrl) { | |
_gaq.push(['_trackSocial', 'facebook', 'unlike', targetUrl]); | |
}); | |
// To track a share, subscribe to the message.send event and then use the callback to | |
// execute the Analytics tracking code: | |
FB.Event.subscribe('message.send', function(targetUrl) { | |
_gaq.push(['_trackSocial', 'facebook', 'send', targetUrl]); | |
}); |
Call Tracking
Use Twimlbin and Twilio to create an easy call tracking solution.
Hey Vuurr!
Thanks for an awesome presentation today. You guys really hit the sweet spot for how we SHOULD be reporting. As Jonathan said, “If you’re just putting a GA script on your site and saying ‘Go!’ then you aren’t tracking a prospect’s experience and how make sure they convert”
One question: what are some of the reporting plugins for Infusionsoft that you mentioned? i.e. Marketing Mavens, etc.
Thanks again for an incredibly VALUABLE session!
-Jonathan