Skip to content

Instantly share code, notes, and snippets.

View mitchdaniels's full-sized avatar

Mitch Daniels mitchdaniels

  • Teamworks
  • Durham, NC
View GitHub Profile
// Macro: "data-track-gtm - get from element"
// Returns: Boolean - does this element, or one of its parents, have a data-track-gtm attribute?
function() {
var isSet = function(val) {
return val !== null && val !== '';
};
var el = {{element}};
var val = el.getAttribute('data-track-gtm');
while (el && el !== document.body && !isSet(val)) {