Counting Modes Explained
Overview
View Counter WP offers three ways to record a page view. The right choice depends on your hosting and caching setup. All three modes write to the same View Counter data store; the difference is how the count is triggered.
All modes respect the same tracking rules: enabled post types, published content, bot filtering, logged-in user and role exclusions, IP exclusions, and the count interval.
PHP Mode (Server-Side)
The simplest mode. When WordPress renders a page, the view is counted immediately in PHP before the HTML is sent to the browser.
Pros:
- Zero front-end overhead (no JavaScript, no extra request)
- Instant, synchronous counting
- Works perfectly on uncached sites
Cons:
- Can miss views when full-page caching serves the page without running WordPress/PHP
Use when: Your site is uncached, lightly cached, or you know WordPress/PHP still runs for normal front-end requests.
JavaScript Mode (AJAX)
After the page loads in the browser, a small JavaScript snippet sends an asynchronous request to wp-admin/admin-ajax.php to record the view.
Pros:
- Works well with most page caching solutions because the count happens after the cached HTML loads
Cons:
- One additional HTTP request per page view
- Requires JavaScript to be enabled
Use when: You use WP Super Cache, W3 Total Cache, WP Rocket, or similar server-side caching.
REST API Mode
Similar to JavaScript mode, but sends the request to the WordPress REST API endpoint (/wp-json/view-counter/v1/track) instead of admin-ajax.
Pros:
- Works well with edge/CDN caching when the REST tracking endpoint is reachable
- Cleaner, lighter endpoint than admin-ajax
- Modern WordPress pattern
Cons:
- One additional HTTP request per page view
- REST API must be accessible (some security plugins restrict it)
Use when: You use Cloudflare APO, LiteSpeed Enterprise cache, or other edge/CDN-level caching.
If you are not sure which to pick, start with JavaScript mode. It is usually the safest choice for WordPress sites using standard caching plugins.