title: How can I fire GTM tags before redirecting?
body: <p>I have a blank page with Google Tag Manager and a javascript redirect. The idea is that the user will pass through this page, the GTM tags will fire, and then they will be redirected.</p>
  
  <p>The problem I'm having is that despite using <code>DOMContentLoaded</code>, the tags don't seem to fire in time. They do fire if I remove the redirect.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>&lt;html&gt;
    &lt;head&gt;
      &lt;meta name="robots" content="noindex" /&gt;
      &lt;title&gt;
        &lt;%= @destination %&gt;
      &lt;/title&gt;
      &lt;%= @head_tags |&gt; raw %&gt;
    &lt;/head&gt;
    &lt;body&gt;
      &lt;!-- Google Tag Manager (noscript) --&gt;
      &lt;noscript&gt;&lt;iframe src="https://www.googletagmanager.com/ns.html?id=GTM-TPHDQF4"
      height="0" width="0" style="display:none;visibility:hidden"&gt;&lt;/iframe&gt;&lt;/noscript&gt;
      &lt;!-- End Google Tag Manager (noscript) --&gt;    
      &lt;script&gt;
      document.addEventListener("DOMContentLoaded", function(event) {
        window.location.href = "&lt;%= @destination %&gt;";
      });
      &lt;/script&gt;
    &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p><strong>How can I wait until GTM tags have fired before redirecting?</strong></p>