Daily stats not working
-
I have another plugin measuring how many visitors I get per day, so I know I get them. The total counters of this plugin increase and every day I see numbers increasing, but any time I check the daily stats are not shown at all. In the config I marked “enable daily” and I display 1 day.
Any idea what might be wrong?
-
Can you try enabling the W3C Total Cache fix and checking?
Hi Ajay,
It seems the problem was not with your plugin, but the cache plugin I use (WP fastest cache). It was updated yesterday and since that moment my daily stats are showing. I haven’t changed any settings in your plugin.
Just last question – can it be that your plugin collects only part of the clicks without the total w3 cache option marked on? Or maybe it is just either all or nothing. Thanks one more time for your plugin.Gregor
The w3 total cache uses Ajax to call the counting script. If that is disabled and you have a strong caching plugin, then it might not track.
Actually I see now where the problem is. I don’t see any stats in the evening. At about 22:00 (10:00 PM) my daily stats are not visible. Till midnight I don’t see anything despite having visitors. Nest day I see daily stats again till about 22:00. Not sure if this is exactly 22:00, it might be something about. I see the stats at about 19:00, later I don’t
The server time and the wordpress timezone are OK. Any idea what might cause that?
Thanks for any help.It could be that the daily stats are getting reset about 10pm which is really strange.
If you check your database, what do you see in the top_ten_daily table?
Exactly at 22:00 the webpage is empty.
Now I have:
UTC time: 11.04.2014 21:04:56 Local time: 11.04.2014 23:04:56
The database, some of last rows:
postnumber cntaccess dp_date
553 2 2014-04-11
24 3 2014-04-11
193 1 2014-04-11
596 1 2014-04-11
150 1 2014-04-11
323 1 2014-04-11
7 1 2014-04-11
241 2 2014-04-11As you see the server time is correct, there are entries in DB, but somehow they are not shown after 10pm. No idea why. It is exactly if you used the wrong sign for the timezone. I am UTC+2, but maybe you somehow change it to UTC-2 and treat 10pm as midnight?
I use this code to get the current time and I think it breaks down in some cases, which could be your install.
$current_time = gmdate( 'Y-m-d', ( time() + ( get_option( 'gmt_offset' ) * 3600 ) ) );Could you please try to change this line on line 272 of top-10.php
$current_time = gmdate( 'Y-m-d', ( current_time( 'timestamp' ) ) );For consistency, you might also want to edit line 40 of top-10-addcount.js.php
$current_date = gmdate( 'Y-m-d', ( current_time( 'timestamp' ) ) );Today at 21:55 I saw daily stats, at 22:05 I didn’t.
I commented those two lines and inserted new code just underneath. The overall stats were working all the time, for the daily no change, still empty. I tried several reloads.
Sorry it didn’t work.Do you think it is possible to install Query Monitor on your blog to test the query being generated?
It should tell you the exact query being used for the top lists when you visit your blog.
Yes, the date is broken. The query monitor shows:
SELECT postnumber, SUM(cntaccess) as sumCount, dp_date, ID, post_type, post_status
FROM wp_top_ten_daily
INNER JOIN wp_posts
ON postnumber=ID
AND post_status = ‘publish’
AND dp_date >= ‘2014-04-16‘
AND ID NOT IN (0)
AND ( post_type = ‘post’
OR post_type = ‘page’ )
GROUP BY postnumber
ORDER BY sumCount DESC
LIMIT 99999while my wordpress shows:
UTC time: 15.04.2014 20:31:48 Local time: 15.04.2014 22:31:48
Are you using the widget?
Can you tell me what the setting for the “Range in number of days” is?Alternatively, what is the setting for “Daily popular should contain how many days”? under Top 10 Settings page?
It is set to show 1 day. It is working fine each day till 22:00 when it suddenly goes into the future.
I guess I can change the setting to “2” and to have one day stats after 22:00, but then next day I would have to set it back to “1” before 22:00, not very useful π
Something is definitely wrong with how the plugin calculates the date.
I hope you will find it soon.What time zone have you set in the WordPress settings page?
Could you please change line 272 of top-10.php to the below.
$current_time = current_time( 'mysql' );Well, it shows something, but way too much. Query monitor shows:
SELECT postnumber, SUM(cntaccess) as sumCount, dp_date, ID, post_type, post_status
FROM wp_top_ten_daily
INNER JOIN wp_posts
ON postnumber=ID
AND post_status = ‘publish’
AND dp_date >= ‘1970-01-1’
AND ID NOT IN (0)
AND ( post_type = ‘post’
OR post_type = ‘page’ )
GROUP BY postnumber
ORDER BY sumCount DESC
LIMIT 99999It looks like the second argument to the current_time didn’t work somehow and the time was returned.
Well, when I modify the line to look like:$current_time = current_time( ‘timestamp’, 1 );
then it works, I see the daily popular posts after 22:00. However according to the documentation your original setting is correct. No idea – something definitely is wrong :/
The topic ‘Daily stats not working’ is closed to new replies.