Fix WP Rocket conflicts with the e-ZeeInternet tracker
WP Rocket's Combine JS, Minify JS, Delay JavaScript and LazyLoad features can break the tracker by self-hosting a copy of t.js on your domain (which has no /api/public/* endpoints) or by deferring it until user interaction. Follow these steps to exclude the tracker from each feature.
The validator shows 404 for /api/public/collect or /api/public/stats, the script src points to /wp-content/cache/... on your own domain, or no events arrive in your dashboard.
Add data-endpoint="https://e-zeeinternet.lovable.app" to your script tag. The cached copy of t.js will then send events to the correct host even when WP Rocket self-hosts it.
<script async src="https://e-zeeinternet.lovable.app/t.js" data-site="ezi_xxxxxxxxxxxx" data-endpoint="https://e-zeeinternet.lovable.app" data-mode="gdpr"></script>
1. Exclude from File Optimization → JavaScript
WP Rocket → Settings → File Optimization → JavaScript Files
Combine and Minify JS will copy t.js into a bundled file on your own domain. The cached copy still works if data-endpoint is set, but excluding it is cleaner.
- 1Open File OptimizationWP Admin → Settings → WP Rocket → File Optimization tab.
- 2Add to “Excluded JavaScript Files”Scroll to Excluded JavaScript Files and add one entry per line:
/t.js e-zeeinternet.lovable.app/t.js (?:.*)e-zeeinternet(?:.*)
- 3Save and clear cacheClick Save Changes, then WP Rocket → Clear and Preload Cache.
2. Exclude from Delay JavaScript Execution
WP Rocket → File Optimization → Delay JavaScript execution
Delay JS waits for user interaction (scroll, click, keypress) before loading the script. This skips pageviews from bouncing visitors.
- 1Find “Delay JavaScript execution”Same File Optimization tab, scroll to the Delay JavaScript execution section.
- 2Add to “Excluded JavaScript Files”In the textarea labeled “One per line”, paste:
/t.js e-zeeinternet.lovable.app/t.js (?:.*)e-zeeinternet(?:.*)
These patterns are matched as substrings against the script'ssrc. - 3Save and clear cacheClick Save Changes, then clear the cache.
3. Exclude from Lazy-load (data-rocket-src rewrite)
WP Rocket → Media → LazyLoad / wp-rocket/inc filters
WP Rocket rewrites the script's src attribute to data-rocket-src and only loads it on user interaction. Our validator detects this as 'lazy-loaded'.
- 1Use the helper plugin or add a small filterThe exclusions in step 2 also stop the
data-rocket-srcrewrite for matching scripts. If it persists, drop this snippet into your theme'sfunctions.phpor a code-snippets plugin:add_filter( 'rocket_delay_js_exclusions', function( $excluded ) { $excluded[] = '/t\\.js'; $excluded[] = 'e-zeeinternet\\.lovable\\.app'; return $excluded; } ); - 2Verify in page sourceView the page source (Ctrl+U). The script tag must use
src="...", notdata-rocket-src="...".
4. Exclude from Cache → Never Cache URLs (optional)
WP Rocket → Advanced Rules → Never Cache URL(s)
If your snippet lives in a header/footer that's cached as static HTML, edits to the snippet won't appear until the cache is cleared. Usually 'Clear and Preload Cache' after every snippet change is sufficient.
- 1Clear cache after every snippet changeTop admin bar → WP Rocket → Clear and Preload Cache.
- 2Force-refresh in your browserCtrl/Cmd + Shift + R on a page where the counter should appear.
Verify the fix
- Clear WP Rocket cache and any CDN cache (Cloudflare, BunnyCDN, etc.).
- Open your site in a private window and load 1–2 pages.
- Return to the dashboard and run Validate tracking code — both the tracker host and script's host probes should pass (or only the tracker host probe needs to pass when data-endpoint is set).
- Check that Events received (last 24h) increases.