Reduce the impact of third-party code

Overview

Third-party code consists of analytics services, advertisements and other elements that are served from an external domain URL.

These resources are often responsible for poor web performance, as they may contain scripts that prevent other tasks from being performed.

They may also slow down your page for several other reasons including slow DNS lookups, server response errors, slow server response times, among others, which can impact your page performance.

How to reduce the impact of third-party code?

1) Reviewing your website’s third-party scripts

They help you identify and evaluate scripts and services that pop up on your webpage. We suggest only keeping third-party scripts and services that are actually adding value to your website and to remove all others.

2) Efficiently loading third-party JavaScript

Some of the suggestions include:

a) Deferring the loading and parsing of JavaScript

Defer the parsing or loading of third-party JavaScript to reduce the initial download size, allowing other resources to be downloaded as well.

b) Establishing early connections to required origins

Use preconnect and dns-prefetch to establish early connections to important third-party origins.

c) Lazy-loading third-party resources

Lazy-load embedded third-party resources, especially, ones that are not above-the-fold to speed up page load.

d) Optimize third-party hosting

There’s more than one way to optimize third-party hosting. Self-host third party scripts to reduce DNS lookup and round-trip times, improve http caching headers, and take advantages of HTTP/2 server push.

Reduce the impact of third party code with Staq

To optimize, go to Site Optimizer > JavaScript. Then turn on: Delay JavaScript execution.

Try Staq
Create/Migrate a WP site and get up to 90 days free in dev mode for each site.
square-for-kb3