Integrate Web Worker Offloading with Rank Math SEO #1685
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
Previously #1563 to integrate Web Worker Offloading with WooCommerce.
This integrates Rank Math SEO's Google Analytics integration with Partytown to offload
gtag()
to a worker. Inline scripts now no longer block a registered script from being offloaded to a worker; any associated inline scripts are also offloaded to a worker.This is part of #1455.
Diff of Prettier-formatted page with plugin active
Looking at the network logs:
Without plugin active:
With plugin active:
Relevant technical choices
The integration is not targeting the
\RankMath\Analytics\GTag::enqueue_gtag_js()
code which is only used for WP<5.7. In WP 5.7, thewp_script_attributes
andwp_inline_script_attributes
filters were introduced, and Rank Math then deemed it preferable to usewp_print_script_tag()
andwp_print_inline_script_tag()
rather thanwp_enqueue_script()
andwp_add_inline_script()
, respectively. Since Web Worker Offloading requires WP 6.5+, there is no point to integrate with the pre-5.7 code in Rank Math.