If you are experiencing issues with the tracker in WP Statistics, follow these steps to troubleshoot and resolve common problems.
1. Check the Response of the Request in XHR
- Open your website and navigate to a single post in private browsing mode.
- Use the Inspect tool to navigate to Network → XHR.
- Refresh the page and click on the request to view the response.
Success:
- Status: 200
- Response:
{"status":true}
Failed (Request is in Exclusion):
- Status: 200
- Response:
{"status":false,"data":"user role"}
Check the data
field in the response for the reason of the exclusion.
Failed (Invalid Signature):
- Status: 403
- Response:
{"code":"rest_forbidden","message":"Invalid signature","data":{"status":403}}
or {"status":false,"data":"Invalid signature"}
2. Check the IP Method Detection
Make sure the IP Detection Method in Settings → Advanced Options is configured properly, you can refer to the IP Detection Settings documentation for more information.
3. Ensure WP REST API is Not Restricted
Make sure that wp-json
is not restricted by any security plugin or server settings. If restricted, whitelist the endpoint wp-json/wp-statistics/v2
in the plugin settings.
4. Bypass Ad Blockers
Ad blockers may block the plugin’s REST API endpoint wp-json/wp-statistics/v2/hit
. Enable the Bypass Ad Blockers option in the General setting page to bypass this restriction. This can also resolve the issue mentioned in step 2.
5. Check the PHP Error Log
Examine the PHP error log on your server for any errors related to WP Statistics. This can provide insights into what might be causing the tracking issues.
6. Set the Tracking Method to Client-Side Tracking
Ensure that the Tracking Method in WP Statistics → Settings → General is set to Client-Side Tracking. This is recommended for better accuracy and future compatibility.
7. Clear the Cache
Clear your website’s cache, including any cache from cache plugins, server cache, or CDN cache, to ensure that the latest settings are applied. You can also exclude the /wp-content/plugins/wp-statistics/assets/js/tracker.js
in your cache plugin’s exclude option.
8. Check for Plugin Conflicts
Deactivate other plugins one by one to check if there are any conflicts with WP Statistics. Sometimes, other plugins may interfere with the tracker.
9. Update WP Statistics
Ensure that you are using the latest version of WP Statistics. Updates often contain bug fixes and improvements that can resolve tracking issues.
10. Inspect JavaScript Errors
Use the browser console to check for any JavaScript errors that might be interfering with the tracking script. Address any errors that you find.
By following these steps, you can resolve common issues with the tracker in WP Statistics and ensure accurate data collection and display.