Part of the Core Web Vitals series. For the full picture, start with Core Web Vitals: what they are, how they affect SEO and how to improve them.
Chat widgets, analytics tags, ad networks, consent managers and video embeds are often added by different teams. Each may be useful. Together they can delay the first screen or make a button feel stuck. This guide is a tag-by-tag audit, not another definition of Core Web Vitals.
How do third-party scripts affect Core Web Vitals?
A third-party script is code supplied by another vendor, often loaded from another origin. Google’s third-party performance guide identifies extra network connections, parser-blocking scripts and main-thread work as common costs. Map each cost to the metric before changing code:
| Symptom | Likely mechanism | What to inspect |
|---|---|---|
| Slow hero or first screen | A synchronous tag, A/B test or embed delays rendering; requests compete for bandwidth | Network waterfall, render-blocking requests, LCP element |
| Slow tap or click | A tag’s long task occupies the main thread or its handler does heavy work | DevTools Performance trace around the interaction |
| Layout moves after load | A widget or ad slot inserts content without reserved space | Layout shifts and slot dimensions |
The metric may have another cause. LCP can be slow because of an oversized image or server response; INP can be slow because of your own event handler. Do not blame every red score on the tag manager.
How do you find the expensive tags?
- Start with affected page templates. Check real-user Core Web Vitals by URL or group, then test representative pages in PageSpeed Insights. A one-off Lighthouse run is a diagnostic, not the site’s field score; see the site-wide CWV audit.
- List vendors and owners. In Chrome DevTools Network, group requests by domain. Record what each script does, which team owns it, whether it appears on every page and whether another tag duplicates its function.
- Record a Performance trace. On a throttled mobile profile, load the page and perform the slow interaction. Inspect long main-thread tasks and their call stacks. Google’s guide to loading third-party JavaScript describes this workflow.
- Run a reversible comparison. Block a suspected vendor’s requests in DevTools, repeat several times, and compare load and interaction traces. This isolates a likely cause without deleting production tags. Note that blocked tags can also change page behaviour.
- Check the business event. If the tag handles purchases, consent, chat or analytics, confirm those still work in a staging or controlled rollout before making the change permanent.
A crawl can identify templates and high-traffic URLs to sample; it does not attribute a slow browser task to a particular vendor by itself. Use the browser trace for that attribution.
What should you change first?
Remove redundant code. Two chat widgets or several overlapping trackers add cost without much value. Google’s third-party guidance recommends regular audits and avoiding duplicate functions.
Change when optional code runs. Load a below-the-fold video or chat widget on demand, not before the primary content. For scripts that do not need to block parsing, async or defer can help. async executes when the download finishes; defer waits until HTML parsing completes. Google’s loading guide explains the tradeoff. Neither attribute makes expensive execution free, and a tag manager can inject other scripts later.
Reserve space for embeds. Give ad, video and chat containers stable dimensions so insertion does not cause CLS. Review long tasks (the Long Animation Frames guide shows how to attribute them to scripts), especially recurring timers and interaction handlers: web.dev’s input-delay guidance notes that third-party work can interfere with user input even after loading.
Avoid self-hosting a vendor script just to make a test look better. That can leave it outdated and create security or support problems. Use that approach only if the vendor permits it and someone will maintain updates.
How do you know the fix worked?
Compare the same template and device conditions in the lab, confirm key events, then watch field data as new visits accumulate. Record the tag version and deployment date so a later regression is traceable. A better Lighthouse score with a broken checkout is not a win; a faster trace with unchanged real-user INP needs more investigation.
Third-party script checklist
- Slow URL templates identified from field data
- Vendor domains, purpose and owner inventoried
- LCP and interaction traces inspected separately
- Duplicate or unused tags removed
- Optional scripts delayed without breaking functionality
- Embed space reserved and layout shifts checked
- Key events, consent and checkout verified after deployment
- Real-user metrics monitored after rollout
Frequently asked questions
Do third-party scripts affect Core Web Vitals?
They can. Synchronous scripts may delay rendering, and script execution can occupy the main thread during user interactions. The effect depends on what the script does and when it runs, so measure each page.
Will async or defer fix a poor INP score?
Not by itself. Both avoid blocking HTML parsing while the file downloads, but the JavaScript still executes. Long tasks can still delay a click, tap or key press.
Should I remove Google Analytics to improve page speed?
Not automatically. First measure its cost and business value, remove duplicate tags, and make sure it is loaded according to its current installation guidance. Removing essential measurement can create a worse decision problem than the speed gain.
How can I tell which tag is slow?
Use PageSpeed Insights for diagnostics and Chrome DevTools Performance and Network panels to attribute requests and main-thread tasks to a script or vendor. Re-test with a suspected request blocked, then validate in real-user data.