Post Views Counter records visitor engagement across your WordPress site by tracking each content view. The plugin provides accurate view statistics while giving you control over what gets tracked, how frequently visitors are counted, and where the tracking data is stored. This information helps you understand which content resonates with your audience and make data-driven decisions about your site’s direction.
The tracking system balances accuracy with performance. Whether you’re running a simple blog or a high-traffic site with aggressive caching, the plugin offers multiple counter modes to ensure views are captured reliably. You can exclude specific visitor groups—such as logged-in users, crawlers, or your own IP address—to keep your statistics clean and meaningful.
Pro expands tracking capabilities beyond individual posts to include taxonomy archives, author pages, and other site sections. Advanced options like strict counts prevent visitors from bypassing tracking intervals, while cookieless storage provides a privacy-friendly alternative for GDPR compliance.
Key Concepts
Counter Modes
The plugin offers four counter modes, each suited to different hosting environments:
-
PHP Mode: The default server-side tracking method. Views are recorded during page generation on your server. This mode works well for sites without page caching but may miss views on cached pages.
-
JavaScript Mode: Client-side tracking that executes in the visitor’s browser. This mode bypasses page caching issues by recording views after the page loads. Ideal for sites using caching plugins or CDN services.
-
REST API Mode: Uses the WordPress REST API endpoint at
/wp-json/post-views-counter/update-post-views/to record views. This approach works reliably with most caching configurations and provides good compatibility across hosting environments.
- Fast AJAX: A Pro-only mode that delivers up to 10x faster performance compared to other client-side methods. This mode is optimized for high-traffic sites where tracking speed is critical.
Configure counter mode at Post Views > Counting > Tracking Behavior using the Counter Mode option.
Data Storage
The plugin stores a tracking identifier in each visitor’s browser to prevent duplicate counts within your configured time interval. You can choose between two storage methods:
-
Cookies: The traditional approach using browser cookies. Reliable and widely supported, but some visitors may have cookies disabled or blocked.
-
Cookieless: A Pro-only privacy-focused alternative that doesn’t require cookies. This method supports GDPR compliance by avoiding cookie consent requirements for view tracking.
Configure data storage at Post Views > Counting > Tracking Behavior using the Data Storage option. Default: Cookies.
Count Interval
The count interval determines how long the plugin waits before recording another view from the same visitor on the same content. By default, this is set to 24 hours—meaning a visitor who views a post multiple times within a day only generates one counted view. You can adjust this from minutes to years, or set it to 0 to count every single page view.
Configure the count interval at Post Views > Counting > Tracking Behavior using the Count Interval option (time_between_counts). Supported intervals include minutes, hours, days, weeks, months, and years.
Tracking Targets
Tracking targets define which content types the plugin monitors. By default, posts are tracked.
Pro expands this to include taxonomy archives (categories, tags, custom taxonomies), author archive pages, and other pages like your front page, date archives, search results, and 404 pages. Pro also includes traffic source tracking to collect aggregate statistics about visitor origins.
Configure tracking targets at Post Views > Counting > Tracking Targets.
How It Works
View Recording Process
When a visitor loads a page, the plugin checks whether to record a view through this sequence:
-
Target Check: The plugin verifies the current page is a tracked content type (configured at Post Views > Counting > Tracking Targets).
-
Exclusion Check: The visitor is checked against exclusion rules at Post Views > Counting > Visitor Exclusions. This includes visitor groups (crawlers, logged-in users, guests), user roles, and IP addresses.
-
Interval Check: If the visitor has viewed this content before, the plugin checks whether enough time has passed since the last recorded view. The tracking identifier stored in the visitor’s browser tracks this.
-
View Recording: If all checks pass, the view count increments and the tracking identifier updates with the current timestamp.
Data Flow by Counter Mode
PHP Mode processes everything server-side during WordPress page loading. The view is recorded before the page renders, making it incompatible with most page caching solutions.
JavaScript Mode and REST API Mode work similarly: the page loads first, then a script makes a request to record the view. The REST API endpoint /wp-json/post-views-counter/view-post/ handles these requests. This client-side approach works correctly even when pages are cached.
Fast AJAX follows the same client-side pattern but uses an optimized handler that reduces server load and response time, making it suitable for sites with high traffic volumes.
Data Retention
Daily view data accumulates in your database. The cleanup interval setting at Post Views > Counting > Tracking Behavior automatically removes data older than the specified period. By default, data is retained indefinitely (set to 0 days). Adjust this to balance storage concerns against historical analysis needs.
Configuration
Tracking Targets
Configure which content types are tracked at Post Views > Counting > Tracking Targets:
- Post Types (
post_types_count): Select which post types should have their views counted. Default: Post.
-
Taxonomies (
taxonomies_count): Enable tracking on taxonomy archive pages like categories and tags. Default: disabled. -
Author Archives (
users_count): Track views on author archive pages. Default: disabled. -
Other Pages (
other_count): Track views on the front page, post type archives, date archives, search results, and 404 pages. Default: disabled. -
Traffic Sources (
technology_count): Collect aggregate statistics about visitor traffic sources. Default: disabled.
Tracking Behavior
Configure how views are recorded at Post Views > Counting > Tracking Behavior:
- Counter Mode (
counter_mode): Choose PHP Mode, JavaScript Mode, REST API Mode, or Fast AJAX. Default: PHP Mode.
-
Data Storage (
data_storage): Choose between Cookies or Cookieless storage. Default: Cookies. -
Count Time (
count_time): Store views using GMT or local site time. Default: GMT Time. -
Strict Counts (
strict_counts): Prevent visitors from bypassing the count interval using incognito mode or clearing cookies. Default: disabled.
-
Count Interval (
time_between_counts): Minimum time between recording new views from the same visitor. Supports minutes, hours, days, weeks, months, or years. Default: 24 hours. -
Cleanup Interval (
reset_counts): Automatically delete daily view data older than this period. Set to 0 to retain data indefinitely. Default: 0 days.
Visitor Exclusions
Control who is counted at Post Views > Counting > Visitor Exclusions:
-
Exclude Visitors (
exclude_groups): Select visitor groups to exclude from tracking:- Crawlers (robots)
- AI bots (Pro-only)
- Logged in users
- Guests
- Selected user roles
-
Exclude User Roles (
exclude_roles): Select specific WordPress user roles to exclude from tracking. -
Exclude IPs (
exclude_ips): Enter IP addresses (one per line) to exclude from tracking. Useful for excluding your own visits or team members.
Performance & Caching
Optimize for caching at Post Views > Counting > Performance & Caching:
-
Caching Compatibility (
caching_compatibility): Enable compatibility tweaks for supported caching plugins. Default: disabled. -
Object Cache Support (
object_cache): Enable optimization for Redis or Memcached object cache. Default: disabled.
Troubleshooting
Views Not Being Recorded
If view counts aren’t increasing:
-
Check Counter Mode: If using PHP Mode with a caching plugin or CDN, switch to JavaScript Mode, REST API Mode, or Fast AJAX. Cached pages bypass PHP execution.
-
Verify Tracking Targets: Ensure your content type is selected at Post Views > Counting > Tracking Targets. By default, only posts are tracked.
-
Check Exclusions: Review settings at Post Views > Counting > Visitor Exclusions. You may have accidentally excluded logged-in users, guests, or your IP address.
-
Test in Incognito: Open an incognito/private browser window and visit your content. This bypasses any existing tracking cookies and exclusion rules.
Views Being Overcounted
If you’re seeing inflated view counts:
-
Adjust Count Interval: Increase the time between counts at Post Views > Counting > Tracking Behavior. A shorter interval means more views per visitor.
-
Enable Strict Counts: Enable Strict Counts to prevent visitors from bypassing the interval by clearing cookies or using incognito mode.
-
Exclude Crawlers: Ensure crawlers are excluded at Post Views > Counting > Visitor Exclusions. Some bots may trigger view recording.
REST API Errors
If using REST API Mode and views aren’t recording:
-
Check REST API Accessibility: Visit
/wp-json/post-views-counter/update-post-views/directly in your browser. You should see a response (even an error response confirms the endpoint exists). -
Security Plugin Conflicts: Some security plugins block REST API requests. Add an exception for the
post-views-counternamespace. -
Caching Plugin Interference: Some caching plugins cache REST API responses. Exclude the
post-views-counternamespace from caching.
Database Size Concerns
If your database is growing large from view data:
-
Enable Cleanup Interval: Set a retention period at Post Views > Counting > Tracking Behavior. For example, 365 days keeps one year of detailed data.
-
Consider Your Needs: Historical data supports long-term analytics. If you only need recent statistics, shorter retention periods reduce database size.
- Object Cache: Enable Object Cache Support at Post Views > Counting > Performance & Caching if you use Redis or Memcached to improve performance with large view datasets.
