Skip to content

Enhancement: Improve performance by deprioritizing Stats script #43631

@westonruter

Description

@westonruter

Impacted plugin

Jetpack

What

Add fetchpriority=low to the Stats script and remove the dns-prefetch link

How

To attempt to reduce network contention with loading resources in the critical rendering path (e.g. the LCP element image), I suggest deprioritizing the Stats 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.

I created an extension plugin to demonstrate the changes: Jetpack Stats Script Deprioritization.

I published a full writeup as well: Improve LCP by Deprioritizing Script Modules from the Interactivity API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    [Feature] Stats DataFeature that enables users to track their site's traffic and gain insights on popular content.[Focus] Performance[Plugin] JetpackIssues about the Jetpack plugin. https://wordpress.org/plugins/jetpack/[Pri] Normal[Type] EnhancementChanges to an existing feature — removing, adding, or changing parts of it

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions