问题
I integrated the Google Tag Manager for use with Google Analytics with Angulartics 2 and Angular 4.
In Chrome everything works perfectly fine but in Firefox (v59.0.2) I can see, that the analytics scripts are loaded but the page navigation events never show up in the network view.
Accordingly, in the analytics realtime view I can see the user interactions which come from Chrome, but nothing from Firefox.
The strangest of all things is, that if I deploy my page locally and open it in Firefox, everything works and I can track the session in Google Analytics, but when I deploy the page, it does not work anymore.
I included the GTM as follows
<head>
<!-- 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','GTM-XXXXX');</script>
<!-- End Google Tag Manager -->
<meta charset="utf-8">
<title>My Page</title>
<base href="/">
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body id="body">
<!-- Google Tag Manager (noscript) -->
<noscript><iframe src="https://www.googletagmanager.com/ns.html?id=GTM-XXXXX"
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
Does anybody have an idea what the difference between the deployment and the local instance could be? The deployed version is delivered by HTTPS - could that make any difference?
BTW, I disabled the 'Do not track' option in Firefox completely and have no plugins installed.
回答1:
Sounds like Firefox is banning analytical sites
The resource at “https://www.googletagmanager.com/gtm.js?id=XXX-XXXXX” was blocked because tracking protection is enabled
pulseability.io
Source: https://developer.mozilla.org/en-US/Firefox/Privacy/Tracking_Protection?utm_source=mozilla&utm_medium=firefox-console-errors&utm_campaign=default
来源:https://stackoverflow.com/questions/49538852/google-tag-manager-not-firing-event-in-firefox