Blog / Technical SEO /

Third-party scripts: chat widgets, pixels and speed

The page is quick. Then the chat bubble pops in, the consent manager wakes up, and a handful of ad tags start fighting for attention. The page hasn’t changed much. The visitor is now waiting on tools the business added for support, measurement and promotion.

Third-party scripts are code loaded from another service rather than from your own site. They can be useful, but each one costs you: network requests, execution time, privacy questions, upkeep, and one more dependency that can change under you. The goal isn’t to strip them all out. It’s to know what each one does and whether it earns its place.

Make an inventory before optimising

When I audit a client site, I start in the browser’s developer tools or the tag manager and record each script’s source, purpose, owner, trigger and the pages where it runs. Include chat widgets, advertising pixels, analytics tags, review tools, embedded video, heatmaps, consent managers and A/B testing tools. Some scripts come from apps or plugins rather than a person adding code directly.

For every entry, ask who asked for it and what decision it supports. “Marketing uses this” isn’t an answer. Which campaign or report depends on it? What happens if it is absent for a visitor who has not consented? Is another tool already doing the same job? If nobody can answer, flag the script for review rather than deleting it immediately.

A tag manager makes changes easier to deploy, but it can hide complexity. The page source shows one container, and that container may load many other services. Review the tags inside the manager and inspect network requests in a browser session. Look at both the initial page load and what happens after interactions such as accepting consent or opening chat.

Measure the cost where it matters

Use a waterfall to see when each request starts, how long it takes and whether it blocks rendering or interaction. A script can load asynchronously and still consume CPU after it arrives. A chat widget may wait until the user opens it, while a consent tool may run early because it controls other tags.

Test representative page types. A product page may load review software and a payment tool, an article may embed video, and the homepage may carry a campaign widget. The same scripts don’t run everywhere. Test on a mobile connection or throttled environment as well as a fast office connection.

Core Web Vitals are LCP, INP and CLS. Third-party code can affect these metrics in different ways: an ad may delay the main content, a heavy script can make interactions less responsive, and a late widget can shift the layout. Field data can indicate a real-user problem, while lab tools help identify likely causes. One score does not identify which script should be removed.

Choose a response for each script

Possible actions include removing a genuinely unused tag, limiting it to relevant pages, delaying it until an interaction, loading it after consent, or replacing it with a lighter implementation. Each option has a trade-off. Delaying a support widget can improve initial loading but make help less visible. Restricting a pixel may affect campaign measurement. Removing a tag may break a workflow someone depends on.

Ask the service owner if a lighter integration or server-side option exists, but don’t assume it’s automatically faster or more private. Server-side tagging changes where data is processed. It doesn’t erase consent obligations or fix bad measurement.

If a script must remain, reduce what it does. Remove duplicate analytics tags. Avoid loading a full suite of marketing tools when only one feature is used. Check whether an embed can be replaced with a click-to-load preview. Use a static thumbnail linked to the video where appropriate, then load the third-party player only when the visitor chooses.

A consent banner is not a speed optimisation by itself. It controls certain scripts according to the site’s policy and user choice. Verify that tags behave as intended before and after consent, and test a fresh browser session. A cached consent decision can make testing misleading.

The cookie changes announced for Chrome in July 2024 do not make a script inventory unnecessary. Privacy expectations and other browser behaviour still matter, and tools may process personal data in ways beyond cookies. Review the service’s current documentation and your organisation’s obligations with the appropriate owner.

Avoid loading analytics or advertising tags before the site has obtained the required consent. Equally, avoid using a banner that blocks essential functions or misleads users about what a choice means. Consent implementation is a policy and technical responsibility, not a decorative overlay.

Test changes safely

Change one group of scripts at a time. Record a baseline, test the page and key workflows, then compare. Remove several tags at once and watch conversions stop recording, and you’ll struggle to find the cause. Keep a rollback path and notify the people who own the tool.

Check the browser console for errors and test forms, checkout, chat and campaign tracking. Compare the page from an accepted and declined consent state. Watch for layout shifts when widgets appear. If performance improves but a necessary business function fails, the change has not succeeded.

Pick one script that loads on every page and find its owner, purpose and measured cost. What would the site lose if it were delayed or removed?