WP Manifestindependent plugin directory
manifest / performance / jetpack-stats-script-deprioritization

Jetpack Stats Script Deprioritization archived

Adds `fetchpriority=low` to the Jetpack Stats script to reduce network contention with the loading of resources in the critical rendering path. Also removes the `dns-prefetch`.

by Weston Ruter · github.com/westonruter/jetpack-stats-script-deprioritization

1stars
0forks

Install

No release zip yet. The repository archive installs, but the folder name will carry the branch suffix and updates will not flow:

wp plugin install https://github.com/westonruter/jetpack-stats-script-deprioritization/archive/refs/heads/main.zip

Declares an update source (false), so updates arrive through the plugin's own updater.

Readme

Jetpack Stats Script Deprioritization

Contributors: westonruter
Tested up to: 6.9
Stable tag: 0.1.0
License: GPLv2 or later
Tags: performance

Description

This plugin deprioritizes the loading of the Stats script in the Jetpack plugin to attempt to reduce network contention with loading resources in the critical rendering path (e.g. the LCP element image). It deprioritizes the script by:

  1. Adding fetchpriority="low" to the script tag.
  2. Removing the dns-prefetch for stats.wp.com.

This does not primarily benefit Chrome since that browser already gives async scripts a priority of low. It does benefit Safari and Firefox, however, since they have a default medium/normal priority.

For an example of the performance impact for this change, see the Site Kit GTag Script Deprioritization plugin.

I've proposed these changes for inclusion in Jetpack.

Installation

  1. Download the plugin ZIP from GitHub or if you have a local clone of the repo run npm run plugin-zip.
  2. Visit Plugins > Add New Plugin in the WordPress Admin.
  3. Click Upload Plugin.
  4. Select the jetpack-stats-script-deprioritization.zip file on your system from step 1 and click Install Now.
  5. Click the Activate Plugin button.

You may also install and update via Git Updater.

Changelog

0.1.0

  • Initial release.

Read the full README on GitHub →