Skip to main content
Agency Program Get 2× more leads and save 50% on hosting. Built for agencies ready to grow. Book a call
Web Worker Offloading icon

Web Worker Offloading

v0.2.0
by WordPress Performance Team · 2.0 (1 reviews)

Offloads select JavaScript execution to a Web Worker to reduce work on the main thread and improve the Interaction to Next Paint (INP) metric.

10K+ active installs Updated Dec 18, 2024 Tested to 6.7.2 Requires PHP 7.2
Try Demo Download
Pre-installed Ready in ~10s No card
Web Worker Offloading

About Web Worker Offloading

This plugin improves performance by offloading JavaScript execution to a Web Worker, which can result in better Interaction to Next Paint (INP) scores. It is currently experimental but can be activated for specific scripts by adding the 'worker' script data to the registered script. The plugin also includes built-in integrations to offload Google Analytics for certain plugins, but it's important to monitor analytics and INP scores after activation.

Frequently asked questions

What does this plugin do?
This plugin offloads JavaScript execution to a Web Worker, improving performance by freeing up the main thread. This should translate into improved Interaction to Next Paint (INP) scores. This functionality is experimental.
How do I offload a script to a web worker?
To opt in a script to be loaded in a worker, simply add worker script data to a registered script. For example, if you have a script registered with the handle of foo, opt-in to offload it to a web worker by doing: wp_script_add_data( 'foo', 'worker', true );
What are the benefits of offloading scripts to a web worker?
Unlike with script loading strategies like async/defer, any inline before/after scripts associated with the worker-offloaded registered script will also be offloaded to the worker. This helps prevent inline scripts from blocking the main thread.
Which plugins have built-in integrations for Google Analytics offloading?
The plugin currently ships with built-in integrations to offload Google Analytics to a web worker for Rank Math SEO, Site Kit by Google, and WooCommerce.
Can the Partytown configuration be modified?
Yes, the Partytown configuration can be modified via the plwwo_configuration filter. Not all configuration options can be serialized to JSON in this way; some, like resolveUrl, require an inline script.

Changelog

0.2.0

Enhancements

  • Integrate Web Worker Offloading with Google Site Kit. (1686)
  • Integrate Web Worker Offloading with Rank Math SEO. (1685)
  • Serve unminified scripts when SCRIPT_DEBUG is enabled. (1643)

Bug Fixes

  • Fix tracking events like add_to_cart in WooCommerce integration. (1740)

0.1.1

Enhancements

  • Add Web Worker Offloading meta generator. (1598)

0.1.0

  • Initial release.

Try other plugins

Yoast SEO icon

Yoast SEO

4.8 · 10M+ installs

Improve your WordPress SEO: Write better content and have a fully optimized WordPress site using the Yoast SEO…