We have a GA4 tag that is linked to a Google Ads tag.
We load the GA4 tag with the standard snippet, and then GTM automatically loads the Google Ads tag. This is fine, except GTM is making two duplicate requests for the Google Ads tag:
- https://www.googletagmanager.com/gtag/js?id=AW-...
- https://www.googletagmanager.com/gtag/js?id=AW-...&l=dataLayer&cx=c
I am only calling my embed snippet once, and I am not explicitly loading the ads tag, only the GA4 tag.
I have opened these two scripts and they're almost identical. They're ~358KB and are barely different except for two lines of code.
This additional script is around 6% of unnecessary page weight, so I'd love to remove it if possible, to improve page speed.
Is there something I need to do differently in my tag settings or embed code to get GTM to not fire duplicate requests?
It seems there are others with similar problems: Google Tag Manager being loaded multiple times. But I haven't managed to find a solution.
This is my embed code:
// Loads required Google Analytics V4 Property script
const gaURL = `https://www.googletagmanager.com/gtag/js?id=${measurementID}`;
const alreadyLoaded = !loadScript(gaURL, `gtag-global`);
if (alreadyLoaded) {
return;
}
// configure
window.dataLayer = window.dataLayer || [];
window.gtag = function gtag() {
window.dataLayer.push(arguments);
};
window.gtag('js', new Date());
window.gtag('config', config.measurementID, {
allow_google_signals: config.enableAdsTracking,
groups: config.trackerName,
});