Skip to content

1.5.9 — WP Rocket consent fix (GTM/GA4 outage)

Choose a tag to compare

@redolivedev redolivedev released this 22 Aug 02:39
· 2 commits to main since this release

Critical fix for sites running WP Rocket (or LiteSpeed / Cloudflare Rocket Loader).

On WP Rocket-cached pages, "Delay JavaScript execution" rewrote the scripts inside the plugin's gated templates and deferred the Consent Mode head block, with two consequences: gated GTM/Meta/GA4 scripts never executed after the visitor accepted (Tag Assistant: "No Google tags found"), and returning visitors' Google hits were sent with consent denied (gcs=G100), so GA4 reported almost no data.

Fixes

  • Script activation now undoes optimizer rewrites (promotes data-rocket-src/data-src to src, resets non-JS type) before injecting gated scripts.
  • The Consent Mode update is always pushed as a real arguments object — Google ignores plain-array dataLayer pushes.
  • The Consent Mode head block, banner.js, and the WhatConverts loader are marked nowprocket data-no-optimize data-cfasync so page optimizers never defer them.

After updating: purge the site's page cache (WP Rocket + any server cache such as Varnish) so cached HTML regenerates, then verify in a private window on the bare URL: accept cookies and confirm /g/collect requests carry gcs=G111.

QA-trap reminder: WP Rocket serves no cache to logged-in users and query-string URLs bypass it — always test logged-out on the bare URL.