1. Observed Wire Symptom
PageSpeed scores jump to 98, yet as soon as a real user moves their mouse or scrolls 30px, delayed scripts execute out of order—firing Meta/Google tags before consent default runs, or preventing CMP Accept clicks from waking GTM.
2. Technical Root Cause
WordPress optimization plugins (WP Rocket 'Delay JavaScript Execution', LiteSpeed JS Deferred/Delayed, NitroPack) rewrite <script> tags to type='rocketlazyloadscript'. If your CMP is excluded from delay (so the banner renders immediately) while your inline gtag('consent', 'default') or gtm.js is delayed—or vice versa—consent commands fire into an uninitialized void or race out of sequence on first scroll.
<!-- Broken: WP Rocket rewrote inline consent default to lazy-load on scroll
while gtm.js or CMP executes out of order! -->
<script type="rocketlazyloadscript">
gtag('consent', 'default', { ad_storage: 'denied', ... });
</script>
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js"></script># WP Rocket -> File Optimization -> Delay JavaScript Execution
# Add ALL of the following to "Excluded JavaScript Files":
dataLayer
gtag(
googletagmanager.com/gtm.js
cookielaw.org
optanon
cookiebot.com
cookieyes.com
complianz
cmplz3. Post-Publish Verification Checklist
- ✓View raw page source (Ctrl+U, not Inspect Element) in an incognito window and confirm gtag('consent', 'default', ...) is a plain <script>, NEVER type='rocketlazyloadscript'.
- ✓Exclude both the inline consent default block, your CMP SDK, and gtm.js from JS combine/minify/delay transforms.
- ✓Test Cold Load with a passive scroll + mousemove before clicking the banner, then test Reject All and Accept All.
4. Practitioner Edge-Case FAQ
- Why did synthetic Lighthouse tests miss a pre-consent leak on our WP Rocket site?
- Synthetic scanners that never emit a passive mousemove or scroll leave type='rocketlazyloadscript' tags dormant and falsely report '0 trackers'. Real human visitors scroll within 300ms, immediately triggering every delayed unconsented tag.
- Will excluding gtm.js from WP Rocket Delay JS ruin Core Web Vitals INP or LCP?
- Keep gtm.js asynchronous (its native snippet already sets j.async=true) and prune bloated legacy Custom HTML tags inside GTM instead of wrapping Consent Mode critical-path scripts in lazy-loader hacks that break attribution.
Did this GTM remediation playbook help resolve your issue?
1-click practitioner feedback — shapes which CMP & GTM edge cases we document next.
Verify If Your Container Suffers From CONSENT_DEFAULT_AFTER_GTM
Paste any storefront URL to inspect live Frankfurt gcs/gcd beacons and exact GTM Tag IDs.