# Too much third-party code

Source: https://www.fixreports.com/issues/third-party-scripts

Chat widgets, analytics, ads, review apps and tag managers load code from other domains. Together they often make up a large share of a page’s weight and blocking time.

## What it means
We flag pages where code and files from other domains exceed 500 KB per page on average, or more than 30% of all downloaded bytes.

## Why it matters
Third-party scripts compete with your own content for bandwidth and the main thread, and you don’t control how heavy they are or when they change.

They are also a privacy and security consideration: each one runs with access to the page.

## How to find it yourself
- PageSpeed Insights lists third-party code and its impact.
- In DevTools, group the Network panel by domain to see what each service loads.

## How to fix it on any website
1. List every third-party service and remove those nobody uses.
2. Load the rest after the page is usable: defer, async, or load on interaction (for example, a chat widget after the first click).
3. Use a facade for heavy embeds such as video players and maps: a static preview that loads the real embed on click.

## On Shopify
1. Review installed apps and app embeds; uninstalling an app doesn’t always remove its theme code.

## On WordPress and WooCommerce
1. Check plugins that add tracking, chat or social widgets, and load them only on the pages that need them.

## How to check the fix
- Run the speed test again and compare the share of bytes from other domains.

## How FixReports finds it
The speed test groups every download by domain and reports the share and size of bytes from domains other than yours.

## Frequently asked questions

### Is Google Analytics a problem?

One analytics tag is usually small. Problems start when several trackers, tag managers and widgets add up.

## Sources
- web.dev: Efficiently load third-party JavaScript: https://web.dev/articles/efficiently-load-third-party-javascript
