I'm making better performance and load time our online shop, and we use Google Tag Manager on it. But the script that includes google tag manager also loads Google Analytics (legacy
So why is google tag manager including both scripts?
As a coding resume, this is the tag manager inclusion:
On network tab, it appears the inclusion and after it, it loads automatically both scripts:

-
If I analyze the Google Tag Manager script (
So google tag manager is including both scripts. I can assume Universal Google Analytics, but legacy
Can I avoid the inclusion of both or only legacy
Thank you.
from Google Tag Manager includes both legacy Analytics and universal Analytics scripts
ga.js) and Universal Google Analytics (analytics.js) by default. I don't need both of them, but if it's necessary I only need Universal Google Analytics.So why is google tag manager including both scripts?
As a coding resume, this is the tag manager inclusion:
<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-XXXX');</script>
-On network tab, it appears the inclusion and after it, it loads automatically both scripts:
-
If I analyze the Google Tag Manager script (
gtm.js) I see the following:else if (!a) {
var N = c["60"] ? ".google-analytics.com/u/ga_debug.js" : ".google-analytics.com/ga.js";
a = !0;
u(x("https://ssl", "http://www", N, r), O, c["66"])
}
And this:if (!a) {
var M = b["60"] ? "u/analytics_debug.js" : "analytics.js";
b[""] && !b["60"] && (M = "internal/" + M);
a = !0;
bb(x("https:", "http:", "//www.google-analytics.com/" + M, d && d.forceSSL), function() {
var a = $a();
a && a.loaded ||
b["66"]();
}, b["66"])
}
-So google tag manager is including both scripts. I can assume Universal Google Analytics, but legacy
ga.js script why??Can I avoid the inclusion of both or only legacy
ga.js scripts?Thank you.
Edit
I started a bounty because I need an explanation of why this happens, and if it's possible a way to avoid this behavior.from Google Tag Manager includes both legacy Analytics and universal Analytics scripts
No comments:
Post a Comment