At a glance
- "The performance impact of any single tag may be negligible", web.dev says, but it adds up at scale.
- Remove unused tags rather than blocking them with trigger exceptions.
- Fire non-essential tags after the page has loaded; web.dev suggests "after Window Loaded".
- Do not load the cookie notice through the tag manager, and replace heavy widgets with light facades.
Build the inventory
Start with a list, not a tool. For each script on the lobby, game page and cashier, record:
| Field | Why it matters |
|---|---|
| Vendor and purpose | Duplicates are common, such as two analytics tools doing the same job |
| Business owner | Someone must be able to say whether it is still needed |
| Pages where it loads | Many scripts load site-wide but serve one page |
| How it loads (inline, async, defer, tag manager) | Decides when it competes with the page |
| Consent category | Marketing tags should wait for consent where the law requires it |
| Transfer size and main-thread time | From a lab trace on a throttled mobile profile |
Tag managers
A tag manager makes tags easier to add, which is also how sites end up with too many. web.dev's tag guidance includes several points that apply directly:
- Custom HTML tags vary widely in cost and are "easy to misuse in a way that is bad for performance"; prefer more restricted templates where your tag manager offers them.
- Remove unused tags instead of pausing them with trigger exceptions, so their code leaves the container.
- Fire non-essential tags "after Window Loaded", and use specific trigger conditions so tags fire only where needed.
- Cookie notices and similar features generally should not load through the tag manager, because that delays them and can break the site for people who block tag managers.
- Server-side tagging "removes vendor code from the client", though support varies by vendor.
Load order
web.dev's third-party loading guide distinguishes async, which runs a script as soon as it downloads, from defer, which keeps order and waits for parsing. Use defer for scripts the page needs but not at once. Use preconnect only for the most critical third-party origins, test the effect, and dns-prefetch for less important ones. That article dates from 2019, so check browser support for anything newer.
Facades for chat and embeds
Live chat is a common case on casino sites. Most players never open it, yet the full chat code often loads with every page. A facade is a light button or placeholder that looks like the chat launcher and loads the real code when someone taps it. The same approach works for social embeds and video players. Size the facade like the real widget so the swap does not shift the page.
Consent banners
Consent tools sit at the start of every visit. Render the banner as an overlay or a reserved bottom bar, not as a block inserted at the top, which would shift the page and hurt CLS. Make sure the banner itself does not become the LCP element because of its size, and that tags waiting for consent do not all fire in one long task when the visitor accepts.
Affiliate tracking
Operators that work with affiliates usually carry tracking for one or more affiliate platforms. Confirm with each platform which script or pixel is required on which pages, and whether a server-side or post-conversion method is available. Tracking that only matters at registration or deposit does not need to load on every lobby view.
Questions
Is async always better than a normal script tag?
It avoids blocking parsing, but async scripts run as soon as they arrive, which can still interrupt the main thread at a bad moment. defer is often the better choice for non-critical code.
Should we self-host third-party scripts?
web.dev lists benefits, such as fewer connections and better caching, and a main risk: self-hosted copies can fall out of date and miss security fixes.
How often should the audit run?
Whenever a tag is added, and on a fixed schedule, such as each quarter, because tags accumulate quietly.
Sources
- web.dev, Best practices for tags and tag managers, last updated August 24, 2022.
- web.dev, Efficiently load third-party JavaScript, last updated August 14, 2019.
- web.dev, Optimize Cumulative Layout Shift, last updated February 7, 2025.
- web.dev, Optimize long tasks, last updated December 19, 2024.