Review third-party scripts by the function they provide, the work they add and the people responsible for them. Keep justified tools, remove genuinely unused dependencies and test proportionate loading changes. Deleting every external script may improve a laboratory score while breaking chat, measurement or a form that the business relies on.
The useful question is not whether third-party JavaScript is good or bad. It is whether each dependency earns its place on the pages where it runs, and whether it can deliver the same business function with less disruption. A script inventory and a controlled experiment are the starting point.
Inventory Scripts by Purpose and Owner
Inspect the resources that load during real page visits. Include scripts inserted directly in templates, through plugins, via a tag manager and by other scripts. A source-code search alone may not reveal a dependency that appears only after consent or an interaction.
For each tool, record its purpose, loading source, relevant pages, business owner and technical maintainer. Identify which account controls the configuration and who can publish changes. A tool with no owner should be investigated, not automatically deleted without checking its role.
Follow Indirect Dependencies
A tag manager can load analytics, marketing and experimentation tools, each of which may request more resources. An embedded video or chat widget may also bring images, fonts or additional code. Record the chain so a change to the visible loader does not conceal the actual work.
Look for duplicate installations. The same measurement tool might be added through both a CMS plugin and a tag manager. Confirm whether it is truly duplicated and what events it sends before removing one route. Similar-looking requests can also serve different legitimate purposes.
| Register field | What to record |
|---|---|
| Business purpose | The user or operational function the script supports |
| Owner | Person responsible for retaining or changing that function |
| Loading source | Template, plugin, tag manager or another dependency |
| Page scope | Routes where the function is actually needed |
| Trigger | Initial visit, permission state or relevant interaction |
| Acceptance test | Evidence that the function still works after a change |
| Review date | When continuing need and configuration will be checked |
This register should describe the current website, not a list of tools someone remembers installing. Verify it in the browser and update it when campaigns or integrations change.
Measure Network and Execution Work Separately
Use the browser's network and performance evidence to identify download and execution costs. A small file may perform substantial work, while a larger resource may load without blocking an important interaction. Do not judge impact from file size alone.
web.dev's third-party JavaScript guide explains how external resources can add requests and main-thread work. Use a controlled comparison to establish their contribution on your own page. A general warning about a category of scripts is not proof that a particular tool is your main bottleneck.
Test the Journey, Not Only Initial Page Load
Review a first visit, a repeat visit and the interaction that opens the tool. A delayed chat widget may make the initial page lighter but become slow when someone needs help. A video facade may be appropriate if the transition to playback is understandable and accessible.
Include mobile conditions and relevant consent states. Record what was enabled in each test so the results are comparable. Do not compare a fully loaded baseline with a version where required functions were silently absent and call the difference a complete optimisation.
Choose the Smallest Change That Preserves the Purpose
Start with genuinely unused or obsolete code after the owner confirms it is no longer needed. Then consider limiting a tool to relevant routes or loading it at a more appropriate moment. A booking widget needed on one page may not need to initialise across the whole site.
Review supported loading options in the provider's current documentation. Some tools have dependencies or timing assumptions that must be preserved. Applying the same delay setting to every script can produce race conditions or missing events that are difficult to notice visually.
Distinguish Deferral from Elimination
Moving work later changes when the cost occurs; it does not necessarily remove the cost. Check whether several deferred tools all start at the first user interaction and make that action unresponsive. A better initial score is not enough if the first click becomes unreliable.
Avoid hiding important functionality behind an unexplained empty space. If a tool loads on request, provide a clear accessible action and an appropriate loading or failure state. The surrounding page should remain useful if the provider is temporarily unavailable.
Keep Privacy Decisions Separate from Speed Decisions
Consent and data-handling requirements need their own approved policy and appropriate review. Do not bypass a consent tool to gain speed, or classify a script as necessary solely because the business wants its data. Performance work must respect the existing privacy boundary.
Test relevant permission changes and ensure the tool behaves according to the approved implementation. Record what is and is not verified. This article concerns script performance and operational governance, not a determination that a particular setup satisfies every legal requirement.
Check What a Loading Change Does to Measurement
Delaying an analytics tool can change which visits or events it records. An event triggered before the tool is ready may need a supported queue or a different implementation. Do not assume the same dashboard numbers mean the same thing after timing changes.
Have the measurement owner validate page views, relevant interactions and conversion events through an approved test mode. Check for duplicates as well as missing events. Document intentional changes so later reports do not mistake a measurement change for a change in customer behaviour.
Give Each Experiment Technical and Business Pass Criteria
State the hypothesis and exact change. For example, an illustrative experiment might restrict a support widget to pages where it is required, while preserving an existing contact route elsewhere. The business owner must approve the functional boundary before deployment.
Measure the affected pages under equivalent conditions and test the supported help journey. If visitors can no longer reach assistance where the business requires it, the experiment has not passed even if the page loads faster. Keep the decision linked to both types of evidence.
| Experiment area | Technical pass condition | Business pass condition |
|---|---|---|
| Chat loading | No unnecessary initial work on excluded routes | Required support access remains available |
| Analytics timing | No duplicate or broken initialisation | Approved events retain their defined meaning |
| Video embed | Stable layout and reliable requested playback | Content remains understandable before playback |
| Campaign tag removal | Retired dependency no longer loads | Owner confirms no active campaign relies on it |
| Form-related script | Validation and submission remain reliable | Enquiries still reach the intended destination |
These are planning examples, not reported outcomes from a completed test. Adapt the criteria to the actual tool and workflow before making a change.
Retest Accessibility and Failure Behaviour
Open and close widgets with a keyboard. Check focus movement, visible controls and whether the user can return to the page. Review mobile overlays so a chat launcher or consent interface does not cover essential content or another action.
Test a controlled provider failure in an authorised environment. The website should not leave a permanent loading layer over the page or make unrelated navigation unusable. Give users a sensible alternative where the function is important, such as an existing contact route when chat is unavailable.
Verify the Full Lead or Transaction Path
A form can appear intact while a removed script previously supplied validation, spam protection or delivery. Follow a synthetic submission through its intended destination. If the site uses a CRM, the website-to-CRM guide explains why a visible success message is not enough evidence.
Where checkout or payments are involved, use authorised test methods and preserve provider requirements. Do not remove a security or payment dependency because it appears costly in a trace without understanding the consequences. Escalate genuine conflicts to the responsible owner.
Control Tag Changes After the Initial Audit
Assign a review and approval route for adding scripts. A request should identify purpose, page scope, data use, expected duration and verification. Temporary campaign tools should have an owner and an end condition so they do not remain indefinitely after the campaign finishes.
Keep deployment access proportionate. A tag-manager change can affect production behaviour without a code release, so it still deserves a change record and testing. Record the published version and rollback route alongside the website's other dependencies.
Prevent Silent Reintroduction
After removing or replacing a tool, identify every installation source and confirm the final browser state. A plugin or copied template can reintroduce an old tag later. Include a lightweight inventory comparison in relevant release checks to catch unexpected additions.
Monitor changes in resource and execution patterns over time. External providers can change their delivered code even when your repository has not changed. A recurring review should investigate material differences without treating every small variation as a new incident.
Report the Outcome Without Trading Away Functionality
Summarise which dependencies were retained, scoped, deferred or removed and why. Include performance evidence, business tests and unresolved limitations. If only a local laboratory comparison was performed, do not claim measured improvement for all real visitors.
Relate the results to the broader Core Web Vitals priorities. Third-party work may be one contributor among several; images, server response and application rendering can still require separate investigation.
For performance optimisation work, bring the script register and experiment results. They make it possible to reduce unnecessary work while preserving the tools that support customers, operations and trustworthy measurement.
Frequently Asked Questions
Should all third-party scripts be removed?
No. Retain functions with a justified purpose and review their cost, scope and loading behaviour. Remove unused code only after confirming ownership and dependencies. The objective is a faster working website, not a high score achieved by disabling required tools.
Does a tag manager eliminate performance cost?
No. It organises deployment, but the scripts it loads still download and execute. Inspect the actual resources and triggers, including indirect dependencies. A clean template file does not prove that the browser receives little third-party work.
Can delayed loading change analytics results?
Yes, depending on how events and initialisation are implemented. Test supported queuing and event behaviour, and record intentional measurement changes. Do not compare reports as if their collection method stayed identical when the loading strategy changed.
Who should approve removing a marketing tag?
The accountable marketing or measurement owner should confirm its business status, and the technical owner should assess dependencies and verification. A developer should not remove a live campaign tool solely from a performance warning without that context.
Is a consent tool only a performance feature?
No. It supports a separate data-handling and permission policy that needs appropriate review. Performance changes must preserve the approved behaviour. Do not bypass consent or make legal compliance claims based only on a loading test.
How do we prevent old scripts returning?
Maintain a current owner register, control publishing access and compare the loaded resources after relevant releases. Track all installation sources, including plugins and tag managers. Temporary tools should have review dates and explicit retirement conditions.


