Integrate Web Worker Offloading with Google Site Kit#1686
Integrate Web Worker Offloading with Google Site Kit#1686westonruter merged 10 commits intotrunkfrom
Conversation
| plwwo_mark_scripts_for_offloading( | ||
| array( | ||
| 'google_gtagjs', | ||
| 'googlesitekit-consent-mode', |
There was a problem hiding this comment.
I don't know how the Consent Mode is supposed to work, especially as it relates to the WP Consent API plugin. On my test site I didn't get any consent banner even without WWO active, so I don't know what to look for to see if it is working as expected.
There was a problem hiding this comment.
you may need to have this plugin installed? https://wordpress.org/plugins/wp-consent-api/
|
@joemcgill @aaemnnosttv If someone from the Site Kit team could test that this is working as expected with a pre-release version of Site Kit, that would be very helpful. |
|
Build for testing: web-worker-offloading.zip |
|
The following accounts have interacted with this PR and/or linked issues. I will continue to update these lists as activity occurs. You can also manually ask me to refresh this list by adding the If you're merging code through a pull request on GitHub, copy and paste the following into the bottom of the merge commit message. To understand the WordPress project's expectations around crediting contributors, please review the Contributor Attribution page in the Core Handbook. |
|
Updated build for testing which includes additional compatibility with the WP Consent API: web-worker-offloading.zip |
adamsilverstein
left a comment
There was a problem hiding this comment.
Looks good, left some small feedback.
|
@westonruter I gave this a few tests using the latest test build (#1686 (comment)) as well and it seemed to work as expected. However, on closer inspection, it seems there may be an issue with inline scripts as the inline script that accompanies the Google tag doesn't seem to be running (e.g.
|
Co-authored-by: Adam Silverstein <[email protected]>
|
@aaemnnosttv Is this anywhere I can test? |
|
Another build for testing: web-worker-offloading.zip |
|
|
||
| // Expose on the main tread. See <https://partytown.builder.io/forwarding-event>. | ||
| $configuration['forward'][] = 'dataLayer.push'; | ||
| $configuration['forward'][] = 'gtag'; |
There was a problem hiding this comment.
The addition here means that scripts in the main thread will now be able to call gtag() whereas previously it was only available to other scripts offloaded to a worker.
|
|
||
| // Expose on the main tread. See <https://partytown.builder.io/forwarding-event>. | ||
| $configuration['forward'][] = 'dataLayer.push'; | ||
| $configuration['forward'][] = 'gtag'; |
There was a problem hiding this comment.
The addition of this line here means that scripts in the main thread will now be able to call gtag() whereas previously it was only available to other scripts offloaded to a worker.
|
With the recent updates here and my understanding of the expectations, this seems to be working as expected 👍 |

Fixes #1455
Depends on:
wp_print_inline_script_tag()google/site-kit-wp#9726Diff in page source when activating