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
<!-- Google Tag Manager --> | |
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-TGVFDQ" | |
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript> | |
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start': | |
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0], | |
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src= | |
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f); | |
})(window,document,'script','dataLayer','GTM-TGVFDQ');</script> | |
<!-- End Google Tag Manager --> |
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
// 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
// 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
function(){ | |
if ( {{element url}}.indexOf({{url}} + '#') === 0 ) { | |
return true; | |
} | |
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> | |
var pageView = function() { | |
_gaq.push(['_trackPageview', {{url with hash}}]); | |
}; | |
if (!('onhashchange' in window)) { | |
var oldHref = location.href; | |
setInterval(function() { | |
var newHref = location.href; |
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
function() { | |
var urlWithHash = location.pathname + location.search + location.hash; | |
return urlWithHash; | |
} |
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
// Returns: Values of data attribute | |
// Replace 'data-track-gtm' with the data attribute you're seeking | |
function() { | |
var isSet = function(val) { | |
return val !== null && val !== ''; | |
}; | |
var el = {{element}}; | |
var val = el.getAttribute('data-track-gtm'); | |
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 data attributes whose values are separated by a pipe ('|'). Replace the pipe with the separator your data attribute uses, such as a comma. | |
function() { | |
tracking = {{Get Values from Data Attribute}}; | |
tracking = tracking.split('|'); | |
return tracking[0]; | |
} |
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 data attributes whose values are separated by a pipe ('|'). Replace the pipe with the separator your data attribute uses, such as a comma. | |
function() { | |
tracking = {{Get Values from Data Attribute}}; | |
tracking = tracking.split('|'); | |
return tracking[1]; | |
} |
OlderNewer