Skip to content

Commit 0162d90

Browse files
committed
Add missing WP Consent API globals
1 parent c2a80b0 commit 0162d90

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

plugins/web-worker-offloading/third-party/google-site-kit.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,17 @@ function plwwo_google_site_kit_configure( $configuration ): array {
2424
$configuration = (array) $configuration;
2525

2626
$configuration['globalFns'][] = 'gtag'; // Because gtag() is defined in one script and called in another.
27+
$configuration['globalFns'][] = 'wp_has_consent'; // See <https://github.com/google/site-kit-wp/blob/abbb74ff21f98a8779fbab0eeb9a16279a122bc4/assets/js/consent-mode/consent-mode.js#L61C13-L61C27>.
2728
$configuration['forward'][] = 'dataLayer.push'; // See <https://partytown.builder.io/forwarding-event>.
2829

29-
// See <https://github.com/google/site-kit-wp/blob/abbb74ff21f98a8779fbab0eeb9a16279a122bc4/includes/Core/Consent_Mode/Consent_Mode.php#L244-L259>.
30+
// See <https://github.com/google/site-kit-wp/blob/abbb74ff21f98a8779fbab0eeb9a16279a122bc4/includes/Core/Consent_Mode/Consent_Mode.php#L244-L259>,
31+
// and <https://github.com/google/site-kit-wp/blob/abbb74ff21f98a8779fbab0eeb9a16279a122bc4/assets/js/consent-mode/consent-mode.js>.
3032
$configuration['mainWindowAccessors'][] = '_googlesitekitConsentCategoryMap';
3133
$configuration['mainWindowAccessors'][] = '_googlesitekitConsents';
34+
$configuration['mainWindowAccessors'][] = 'wp_consent_type';
35+
$configuration['mainWindowAccessors'][] = 'wp_fallback_consent_type';
36+
$configuration['mainWindowAccessors'][] = 'wp_has_consent';
37+
$configuration['mainWindowAccessors'][] = 'waitfor_consent_hook';
3238

3339
return $configuration;
3440
}

0 commit comments

Comments
 (0)