Hello @eragonsoftware,
That’s really weird behavior. A few questions that could help us assert what’s going on:
- Are there any errors in your PHP error log?
- Does your WP Cron run regularly? Ie if you install a plugin like WP Crontrol, is there some other task blocking the queue or do look things as expected?
- Can you share the contents of the optimized endpoint file
/koko-analytics-collect.php?
- Does your wp-content/uploads directory contain a writable koko-analytics directory? Is there anything in that directory?
Thanks in advance!
Hi Danny, thank you for your reply
No errors are present, even if I turn debugging on.
Cron works allright, sometimes Litespeed cron fails to execute, but it executes later (as in … same day, but with a delay)
There is an events_buffer.php file in the uploads/koko_analyitics folder, however, it seems strange that its content is exit() right after the php startline, but after the ?> closing php bracker, there are some serialised data lines
like
a:6:{i:0;s:1:”p”;i:1;i:1739027226;i:2;i:38004;i:3;i:0;i:4;i:1;i:5;s:22:”http://m.facebook.com/”;}
Is that how it’s supposed to be ?
I’ve replaced the real path below, for safety reasons, with 3 dots
<?php
/**
- @package koko-analytics
- @license GPL-3.0+
- @author Danny van Kooten
*
- This file acts as an optimized endpoint file for the Koko Analytics plugin.
*/
// path to pageviews.php file in uploads directory
define(‘KOKO_ANALYTICS_BUFFER_FILE’, ‘/…/public_html/wp-content/uploads/pageviews.php’);
// path to functions.php file in Koko Analytics plugin directory
require ‘/…/public_html/wp-content/plugins/koko-analytics/src/collect-functions.php’;
// function call to collect the request data
KokoAnalytics\collect_request();
Hi @eragonsoftware,
Thanks for the quick response!
The <?php exit; ?> on the first line is there on purpose to prevent others from accessing the contents of that file over the web.
The delayed cron execution shouldn’t be a problem, especially if it still runs on the same day but as of a few versions ago it doesn’t matter if it runs a few days late either.
Digging into this I did find a slight issue with the optimized endpoint file, but it shouldn’t be causing any issues. In theory, at least. Can you please try removing the koko-analytics-collect.php file to verify? The plugin should then automatically switch to using the AJAX endpoint for gathering its data.
Is counting correct using the AJAX endpoint?
Allright, I removed the file and will keep monitoring and comparing server no. of visits with what koko is reporting. I will get back to you within 24 hours, if it’s not a bother, don’t close the topic.. let’s keep this as an open issue, and I’ll post feedback.
Thank you for your assistance
Thanks @eragonsoftware – please do keep me posted.
Hi Danny, just a feedback. It seems removing the endpoint file has solved this issue, so thank you for suggesting that.
I have a feedback with regard to the counting of the pages, for instance…it’s 12:30 am (00:30) in my location and the stats say something like:
Your site had 68 pageviews today, of which 182 were in the last hours.
https://prnt.sc/Eji-VixI_dzH
You see the logical error here 🙂
Thank you for all your support, and this great plugin.
I will close this issue as solved.
🤝️
Awesome @eragonsoftware, thank you for getting back! Will fix that logical error too.
Best,
Danny