How to Track and Optimize Third-Party Domain Requests in WordPress (6 Ways)

Hey there, WordPress user! Is your site feeling a bit sluggish lately? The culprit might be too many requests to third-party domains.

Every time your WordPress site loads a resource from an external domain (like Google Fonts, YouTube videos, or AdSense ads), it creates an additional HTTP request that can slow down your page load time. In fact, nearly half of an average website‘s total requests are to third-party domains!

As a WordPress consultant, I‘ve seen firsthand how removing unnecessary third-party requests can dramatically speed up a site. I once had a client whose homepage was taking over 10 seconds to load. After using the techniques I‘ll show you below, we cut the number of external requests in half and got the load time down to a speedy 3 seconds flat.

So if you want to give your WordPress site a performance boost, follow along and I‘ll walk you through six ways to track down those pesky third-party domains and optimize their requests.

What Are Third-Party Domains and Why Are They Bad for Performance?

First, let‘s clarify what we mean by "third-party domains." These are any domains outside of your site‘s primary domain that are referenced in your site‘s code.

Some common examples include:

  • Google Fonts (fonts.googleapis.com)
  • Google Analytics (google-analytics.com)
  • YouTube video embeds (youtube.com)
  • Facebook like boxes and comment widgets (facebook.com)
  • External ad networks like Google AdSense (googleads.g.doubleclick.net)
  • Gravatar profile images (gravatar.com)
  • jQuery and other code libraries loaded from a public CDN (cdnjs.cloudflare.com)

Loading resources from these external domains requires an additional DNS lookup and HTTP request, which adds precious milliseconds to your page load time.

How much of an impact are we talking? According to HTTP Archive, the median site in 2021 had 25 third-party requests and a whopping 457 KB of third-party data weight! 😱

And if one of those third-party servers is slow to respond (or God forbid, goes down completely), it can bring your whole site to a screeching halt.

Now, some third-party resources are necessary for your site‘s functionality, like your Google Analytics tracking code. But many WordPress sites are weighed down by external scripts and stylesheets that aren‘t pulling their weight.

Case in point: I recently audited a site that had over 80 external requests, mostly from old plugins the site owner had forgotten about! After we cleaned house and got it down to a lean 20 requests, the site loaded a full 2 seconds faster.

So how can you tell which third-party domains your WordPress site is connecting to? Here are six ways to track them down.

1. Use Pingdom to Scan Your Site

Pingdom is a popular website performance monitoring tool. It has a free feature that lets you scan any webpage and see a waterfall breakdown of every resource it loads.

Here‘s how to use it to identify third-party requests on your WordPress site:

  1. Go to tools.pingdom.com
  2. Enter your WordPress site‘s URL in the input box
  3. Click "Start Test"

Pingdom will scan your page and generate a performance report. Scroll down to the "File Requests" section and you‘ll see a table of every resource loaded by the page, along with the domain it came from.

Pingdom file requests report showing third-party domains

See the ones that aren‘t your primary domain? Those are the third-party requests. Note the common culprits like googletagmanager.com, fonts.gstatic.com, and gravatar.com.

You may see some third-party domains you don‘t recognize. In that case, try Googling them to figure out what plugin or service they belong to. For example, a domain like 123counters.com is probably from a web counter widget you added years ago and forgot about. (Ditch it!)

2. Analyze Pages With GTmetrix

GTmetrix is another freemium performance testing tool for webpages. It gives you a similar breakdown of the resources loaded by your WordPress site, including third-party requests.

To use it:

  1. Enter your WordPress site URL on the GTmetrix homepage
  2. Click "Test your site"
  3. On the results page, go to the "Waterfall" tab

You‘ll see a chart of every resource loaded by the page, color-coded by domain. Mouse over the third-party domains to see more details on the number of requests and bytes.

GTmetrix waterfall chart with third-party requests highlighted

GTmetrix also assigns your site a "Page Load Time" score and a "Fully Loaded" metric, which indicates how long it takes to load every resource (including third-party ones).

Aim for a Page Load Time under 2 seconds and a Fully Loaded time under 5 seconds. If you‘re currently way above that, cutting back on third-party requests can help tremendously.

3. Use Chrome DevTools

If you‘re comfortable digging into your browser‘s developer tools, you can use the Network panel to see a live waterfall of the resources loaded by a page as you browse your WordPress site.

In Chrome:

  1. Load the page you want to check
  2. Right-click anywhere and choose "Inspect"
  3. Click the "Network" tab
  4. Make sure "Preserve log" is checked
  5. Refresh the page

You‘ll see a list of every resource fetched by the page, including the third-party ones. Look for lines that have a different domain than your site‘s primary domain.

