We embed Tag Manager into the page as follows:
....
<head>
<script>
window.dataLayer = window.dataLayer || [];
</script>
<!-- Google Tag Manager -->
<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=
'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
})(window,document,'script','dataLayer','#########');</script>
<!-- End Google Tag Manager -->
This are the events that show in preview mode.
For some reason "pageView" event isn't triggered.
I'm aware that that might happen when the data layer variable is recreated after the GTM container (link), but that is not the case.
We checked if some other JS might be causing this, but even when we removed all other code, and left with just the tag manager code (as above), the problem remained.
Any idea why this might be happening?
Page View
was recently renamed to Container Loaded