Title: Doesn&#8217;t count properly
Last modified: February 8, 2025

---

# Doesn’t count properly

 *  Resolved [eragonsoftware](https://wordpress.org/support/users/eragonsoftware/)
 * (@eragonsoftware)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/doesnt-count-properly/)
 * Something must have happened during the last two updates, because this plugin
   used to count the number of visitors perfectly, however, either after the last
   update, or since the one before that, counting has stopped being correct, it’s
   like it counts only every now and then. 
   For 1500 visitors, it counts like 800…
   for 540 visitors, it counts 53 ??Something doesn’t add up. It’s using the extra
   endpoint (the koko-analytics-collect.php), however, as I’ve said, counting started
   being really erratic. Site uses opcache, redis, and litespeed. Any chance any
   of those may influence the counting ?

Viewing 7 replies - 1 through 7 (of 7 total)

 *  Plugin Author [Danny van Kooten](https://wordpress.org/support/users/dvankooten/)
 * (@dvankooten)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/doesnt-count-properly/#post-18293545)
 * Hello [@eragonsoftware](https://wordpress.org/support/users/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!
 *  Thread Starter [eragonsoftware](https://wordpress.org/support/users/eragonsoftware/)
 * (@eragonsoftware)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/doesnt-count-properly/#post-18293571)
 * 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
   likea:
   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/&#8221](http://m.facebook.com/&#8221);;}
   Is that how it’s supposed to be ?I’ve replaced the real path below, for safety
   reasons, with 3 dots
 * <?php
   /**
    - [@package](https://wordpress.org/support/users/package/) koko-analytics
    - [@license](https://wordpress.org/support/users/license/) GPL-3.0+
    - [@author](https://wordpress.org/support/users/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();
 *  Plugin Author [Danny van Kooten](https://wordpress.org/support/users/dvankooten/)
 * (@dvankooten)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/doesnt-count-properly/#post-18293608)
 * Hi [@eragonsoftware](https://wordpress.org/support/users/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?
 *  Thread Starter [eragonsoftware](https://wordpress.org/support/users/eragonsoftware/)
 * (@eragonsoftware)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/doesnt-count-properly/#post-18293662)
 * 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
 *  Plugin Author [Danny van Kooten](https://wordpress.org/support/users/dvankooten/)
 * (@dvankooten)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/doesnt-count-properly/#post-18293725)
 * Thanks [@eragonsoftware](https://wordpress.org/support/users/eragonsoftware/)–
   please do keep me posted.
 *  Thread Starter [eragonsoftware](https://wordpress.org/support/users/eragonsoftware/)
 * (@eragonsoftware)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/doesnt-count-properly/#post-18302806)
 * 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](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.🤝️
 *  Plugin Author [Danny van Kooten](https://wordpress.org/support/users/dvankooten/)
 * (@dvankooten)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/doesnt-count-properly/#post-18303489)
 * Awesome [@eragonsoftware](https://wordpress.org/support/users/eragonsoftware/),
   thank you for getting back! Will fix that logical error too.
 * Best,
   Danny

Viewing 7 replies - 1 through 7 (of 7 total)

The topic ‘Doesn’t count properly’ is closed to new replies.

 * ![](https://ps.w.org/koko-analytics/assets/icon.svg?rev=2980600)
 * [Koko Analytics - Privacy-Friendly WordPress Analytics](https://wordpress.org/plugins/koko-analytics/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/koko-analytics/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/koko-analytics/)
 * [Active Topics](https://wordpress.org/support/plugin/koko-analytics/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/koko-analytics/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/koko-analytics/reviews/)

## Tags

 * [solved](https://wordpress.org/support/topic-tag/solved/)

 * 7 replies
 * 2 participants
 * Last reply from: [Danny van Kooten](https://wordpress.org/support/users/dvankooten/)
 * Last activity: [1 year, 3 months ago](https://wordpress.org/support/topic/doesnt-count-properly/#post-18303489)
 * Status: resolved