I'm working on a landing page which currently references these Google resources:

  • https://www.googletagmanager.com/gtag/js?id=UA-12345 (which then pulls n https://www.google-analytics.com/analytics.js, which in turn then pulls n https://www.google-analytics.com/collect). This is apparently used for basic Google Analytics integration (it provides access to the gtag.js library). In particular, we use it for triggering Goals in Google Analytics via window.gtag.

  • https://www.googleadservices.com/pagead/conversion_async.js which is used for tracking conversions in Google Ads (it provides the window.google_trackConversion function).

  • https://www.googletagmanager.com/gtm.js?id=GTM-12345 for integration with Google TagManager, though I'm not even sure it is used by default.

The net effect is that this (otherwise very lightweight) page requests five additional JavaScript files from three different domains for an additional 62kB of data (which is more than 15% of the total size of the page).

Is there any way to consolidate this or reduce the number of requests needed? For example, my understanding is that gtag.js supersedes analytics.js -- is it maybe possible to make https://www.googletagmanager.com/gtag/js?id=UA-12345 pull in gtag.js nstead of analytics.js (such that my page would no longer need to include it directly)?

  • Why? They are all async... With gtm or without. – Evgeniy Sep 26 '19 at 10:28
  • Welcome to Webmasters! – closetnoc Sep 26 '19 at 13:44
  • @Evgeniy I'm just looking at the work the browser has to do when visiting my web page and try to clarify if & what of those things is really necessary (whether or not the files are fetched synchronously or not is my next consideration, after having decided which files need to be fetched in the first place). – Frerich Raabe Sep 27 '19 at 10:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.