Skip to content

Instantly share code, notes, and snippets.

@averyvery
Created January 23, 2012 21:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save averyvery/1665543 to your computer and use it in GitHub Desktop.
Save averyvery/1665543 to your computer and use it in GitHub Desktop.
Trackiffer Snippets
// tracking page title and url
'a' : ['_trackEvent', 'foo', document.title, window.location.url]
// tracking a concatenated string
'a' : ['_trackEvent', 'foo', document.title + ' page', 'bar']
// tracking a non-interaction event - set the sixth value to true
'a' : ['_trackEvent', 'foo', 'bar', 'foobar', undefined, true]
// tracking a click on a JS interaction
// in some cases, trackiffer will break JS interactions — if this happens, try setting delay to false
'a' : {
delay : false,
rule : ['_trackEvent', 'foo', 'bar', 'foobar']
}
// record the text of an H3 that's inside the same LI your link is in
trackiffer({
'.classname' : [
'_trackEvent',
'foo',
function($N){
return 'Donate Link - ' + $N.closest('li').find('h3').text();
}
]
});
// add trackiffer to a site that doesn't have jquery
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
<script src="{{path}}trackiffer.min.js"></script>
<script>
trackiffer({
'a' [...]
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment