Summary
For RB2B users who install their HTML snippet on a WordPress website running WP Rocket, the Delay JavaScript Execution feature can prevent the RB2B script from running when a visitor first lands on the site. Instead, the script is delayed until the user interacts with the page (scrolls, clicks, or taps).
This means RB2B cannot reliably identify visitors who simply land, read, and navigate away without interacting. Even worse, if a visitor clicks a link to a new page, the script may attempt to fire just as they leave, giving it no time to record the session. As a result, many visitors go unidentified, leading to incomplete or inaccurate tracking data.
To avoid this, RB2B should be excluded from WP Rocket’s control so the script always fires on page load without interference.
How Delay JavaScript Execution Works
According to WP Rocket’s documentation, this feature works by deferring all JavaScript (both inline and external) until user interaction occurs.
Key behaviors:
Triggers only on cached/optimized pages
Does not affect scripts dynamically injected after page load
Disables "Combine JS" when active, to preserve script order
Allows exclusions by script path, keyword, or
nowprocket
attribute
Because the RB2B script is typically third-party and non-essential, WP Rocket delays it by default—causing identification issues.
Why This Impairs RB2B's Identification Process
RB2B relies on early script execution to begin identifying a visitor. Here's what normally happens:
On page load, RB2B’s script fires immediately, sets a cookie/session ID, and logs the visit.
As the user navigates or engages, RB2B correlates those actions with the session.
Across pages, RB2B persists the identity using stored session data.
With Delay JS active:
The RB2B script doesn't run until a user scrolls, clicks, or interacts.
If a visitor reads the page and leaves without interacting, RB2B is never triggered.
Even if they click a link, the delayed script may execute too late—as the browser is already navigating away.
This breaks the tracking flow, leading to:
Missed pageviews
Incomplete or missing visitor profiles
Gaps in the visitor journey
Inaccurate analytics
Recommended Solution: Exclude RB2B Script from Delay
To ensure proper visitor identification, RB2B’s script must run immediately on page load. You can achieve this by explicitly excluding it from WP Rocket’s Delay JS setting.
Steps to Exclude RB2B from Delay JavaScript Execution
Identify the RB2B script
Find your RB2B HTML snippet that was added to the
<head>
of your website.
Use the
nowprocket
attribute for inline scriptsFor inline or embedded scripts, wrap them like this:
<script nowprocket> // RB2B init code </script>
Test using the
?nowprocket
URL parameterAppend
?nowprocket
to the page URL to temporarily bypass WP Rocket’s optimizations.Check that RB2B triggers on initial load.
Clear caches and verify
Clear your site and browser cache after changes.
Test in an incognito window to confirm RB2B loads before any user interaction.
Check RB2B’s dashboard for successful visitor tracking.
(Optional) Use Safe Mode or disable Delay JS entirely
If exclusions don’t work, enable Safe Mode, which excludes broad script groups.
As a last resort, disable Delay JavaScript Execution—especially if accurate visitor tracking is essential.