title: Parent Class in Google Tag Manager
body: <p>I found this Google Tag Manager macro script (<a href="http://viget.com/advance/gtm#elementclass" rel="nofollow">http://viget.com/advance/gtm#elementclass</a>) to identify if an element's parent has a specific class value.</p>
  
  <pre><code>function crawlByClassName () {
  var el = {{element}};
  
  while (el &amp;&amp; el !== document.body &amp;&amp; el.className !== 'INSERT CLASS NAME') {
      el = el.parentElement;
  }
  
  return el.className === 'INSERT CLASS NAME';
  }﻿
  </code></pre>
  
  <p>Is there a way to modify it to record the value and then use a rule to specify the name? Or is there a different way to achieve this?</p>