Is there a solution for getting a Google Tag Manager container to fire all its tags under Turbolinks?
In my Rails 4.0 application with Turbolinks, I have included the following code in a footer that is rendered on every page within the <head>
tags:
<!-- Google Tag Manager -->
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
<script>(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'?'&l='+l:'';j.async=true;j.src=
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','GTM-XXXXX');</script>
<!-- End Google Tag Manager -->
(where XXXXX represents my GTM container ID)
Unfortunately, none of the tags are triggered when navigating between pages (possibly due to Turbolinks). However, everything works correctly upon page refresh.
I've come across discussions about workarounds for Google Analytics tags addressing similar issues, but nothing specifically for a complete GTM container. Any assistance or insights would be greatly appreciated!