Back to dashboard
WordPress · WP Rocket

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.

Symptom

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.

Quickest fix

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.

  1. 1
    Open File Optimization
    WP Admin → Settings → WP Rocket → File Optimization tab.
  2. 2
    Add 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(?:.*)
  3. 3
    Save and clear cache
    Click 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.

  1. 1
    Find “Delay JavaScript execution”
    Same File Optimization tab, scroll to the Delay JavaScript execution section.
  2. 2
    Add 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's src.
  3. 3
    Save and clear cache
    Click 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'.

  1. 1
    Use the helper plugin or add a small filter
    The exclusions in step 2 also stop the data-rocket-src rewrite for matching scripts. If it persists, drop this snippet into your theme's functions.php or a code-snippets plugin:
    add_filter( 'rocket_delay_js_exclusions', function( $excluded ) {
      $excluded[] = '/t\\.js';
      $excluded[] = 'e-zeeinternet\\.lovable\\.app';
      return $excluded;
    } );
  2. 2
    Verify in page source
    View the page source (Ctrl+U). The script tag must use src="...", not data-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.

  1. 1
    Clear cache after every snippet change
    Top admin bar → WP Rocket → Clear and Preload Cache.
  2. 2
    Force-refresh in your browser
    Ctrl/Cmd + Shift + R on a page where the counter should appear.

Verify the fix

  1. Clear WP Rocket cache and any CDN cache (Cloudflare, BunnyCDN, etc.).
  2. Open your site in a private window and load 1–2 pages.
  3. 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).
  4. Check that Events received (last 24h) increases.