I found that the code that most affects the speed of my website is from Google. What should I do?

Topic summary

A user discovered that Google-related code (Google Tag Manager, Google CDN, and other Google APIs/SDKs) is significantly slowing down their website, causing unused JavaScript issues and blocking the main thread for 930ms.

Proposed Solution:
One community member suggested adding preconnect link tags to the theme.liquid file (between <head> and </head>) for:

This aims to establish early connections to these domains.

Current Status:
The discussion remains open with mixed clarity. While the original poster expressed interest in trying the solution, questions arose about:

  • Exact placement of the code
  • Whether users can do anything if they need Google Ads or GA4 for conversion tracking
  • Effectiveness of the proposed fix

Another user confirmed experiencing similar issues with Google Tag Manager blocking execution for about half a second, despite only setting it up through the “Google & YouTube” Sales Channel with no custom pixels or theme code references. A developer expressed doubt about whether the suggested fix would work, and the responder clarified they were only confirming the issue, not offering a definitive solution.

Summarized with AI on November 4. AI used: claude-sonnet-4-5-20250929.
  • Reduce unused Javascript:

Google Tag Manager

Google CDN

Other Google APIs/SDKs

  • Reduce the impact of third-party code:Third-party code blocked the main thread for 930 ms

Google CDN

Google Tag Manager

Other Google APIs/SDKs

So, do I need to do sth? or I cant do nothing if I use GA4 or google ads for conversion tracking.

My PageSpeed Insigh link

Thanks a lot.

1 Like

Hello! Try add this code to your theme.liquid

And avada apps is not very optimized.

Wow!!!Thanks so much.

I will have a try!

Hey,

Where should I add the code please?

Anywhere between and

Thanks a lot

1 Like

See on google but the best is preconnect first

1 Like

Hi, where did you enter the code? Anywhere between and ? Thanks

1 Like

Similarly for us, gtag (Google Tag Manager) is the biggest third party offender in terms of blocking execution (taking about half a second) as reported by PageSpeed.
I downloaded the theme to be sure and there’s no reference in code.
We have no Custom Pixels.
We only set it up through the “Google & Youtube” Sales Channel.

Will this fix still work - my developer is doubtful?

Denis

Hello Denis. I think you might be misinterpreting my comment. I am not offering any fix or workaround. I am simply confirming the issue with additional context and information.