title: Google Tag Manager Preview does not display when navigating to pages with TurboLinks
body: <p>I don't think GTM is recording data correctly for my Rails app. When i use the preview feature, the GTM preview data in developer tools only shows on initial page loads, subsequent page loads (using turbolinks) do not show the preview data. How should I set up GTM with TurboLinks?</p>
  
  <p>I have set up my GTM in the header like this:</p>
  
  <pre><code>&lt;script&gt;
  var dataLayer = [];
  (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'?'&amp;l='+l:'';j.async=true;j.src=
  'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
  })(window,document,'script','dataLayer','GTM-N7MDCP');&lt;/script&gt;
  &lt;!-- End Google Tag Manager --&gt;
  </code></pre>
  
  <p>And then at the top of the body:</p>
  
  <pre><code>&lt;script&gt;
  &lt;% if user_signed_in? %&gt;
    dataLayer.push({'userID': '&lt;%= current_user.id %&gt;'},{'userCategory': 'User'});
  &lt;% end %&gt;
  &lt;/script&gt;
  
  
  &lt;!-- Google Tag Manager (noscript) --&gt;
  &lt;noscript&gt;&lt;iframe src="https://www.googletagmanager.com/ns.html?id=GTM-N7MDCP"
  height="0" width="0" style="display:none;visibility:hidden"&gt;&lt;/iframe&gt;&lt;/noscript&gt;
  &lt;!-- End Google Tag Manager (noscript) --&gt;
  
  
  &lt;!-- Google Tag Manager trigger for Turbolinks --&gt;
   &lt;script type="text/javascript"&gt;
     var url = window.location.href;
     dataLayer.push({
       'event':'pageView',
       'virtualUrl': url
     });
   &lt;/script&gt;
   &lt;!-- End Google Tag Manager trigger for Turbolinks --&gt;
  </code></pre>