Automattic / Automattic/jetpack

Feature Request: Delay JavaScript execution

Open
#32,368 1 comment 1 reaction 0 assignees View on GitHub
[Plugin] Boost New Feature
Dominant language
PHP
Stars
1.8k
Forks
898
Avg merge
1d 18h
Merged PRs (30d)
774

Description

### Impacted plugin

Boost

### What

The ability to delay loading JavaScript files until user interaction

### How

Jetpack Boost doesn't have a feature to delay JavaScript loading until the first user interaction. Similar features exist in plugins like [FlyingPress](https://docs.flyingpress.com/en/article/delay-javascript-y9gvfg/), [WP-Rocket](https://docs.wp-rocket.me/article/1349-delay-javascript-execution), and the stand-alone plugin [Flying Scripts](https://wordpress.org/plugins/flying-scripts/).

When running a Google PageSpeed test, sometimes they would also recommend using one of those plugins for opportunities like `Reduce unused JavaScript` and `Reduce the impact of third-party code` (I tried to replicate that but I couldn't right now, but I distinctly remember seeing them advertising WP Rocket for this feature a few months ago).

This feature would be incredibly valuable to reduce the performance impact of 3rd party code like Google Analytics and the Meta Pixel.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Start by locating Jetpack Boost's JavaScript-loading entry points and reviewing how third-party scripts are handled; done means eligible JavaScript waits until the first user interaction without breaking site behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, php, wordpress
Domain
performance, web-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.