1

My understanding of Google Tag Manager (GTM) is that it's a centralized place to register tags to be inserted into your website.

For GA4, there's a customized tag type allowing it to load on all pages. However, I don't see one for Google Adsense, which is strange because it's a Google product. I could add it to all pages as a "custom HTML" tag, but a few sources/threads on the web seem to imply that the tracking code/code snippet should not be placed via GTM, though I don't understand why. Is this true? Any insights would be appreciated.

1 Answer 1

0

When you load something via GTM, you're effectively adding a sync dependency. So first the browser sends a request to load the GTM library, and then once it's loaded, it deploys your CHTML that then sends another request to load a library.

So theoretically, scripts loaded through GTM take about twice as long to load. However, this only applies to the first hit given that the loaded libraries haven't been cached by the browser. First hit taking slightly longer to populate your ads is your only concern. Given that GTM and Adsense libraries are hosted via Google's CDN, they are always pretty fast to load.

The only case where I would consider loading Adsense directly from the site is when there's a good business reason to do so, like the GTM container being poorly maintained over the years, collecting a lot of garbage, measurably slowing down the overall loading.

Another thing to consider is that GTM is normally blocked by adblockers. But then they would most certainly block adsense too.

1
  • Thanks for taking the time to explain! Given your explanation, I might keep loading my adcode in the header instead of GTM if it's possibly slightly faster. Cheers.
    – mbartizmo
    Nov 21, 2022 at 20:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.