Hi!
In that case you should remove the other tracking codes inserting the external JS libraries. That’ll take care of it!
Only place where GTM is integrated in the website is via CAOS plugin.
Are you saying these 2 external JS shouldn’t be displaying in Google Page Speed report? When we are using this plugin, only the js file inside the CAOS folder should load?
Exactly. CAOS doesn’t load external libraries. So these two libraries are coming from somewhere else!
Interesting. But when we deactivate the CAOS plugin, none of these js files(CAOS file, 2 external js files) load.
So this has to be somehow related to this plugin right?
Or does this have anything to do with WP Engine server?
Hi Dan,
Additional external scripts are wrapped inside the Google Tag Manager script in Google Console. Could this be a reason for these external scripts being present in the Page Speed Insights result and not in the View Source of the page when the page loads?
One more question, This analytics.js is related to Universal Analytics right? In that case, do we really need to use this analytics.js since the GA4 is released and the Universal Analytics is no longer needed?
Could this be a reason for these external scripts being present in the Page Speed Insights result and not in the View Source of the page when the page loads?
Yup, that’s it. You should remove them.
This analytics.js is related to Universal Analytics right? In that case, do we really need to use this analytics.js since the GA4 is released and the Universal Analytics is no longer needed?
No. GA3 no longer exists, so the analytics.js isn’t needed anymore. Remove it.
But when we deactivate the CAOS plugin, none of these js files(CAOS file, 2 external js files) load.
When you say they don’t load, do you mean that they actually don’t load? Or do they not appear in your Pagespeed report? These are two different things, and only the latter makes sense, because when you disable CAOS, you’re no longer loading duplicate libraries (that’s why the Unused JS recommendation pops up)
Yup, that’s it. You should remove them.
I checked these 2 external scripts/tags inside the GTM. One of them is Analytics.js(GA3) and another one is the GA4 tag.
So in this case, I should be removing the Analytics.js(GA3) code alone right?
Also, one more doubt, If am using only GA4 then there is no need to use the GA4 inside GTM right? I can straight away use the GA4 code inside COAS plugin, isn’t it?
You should also remove the GA4 one, because CAOS inserts a local copy of it.
Also, one more doubt, If am using only GA4 then there is no need to use the GA4 inside GTM right? I can straight away use the GA4 code inside COAS plugin, isn’t it?
Sorry, read pas this, but yes. Exactly!
Thanks for the prompt replies, Dan. Much appreciated! Last 2 days, I have been reading your blogs and really those blogs has been an eye opener in this regard. Thanks!
Cool! And no problem, that’s what I’m here for!
Hi, sorry to disturb, but I wish to ask a related question: CAOS plugin works also with GTM ID? thanks
Hi!
CAOS doesn’t work with Gtm.js. Because the Google Tag Manager containers are unique to each user i.e. gtm.js will not work when hosted locally.
Not to be confused with gtag.js, which is used for GA4 and works perfectly with CAOS.
Hope it helps!