0

I'm currently on loading time optimization of a site. On my research of sites using the same consent solution, I found a site, which loads most scripts, including GTM/GA, only after any user action. The site has surely great loading times under 2 seconds.

Most scripts means - usual scripts, which cause TBT (tracking, without above-the-fold coverage).

As for now, I see only one negative impact: GA can't count bounce rates.

Do you see any further negative impacts of loading scripts after user action?

2 Answers 2

2

When done well, this can get scripts that aren’t needed for page load out of the critical path and let the browser concentrate on what is important for page load.

However there are a number of downsides.

When done badly, with a broad “don’t load any scripts” hammer, then scripts that ARE needed for page load don't run. Carousels don’t load, or other important content. The page looks broken until the user moves the mouse. So it’s important to allow scripts needed for load to execute early. And to test this (on a variety of screen sizes) rather than assume you can delay everything without ill consequences.

Also if the script is only loaded and executed on interaction, and it takes a while to load and execute, then it can also lead to poor performance. It’s not unusual to see hamburger menus being really slow to respond to the first click, but then after it’s fast. Which is a classic sign of this pattern

Finally, as you point out, analytics and the like can be delayed.

I can’t help but think that’s sometimes delaying of scripts is done to trick tools like Lighthouse and make a page look faster (“Install this plugin and get 100 Performance score!” [even though the page is broken]) without enough thought as to whether it’s actually making the page better.

1

I can't help think that running scripts when the user interacts with the page will increase the chance of them interfering with INP.

Bots tend not to interact with a page, so don't delay scripts that generate anything you want the bots to see. e.g. structured data in GTM, menus with links, reviews or content.

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.