WP Rocket Delayed JavaScript Blocking Google Tag Manager
Overview
WP Rocket's "delayed JavaScript" feature is a common WordPress performance optimization that defers script execution until user interaction. However, when Google Tag Manager (GTM) is loaded via a delayed script, it prevents GTM from firing on page load — silently breaking all dependent tracking, including form submission conversions and Google Ads conversion events.
This issue is insidious because the site appears to function normally, GTM may show as "installed," and no errors surface in the browser console under typical browsing. The failure only becomes apparent when auditing conversion data and finding zero recorded events despite confirmed form submissions.
How the Problem Occurs
- WP Rocket's delayed JavaScript setting is enabled (a common default for performance scores).
- GTM's script tag is not explicitly excluded from the delay.
- GTM loads only after a user interaction trigger (scroll, click, keypress), rather than on page load.
- Any GTM triggers configured to fire on page load or DOM ready never execute.
- Form submission events, which depend on GTM being initialized, are never captured.
- Google Ads and Google Analytics receive no conversion signals.
Symptoms
- Zero form submission conversions recorded in Google Ads or Analytics despite confirmed lead activity.
- GTM appears installed (tag present in page source) but events do not fire.
- Conversion tracking gaps that don't correlate with traffic drops.
- Smart Bidding strategies underperform or behave erratically due to missing conversion signals.
Resolution
Option 1: Exclude GTM from Delayed JavaScript (Recommended)
In WP Rocket settings, navigate to File Optimization → Delay JavaScript Execution and add GTM to the exclusion list:
googletagmanager.com
gtm.js
This allows GTM to load normally while still deferring other scripts.
Option 2: Disable Delayed JavaScript Entirely
If exclusion configuration is unavailable or unreliable, disabling the delayed JavaScript feature entirely eliminates the risk. The performance trade-off is typically minor compared to the cost of broken conversion tracking.
Verification Steps
After applying the fix:
- Use Google Tag Assistant or GTM's Preview mode to confirm tags fire on page load.
- Submit a test form and verify the conversion event appears in GA4 DebugView and Google Ads conversion tracking.
- Check that GTM's
dataLayeris populated before form interaction events. - Monitor Google Ads conversion counts over the following 24–48 hours for recovery.
Downstream Impact on Campaigns
Missing conversion data has compounding effects on paid search performance:
- Smart Bidding degrades — Maximize Conversions and Target CPA strategies require conversion signals to optimize bids. With zero data, Google falls back to broad traffic patterns.
- Conversion action audits are misleading — Accounts may appear to have many primary conversion actions but record nothing, masking the root cause.
- Budget is wasted — Spend continues while the account learns nothing, inflating effective CPA.
In the AHS account, this issue resulted in zero form submissions recorded over a 30-day period despite active campaigns. The DSA and display campaigns continued consuming budget with no measurable return. See [1] for account context.
Related Issues Found in the Same Audit
When this WP Rocket issue was discovered during an automated audit of the AHS account, several compounding problems were also present:
- 8 of 9 conversion actions were marked as primary, diluting Smart Bidding signals even further.
- A DSA asbestos campaign was matching irrelevant search terms (e.g., "mold killer," "water restoration").
- A display campaign was consuming 38% of total budget.
Fixing the WP Rocket setting alone restores data collection, but the conversion action configuration should also be corrected to give Smart Bidding a clean, focused signal.
Detection via Automated Audit
This issue was identified during a live demo of an agentic AI audit tool ([2]) that cross-references Google Tag Manager installation, GTM firing behavior, and conversion data gaps. The tool logged into the AHS WordPress admin, identified the WP Rocket setting, and corrected it autonomously — a task that would typically require manual investigation across multiple platforms.
Prevention
- Add GTM exclusion to WP Rocket configuration at the time of initial setup, before any campaigns go live.
- Include a GTM firing check in any new client onboarding checklist.
- When conversion data drops unexpectedly, check WP Rocket (and similar caching/optimization plugins: LiteSpeed Cache, W3 Total Cache) before investigating GTM or Google Ads configuration.
References
- Source meeting: [3]
- Related client: [1]
- Related concept: [2]
- Related issue: [4]