Skip to content

Conversation

@aduth
Copy link

@aduth aduth commented Aug 16, 2024

This pull request proposes to create the Google Tag Manager script using the async attribute on the script element` (see MDN reference).

The DAP script appends a Google Tag Manager script to the page, but it does so without marking the script as asynchronous. This causes the script to block the main thread, impacting user-facing performance.

This reflects in performance audits of our site, which flag Google Tag Manager as blocking main thread for upward of 300ms.

Related resource: https://web.dev/articles/optimizing-content-efficiency-loading-third-party-javascript#async-defer

Google's documentation for Google Tag Manager also uses async in its own default script snippet examples:

Screenshot 2024-08-16 at 9 31 58 AM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant