title: 'Cannot stringify dataLayer' when using Google Tag Managers 'click-listener' in angular-js app
body: <p>We are trying to implement tracking via the google tag manager for an angularjs app. When using a click-listener defined in the tag-manager, the following script gets injected into the app on every click (or so it seems):</p>
  
  <pre><code>(function (a)
  {
      var b = {}, c;
      for (c in a || {})if (a.hasOwnProperty(c) &amp;&amp; "undefined" != typeof a[c])try {
          b[c] = JSON.stringify(a[c])
      } catch (d) {
          console.log("Cannot stringify " + c)
      }
      a = document.createEvent("CustomEvent");
      a.initCustomEvent("RetrievedVariablesEvent", !0, !0, {variables: b});
      window.dispatchEvent(a)
  })({'studioV2': window['studioV2'], 'richMediaIframeBreakoutCreatives': window['richMediaIframeBreakoutCreatives'], 'dataLayer': window['dataLayer']})
  </code></pre>
  
  <p>When a click is tracked the <code>"Cannot stringify dataLayer"</code> error occurs. The reason for this is, that with the click, also the element is send which has a circular reference to itself, because of the child and parent references attached to the object (by jquery possibly??).</p>
  
  <p>Any ideas how to implement a click-listener with the google tag manager, without running into this recursion?</p>