How to Exclude WP Statistics tracker.js from Caching & Minification

To ensure accurate visitor tracking with WP Statistics, it’s critical that its JavaScript tracker isn’t altered by caching or optimization plugins. Always exclude this file:

/wp-content/plugins/wp-statistics/assets/js/tracker.js

from JS minification, combination, or defer/delay settings. Below are step-by-step instructions for popular plugins.

1. WP Rocket

  1. Navigate to Settings → WP Rocket → File Optimization.
  2. Under Minify/Combine JavaScript Files or Load JavaScript Deferred, find Excluded JavaScript Files.
  3. Add the file path, e.g. /wp-content/plugins/wp-statistics/assets/js/tracker.js
  4. Save and purge the cache.

2. WP Super Cache

WP Super Cache does not cache or modify static assets like .js, .css, or images. It only caches full HTML page content.
Therefore, you do not need to (and cannot) exclude tracker.js in WP Super Cache settings.

3. WP Fastest Cache

  1. Go to WP Fastest Cache → Exclude.
  2. Under Exclude JS, add: /wp-content/plugins/wp-statistics/assets/js/tracker.js
  3. Save and delete cached files.
  4. If using “Minify JS” or “Combine JS”, ensure exclusion remains active.

4. Cache Enabler

  1. Go to Settings → Cache Enabler.
  2. In Cache Exclusions or “Do not cache pages containing”, add: /wp-content/plugins/wp-statistics/assets/js/tracker.js
  3. Save and purge all cache.

5. W3 Total Cache

  1. Open Performance → Minify → Advanced.
  2. Under Never minify the following JS files, add: /wp-content/plugins/wp-statistics/assets/js/tracker.js
  3. Save all settings and purge cache.
  4. Optionally, under Page Cache → Advanced, add the file to “Never cache the following pages/URLs”

6. WP‑Optimize

  1. Visit WP‑Optimize → Minify.
  2. Toggle off “Process JavaScript files” completely, or if available:
  3. In Exclude JS files, add: /wp-content/plugins/wp-statistics/assets/js/tracker.js
  4. Save changes and clear cache.

Let’s get started
Take your business to next level

Become part of our growing family of +600,000 users and get the tools you need to make smart choices for your website. Simple, powerful insights are just a click away.