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
// replace the attribute with the appropriate data attribute | |
// if the attribute is divided with something other than commas, change tracking.split | |
// change the number to 0, 1, or 2, depending on whether you want the category, action, or label | |
function() { | |
var tracking = {{element}}.getAttribute('data-track-event'); | |
tracking = tracking.split(','); |
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 macro looks for elements with data-track-event. | |
// To look for other attributes, replace "data-track-event" below. | |
// Note that it applies only to a specific element, and doesn't appropriately bubble. | |
function() { | |
var tracking = {{element}}.getAttribute('data-track-event'); | |
if (tracking) { | |
return true; | |
} else { | |
return false; |
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
<script> | |
if (window.$) { | |
var width = $(window).width(); | |
var height = $(window).height(); | |
ga('send', 'event', 'Viewport', 'Size', width + 'x' + height, 0, {'nonInteraction': 1}); | |
} | |
</script> |
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
// Replace CATEGORY and ACTION with the names that you desire for your events. | |
<script type="text/javascript"> | |
/** | |
* @name jQuery.trackScrolls | |
* @desc Watch for scrolling past certain positions. | |
* | |
* @example: | |
* |
NewerOlder