Support » Plugin: WP Statistics » Wrong IP address registered
Wrong IP address registered
I’ve noticed some strange stats generated by WP Statistics plugin, like some visitors getting to the page from nowhere and I’ve decided to check my server logs.
So, I see requests to WP Statistics from on IP address, but with another IP address in params, for example:
[IP1] [DATE] GET /wp-json/wp-statistics/v2/hit?_=[PARAMS]…&ip=[IP2]&…
So I get a hit in WP Statistics registered from IP2 even though request was made by IP1.
How even this possible and why does it happen?
What is the real IP of the visitor here?
I have W3 Total Cache and Cache Compatibility ENABLED in plugin settings.
Thank you for opening the thread, can you please the plugin’s XHR request parameters in Developer Tools > Network?
And make sure the request has the correct IP address, you can double-check it with your server access log as well.
Where can I find this Developer Tools > Network?
Take a look at here https://developer.chrome.com/docs/devtools/network/
Here is the request, IP address is correct.
This problem happens not all the time, but some times with some visitors.
Here is request from another browser, my IP is correct:
Let me know, if you need more details.
- This reply was modified 1 year ago by sdfgkhdfjkh.
Here is a line from my server log with wrong IP, IPs are real:
220.127.116.11 - - [22/Feb/2022:11:05:33 -0500] "GET /wp-json/wp-statistics/v2/hit?_=1645545494&_wpnonce=f43e209f5d&wp_statistics_hit_rest=yes&browser=Chrome&platform=OS%20X&version=10.15.7&referred=https%3A%2F%2Fduckduckgo.com%2F&ip=18.104.22.168&exclusion_match=no&exclusion_reason&ua=Mozilla%2F5.0+%28Macintosh%3B+Intel+Mac+OS+X+10_15_7%29+AppleWebKit%2F537.36+%28KHTML%2C+like+Gecko%29+Chrome%2F98.0.4758.102+Safari%2F537.36&track_all=1×tamp=1645527494¤t_page_type=post¤t_page_id=9338&search_query&page_uri=[PATH]/&user_id=0 HTTP/1.1" 200 85 "https://[DOMAIN.COM]/[PATH]/" "Mozilla/5.0 (X11; Fedora; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/98.0.4758.105 Safari/537.36"
So, basically, request was made by IP 22.214.171.124, but it is 126.96.36.199 in request params.
Those two people visited website with around 7 minutes difference, first 188.8.131.52, then 184.108.40.206. There were no other visitors between them, but I have checked statistics in admin panel between those two visits with the following request:
Do you use the static cache on your website? what’s the cache plugin name that is enabled on your WordPress?
I use W3 Total Cache plugin and “Cache Compatibility” is ENABLED in WP Statistics plugin settings.
I think the W3 Total Cache plugin caches all the visitor information that is appended to the page source inline by WP-Statistics, and this can be the main problem.
Well, yes, there is no point doing XMLHttpRequest this way.
Try once again by disabling the “Inline JS modification” option in W3 Total Cache
There is no modification, there is only minification.
And Minify->HTML&XML->Inline JS minification is already DISABLED.
Are there any relative options for “Page Cache Static”?
There are lots of page cache options.
You have inline JS like this:
<script>var WP_Statistics_http = new XMLHttpRequest();WP_Statistics_http.open('GET', 'https://[DOMAIN.COM]/wp-json/wp-statistics/v2/hit?_=1646003004&_wpnonce=865577ec67&wp_statistics_hit_rest=yes&browser=Safari&platform=OS X&version=10.15.6&referred=https%3A%2F%2F[DOMAIN.COM]&ip=[IP]&exclusion_match=no&exclusion_reason&ua=Mozilla%2F5.0+%28Macintosh%3B+Intel+Mac+OS+X+10_15_6%29+AppleWebKit%2F605.1.15+%28KHTML%2C+like+Gecko%29+Version%2F14.0.3+Safari%2F605.1.15&track_all=1×tamp=1645985004¤t_page_type=home¤t_page_id=0&search_query&page_uri=/&user_id=0', true);WP_Statistics_http.setRequestHeader("Content-Type", "application/json;charset=UTF-8");WP_Statistics_http.send(null);</script>
This is wrong! Any cache plugin will cache that. You have to collect all those details dynamically and post with js.
You are doing it statically!
Any update on that?
I keep getting wrong IPs, WP-Statistics is definitely not compatible with cache plugins at the moment.
- The topic ‘Wrong IP address registered’ is closed to new replies.