Created
January 23, 2012 21:09
-
-
Save averyvery/1665543 to your computer and use it in GitHub Desktop.
Trackiffer Snippets
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
// 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