Chrome DevTools Network tab showing third-party requests

Chrome DevTools is great for getting a real-time look at your site‘s requests as you interact with different pages and elements. You can also use the filter bar to search for specific string like ".js" to see just JavaScript resources.

4. Scan With Lighthouse

Lighthouse is a site auditing tool built into Chrome and available as a browser extension. It analyzes a page‘s performance, accessibility, SEO, and other metrics.

One of the data points Lighthouse reports is "Third-party usage", which tells you the percentage of your site‘s total resources and bytes that come from third-party domains.

Lighthouse report showing a high percentage of third-party usage

As you can see from the screenshot above, this site is in trouble – nearly 70% of its resource weight is from third parties! Time to put it on a third-party diet.

5. Use the Request Map Generator Plugin

Want to visualize all your WordPress site‘s external requests at a glance? Check out the free Request Map Generator plugin.

Once activated, go to Tools → Request Map Generator and click "Generate Request Map". The plugin will crawl your site and creates an interactive node map showing all the domains your site connects to.

Request Map Generator showing third-party domain nodes

You can mouse over the third-party domain nodes to see a list of the specific resources each one loads. Clever! The size of each node also indicates how many requests it accounts for.

6. Install Query Monitor

Query Monitor is a powerful WordPress debugging and performance profiling plugin. While primarily designed for developers, it can also give you insight into your site‘s third-party requests.

After installing the free Query Monitor plugin, look for the screen icon in the WordPress toolbar while viewing your site. Hover over it and click "Requests" to see a summary of the HTTP requests generated by the page.

Query Monitor showing a list of external HTTP requests

The Domains panel breaks down requests by first vs third-party and highlights the ones that may be slowing down your site. You can click on a domain to see the specific resources loaded from it.

For a cleaner view of just the third-party domains, use the Filter field to search for "3rd Party".

How to Optimize Third-Party Requests

Now that you‘ve identified the third-party domains your WordPress site is connecting to, what can you do to optimize those requests for better performance? Here are a few tips:

Audit and Remove Unnecessary Plugins

The lowest-hanging fruit is to simply get rid of plugins that are injecting third-party requests you don‘t actually need. Do you really need that Twitter feed widget loading tweets on every page? Or that old broken contact form plugin still enqueuing a StyleSheet from its creator‘s domain?

Be ruthless and remove (or at least deactivate) any non-essential plugins. Fewer plugins means fewer chances of external requests bogging down your site.

Use a JavaScript Optimization Plugin

Third-party scripts often add the most weight and complexity to a page. Plugins like Autoptimize or WP Rocket can help by minifying, combining, and deferring JavaScript files, including ones from external domains. This minimizes the performance hit.

Host Resources Locally

For static third-party assets like fonts or images, consider downloading them and hosting them directly on your WordPress server instead of pulling them from an external source each time.

For instance, if you‘re using Google Fonts, you can download the font files, upload them to your theme folder, and update your CSS to reference the local copies. This removes the need for that extra connection to Google‘s servers.

The Asset CleanUp plugin has a one-click option to download and host external resources locally. Its pro version can even auto-detect Google Fonts and generate the local CSS for you.

Use DNS Prefetch

DNS prefetching allows the browser to do the DNS lookup for a third-party domain ahead of time, speeding up the connection when the resource is actually needed.

For any mission-critical third-party domains your WordPress site relies on, you can add a DNS prefetch directive in your theme‘s <head>:

<link rel="dns-prefetch" href="//fonts.googleapis.com">
<link rel="dns-prefetch" href="//www.googletagmanager.com">

Use these sparingly though, as each prefetch does use a small amount of resources. Save them for domains that appear on most pages of your site.

Lazy Load Below-the-Fold Content

Lazy loading defers loading certain resources (usually below-the-fold images, videos, or widget content) until they‘re actually needed, i.e. when the visitor scrolls down to them.

This shifts the loading of some third-party scripts until later in the page load lifecycle, letting your main content load first. A good tradeoff for improving that critical initial page render!

Some lazy loading plugins to try:

Many popular caching and performance plugins like WP Rocket also include lazy loading options.

Wrapping Up

Well my WordPress friend, I hope this deep dive into third-party domains has been enlightening! You now have six solid techniques for tracking down those outside requests that may be slowing down your WordPress site.

Remember, when it comes to third-party resources: audit, optimize, and only keep the ones that are absolutely essential. Your visitors (and your PageSpeed scores) will thank you!

What are your favorite tools or tricks for keeping tabs on third-party domains in WordPress? Share them in the comments below!

Did you like this post?

Click on a star to rate it!

Average rating 0 / 5. Vote count: 0

No votes so far! Be the first to rate this post.