How Do Third-Party Scripts Slow Down Your Site? Pixels, Chat and Tags

Short answer
How do third-party scripts slow down a website?
Third-party scripts are pieces of JavaScript that load on your site from another domain, such as ad pixels, live chat widgets and tag managers. They open extra connections, keep the browser's main thread busy and delay both rendering and the response to clicks and taps.
At Talha Aslan and team, we see the same pattern in speed audits again and again. The problem rarely sits in the site's own code. Instead, it builds up in external code that someone added years ago and then forgot. In this guide, we walk through measuring, deferring and cleaning up third-party scripts step by step. We also cover the most sensitive part: how to do all of this without breaking conversion tracking.
For general JavaScript tuning, see our guide on how JavaScript affects site speed. Here, we focus only on code that comes from outside your own domain.
Which code counts as third-party?
The rule is simple, because it depends only on origin. If the code comes from a server other than your own domain, it is third-party code. Take a store running on example.com as an example. The page loads an analytics tag, two ad pixels, a chat bubble, an embedded video and a review widget. Each of these is a separate external resource.
The typical groups look like this:
- Ad and conversion pixels from search and social ad platforms.
- Analytics and heatmap tools.
- Live chat, support and chatbot widgets.
- The tag manager container and every tag inside it.
- Embedded video, maps and social media feeds.
- A/B testing, personalization and cookie consent tools.
That said, not every external script is a problem. Some bring revenue, some feed measurement and some meet legal requirements. The real question is whether the value of each one covers its speed cost. So the first job is to make visible what loads and where it comes from.
Why do third-party scripts add network delay?
Every new domain means a new connection for the browser, so third-party scripts multiply connection work. First it resolves the name. Then it sets up a secure connection. After that, it requests the file. The web.dev guide on loading third-party JavaScript efficiently states plainly that sending requests to many different servers slows a page down.
On top of that, these scripts rarely travel alone. A single pixel often pulls in further requests, extra libraries and sometimes a second copy of a library your site already uses. In other words, a one-line install can turn into dozens of requests behind the scenes.
Another risk is a slow external server. If the code loads synchronously and the other side does not respond, the browser may hold back the rest of the page. In short, a server outside your control starts to decide how fast your page opens. Therefore, we set two goals on the network side: fewer domains, and loads that stay off the critical path.
What blocks the main thread?
The browser's main thread is a single lane. It paints the page, runs code and responds to clicks. If a script runs for a long time, that lane stays busy. Even if a user taps a button at that moment, the browser can only respond once the work finishes.
Third-party code hurts here in two ways. First, the browser has to parse and run it after the download. A large chat widget can use a lot of CPU time at this stage. In addition, many tags listen to click and scroll events on the page. As a result, their code runs next to yours on every interaction.
Chrome's Lighthouse documentation describes an audit called "Reduce the impact of third-party code." It flags pages where third-party code blocks the main thread for 250 milliseconds or more in total during load. Lighthouse versions move and rename audits over time. Still, the logic stays the same. So look at CPU time as well as file size.
How much do ad pixels affect speed?
One by one, ad pixels look small. However, a typical online store loads pixels from several platforms, and each one brings its own library. The same platform's pixel may also sit in the page code and in the tag manager at once. In that case, both speed and data quality suffer.
Example scenario: on example.com, someone pasted the Meta pixel into the theme file by hand. The same pixel also fires from the tag manager. As a result, the browser downloads the code twice and the platform counts each purchase twice. We cover this double counting problem in our guide to Meta pixel and Conversions API duplicate events.
Removing pixels is often not an option, because ad optimization depends on that data. Instead, the goal is to load each pixel from one place, as a single copy, at the right moment. Beyond that, pruning pixels from old campaigns is the quickest win on most sites. For example, the pixel of a campaign that ended a year ago can keep running for every visitor without anyone noticing.
Why are live chat widgets so heavy?
A live chat widget does more than show a bubble. It also brings the messaging interface, notification logic, sometimes fonts and extra libraries. web.dev's lazy loading guidance notes that most chat widgets download a significant amount of JavaScript. That load can hurt page loading and the response to user input.
Here is the interesting part, though. Only a small share of visitors ever open the chat. Yet the browser downloads the widget on every page view, for everyone. So everyone pays the cost while only a few people get the benefit.
That makes chat widgets the best candidates for deferral and the facade pattern. You do not need to switch the chat off. You only change when the real widget loads. For instance, the bubble stays on screen, but the real code arrives when the user hovers over it or clicks it. We explain this pattern step by step in its own section below. For the business side of chat and chatbot features, see our post on using AI on your website.
Why is the impact bigger on mobile devices?
A load you never notice on a desktop can turn into a clear delay on a mid-range phone. Phone processors run JavaScript more slowly, and mobile connections vary more. Because of this, web.dev's guide on spotting slow third-party code recommends testing with a mobile profile and CPU throttling.
Search Console also shows mobile and desktop data separately. For example, a template that looks "Good" on desktop can stay weak on mobile because of INP. In that situation, your first suspects should be the heavy external scripts that run on every page.
A practical tip: do not run your tests on your own fast laptop. Use a mobile profile with throttling turned on. If you can, open the page on a real mid-range phone. Then watch when the chat bubble, the cookie banner and the ad slots appear. If most of your users browse on mobile, base your decisions on the mobile result. In short, a clean desktop test does not replace the real mobile experience.
Who on the team should own which part?
Problems with external code are often organizational rather than technical. Marketing wants pixels. Meanwhile, support wants chat. Developers carry the blame for speed. Yet nobody sees the full picture. For that reason, we recommend clear roles from the start.
- Marketing decides which pixel each campaign needs and when it ends.
- Development owns the loading method, deferral and any facade work.
- The analytics owner checks that conversion events stay consistent before and after a change.
- The SEO owner follows Search Console data and lab tests.
This way, the decision to remove a script never rests on one person's guess. Also, every change has an owner, so a rollback stays easy. On a small team, one or two people may hold all of these roles. What matters is that the roles exist in writing and that every change goes into a log.
How does tag manager bloat build up?
A tag manager makes it easy to add tags without touching the code. Over time, that convenience turns into weight. Campaigns end, agencies change and tests finish, yet the tags stay in the container. Our guide to what Google Tag Manager is and how to use it covers the basic setup. Here, we look at the performance side.
web.dev's page on best practices for tags and tag managers shares an important observation. Its authors have seen a correlation between the size of tag managers and poorer INP scores. The same source also warns that several containers on one page can create significant performance issues.
Typical sources of bloat include:
- Unused tags, triggers and variables that nobody deleted.
- Tags that fire on every page but matter on only a few.
- Large libraries that arrive through custom HTML tags.
- More than one container running on the same page.
In short, the tag manager itself is not the problem. The problem is a messy container with no owner.
How do these scripts hurt Core Web Vitals?
Google's Core Web Vitals page sets these targets: LCP within the first 2.5 seconds, INP under 200 milliseconds and CLS under 0.1. We explain what each metric means in our guide to Core Web Vitals.
Third-party scripts affect each metric in a different way:
- LCP: external code on the critical path delays the main image or heading.
- INP: tags that keep the main thread busy slow down the response to taps.
- CLS: chat bubbles, ad slots and banners that appear late push the layout around.
On the other hand, Google recommends good Core Web Vitals for success in Search, but good scores alone do not guarantee rankings. We therefore treat speed work as an investment in user experience and conversions, not as a ranking promise. For the wider link between speed and search, read how site speed affects SEO.
How do you trace the problem in Search Console?
The Core Web Vitals report in Search Console relies on real user data, also called field data. According to the official Search Console Help page, the report groups similar pages. The status of each group follows its weakest metric. Groups show up as "Poor," "Need improvement" or "Good."
Specifically, with problems caused by external code, one sign is typical. All pages that share a template get worse together. For example, if the chat widget runs on every product page, the whole product page group may show an INP issue. In that case, you look at the template and at the external scripts it runs, not at single pages.
After the fix, you start validation on the issue details page with the "Start Tracking" button. Google then runs a monitoring period of about 28 days, because real user data takes time to collect. For a full tour of the tool, see our Google Search Console guide.
How do you measure third-party scripts one by one?
Reports tell you that a problem exists, so they are a starting point. They do not tell you which script causes it. For that, you need lab tests. We follow this order:
- Run a Lighthouse performance test on a mobile profile. Then check the sections that list third-party resources. Our Lighthouse performance test guide covers the details.
- Open the Network panel in Chrome DevTools. Right-click a suspect request and choose "Block request URL."
- Reload the page with network and CPU throttling. Then compare the result with the unblocked version.
- Repeat each test at least three times and use the median.
- Write the difference into a table: script name, domain and the metric that changed.
web.dev's guide on identifying slow third-party JavaScript recommends the same blocking method and the median of three or more runs. As a result, you decide based on a measured difference rather than a hunch like "the chat feels slow."
To see quickly which tools a site loads, you can also use our website technology checker.
How do you build a script inventory step by step?
Before you measure third-party scripts, you need a list. The inventory is the base of any cleanup. Without knowing why something is there, you cannot remove anything safely.
- Pick representative templates such as home, category, product, cart and thank-you pages.
- List the external domains on each template from the Network panel.
- Check how many times the same code appears in theme files, plugins and the tag manager.
- Assign an owner to each script: marketing, sales, support or development.
- Note the purpose of each script in one sentence. Which report does it feed, and which decision does it support?
- Ask when someone last used it. If nobody knows, the script goes on the candidate list.
Example scenario: on example.com, the inventory ends with fourteen external scripts. Four of them have no owner, and two belong to a campaign that ended long ago. This table is the raw material for the next step. Above all, the "no owner" column points to the fastest cleanup wins.
Which scripts should you remove, and which should you defer?
After the inventory, you choose one of four options for each script. web.dev's advice is clear: if a script does not add clear value to your site, remove it. For the rest, we use the table below as a decision aid.
| Script type | Typical impact | Suggested approach | Watch out for |
|---|---|---|---|
| Old unused pixel | Wasted requests and CPU | Remove it | Ask the owner first |
| Active ad pixel | Extra requests, event listeners | One copy, from the tag manager, with a fitting trigger | Test the conversion event |
| Live chat widget | Heavy JavaScript, INP and CLS | Load on interaction through a facade | The message badge may show late |
| Embedded video | Large iframe and player code | Preview image, load on click | Autoplay may behave inconsistently |
| Heatmap, session recording | Constant event listening | Only on needed pages, for a limited time | Privacy and consent settings |
| A/B testing tool | Can delay display | Only on test pages | Remove it when the test ends |
The table is a starting frame, not a strict rule. For example, on a B2B site, chat may be the main source of sales calls. In that case, you pick the deferral method with more care.
How do you choose between async and defer?
In practice, most third-party scripts play no role in painting the page. For this reason, the web.dev guide recommends async or defer for third-party scripts unless a script belongs to the critical rendering path.
Put simply, here is the difference:
- async: the code downloads in the background and runs as soon as it arrives. There is no order guarantee, so it suits independent tags.
- defer: the code downloads in the background but runs in order after the page finishes parsing. It is safer for scripts that depend on each other.
However, the same guide adds an important warning. Using async alone does not stop many tracking scripts from slowing page load. The code still downloads, and it still runs on the main thread. In other words, async reduces blocking but does not remove the cost.
So we see async and defer as a first step. The real gains come from firing code later, running it only where it matters and deleting what you do not need. If your theme or plugin does not offer these settings, make the change with your developer on a staging site.
How does the facade pattern work for chat and video?
A facade is a very light placeholder that looks like the real widget but has no function. Chrome's facade documentation describes the flow in three stages:
- On page load, the browser loads the light facade instead of the real widget.
- When the user hovers over the facade, it preconnects to the third-party servers.
- When the user clicks, the facade replaces itself with the real widget.
Example scenario: on example.com, a button with the same look takes the place of the chat bubble. The chat code does not download until the visitor clicks. Therefore, the majority who never open chat do not pay its cost.
That said, this has a price too. The same documentation notes that facades lack some features of the real widget. For instance, a new message badge may not show until the real code loads. Autoplay for lazily loaded video may also behave inconsistently. Note that the page also says newer Lighthouse versions removed the related audit. So the report may no longer suggest facades, but the method still works. Base the decision on your own blocking test rather than on a report warning.
How do you slim down your tag manager?
web.dev's tag guide draws a clear path for cleanup. In our audits, we follow this order:
- Pause or delete unused tags rather than blocking them with trigger exceptions. Then clean up their triggers and variables too.
- Fire non-essential tags after Window Loaded. The source notes that the earlier a tag fires, the greater its impact on performance.
- Narrow trigger conditions so each tag runs only on the pages that need it.
- Use a single container per page.
- Prefer templates over custom HTML tags where you can.
- Give every tag an owner and a short description.
Also limit access. web.dev reminds readers that anyone with access to the tag manager can add JavaScript to the site. So remove old agency accounts, former staff and unused users on a regular basis. That helps both security and speed.
These steps look small. Even so, in a crowded container the result can be clear. Still, test every change in preview and debug mode before you publish it.
How do you clean up without breaking conversion tracking?
The biggest risk in speed work is losing sales and lead data. If you defer a pixel to the wrong moment or tie it to the wrong trigger, the ad platform stops seeing conversions. That is why we always run the cleanup together with a tracking plan.
- First, write down which events matter to the business: purchase, form submit, search or phone click.
- Record in the inventory which script and which trigger send each event.
- Note the event counts for the last two weeks before any change.
- Test the change in preview mode and confirm that the events still arrive.
- After launch, compare event counts with the earlier period for several days.
One key rule: before you move conversion tags to late triggers such as Window Loaded, make sure the user is still on the page at that point. Otherwise, you may lose conversions from users who leave quickly.
Cookie consent also belongs in this picture. We explain which tags must wait for consent in our post on whether Google Consent Mode v2 is mandatory. Speed cleanup must not break those settings.
Do preconnect and self-hosting help?
Still, some external scripts are truly necessary and need to load early. In that case, a shorter connection time makes sense. The web.dev guide offers two hints. Use dns-prefetch to resolve the domain name early. Use preconnect to set up the secure connection ahead of time.
However, adding these hints to every external domain can backfire. The browser then spends effort on connections it may never use. We suggest them only for one or two external domains that the page truly needs in its first seconds.
Self-hosting is another option. The same source says that if the third-party server is slow, you can consider hosting the script yourself. On the other hand, the code then stops updating on its own, so you must track updates yourself. Also, some platforms expect their code to load only from their own servers. In short, this method suits teams that can take on the maintenance work.
Example scenario: how does a cleanup round on example.com go?
The flow below is not a real client case, so treat it as a model. It is an example scenario we built to make the method concrete.
Say example.com is a home textile store. In Search Console, the product page group sits at "Need improvement" because of INP. The team builds the inventory and finds this picture. Two ad pixels live in both the theme and the tag manager. A heatmap tool runs on every page. The chat widget loads everywhere, and an old A/B test script is still active.
Next, the team takes these steps:
- It removes the duplicate pixel code from the theme and keeps only the tag manager version.
- Then it deletes the code of the finished A/B test.
- It limits the heatmap to two campaign pages.
- After that, it moves the chat widget to a facade.
- Finally, it tests the purchase and add-to-cart events in preview mode.
Then the team repeats the lab tests and starts validation in Search Console. Nobody can know the result in advance, since field data comes from real users and takes time. But because the process is measurable and reversible, the risk stays low.
How do you set up lasting governance for third-party scripts?
A one-off cleanup fades within a few months, because new campaigns bring new code. So the real goal is a governance routine. These are the simple rules we suggest:
- Before anyone adds external code, write down its purpose, owner and end date.
- Review the inventory again every quarter.
- Keep tag manager access for active team members only.
- Run a quick speed test after each new script goes live.
- Check the Core Web Vitals report in Search Console once a month.
If setting this up on your own feels like too much, we solve this problem on your site and keep tracking it. Within our SEO consulting service, we build the inventory, run the cleanup while protecting your tracking plan and report the results. We do not promise rankings. What we do is make the causes of a slow site visible and manageable.
Where should you start?
Third-party scripts are part of every modern site. Removing them all is neither possible nor needed. What matters is knowing why each one is there and measuring its cost.
Three steps are enough to begin. Build the inventory, measure the heaviest scripts with request blocking and prune the ones with no owner. After that, defer heavy widgets such as chat and video, slim down the tag manager and test conversion events at every step.
If you would like our team to run this work for you, request a quote with your site address on our SEO consulting page. We review your current scripts and prepare a cleanup and tracking plan that fits your site.
Core guide: What Is Digital Marketing? Its types, examples and how it is done, on one page with an interactive film that travels through the brain.



