Koko Analytics


Koko Analytics is a privacy-friendly analytics plugin for WordPress. It does not use any external services, so data about your visitors is never shared with any third-party company.

Furthermore, no visitor specific data is collected and visitors can easily opt-out of tracking by enabling “Do Not Track” in their browser settings.

Stop sharing visitor data with third-party companies making money off that same data. Stop unnecessarily slowing down your website. Koko Analytics lets you focus on what is important and gives you all the essential metrics, while respecting the privacy of your visitors.


  • Plug and play: After installing and activating the plugin, stats will automatically be collected.
  • Privacy: No personal information or anything visitor specific is tracked.
  • GDPR: Compliant by design.
  • Data ownership: No external services are used. Data about visits to your website is yours and yours alone.
  • Performance. Handles sudden bursts of traffic without breaking a sweat.
  • Metrics: All the essentials: visitors, pageviews and referrers.
  • Cookies: There is an option to not use any cookies.
  • Referrer spam: Built-in blacklist to filter out referrer spam.
  • Cache: Fully compatible with pages served from any cache.
  • AMP: Tracks AMP powered pages too (official AMP plugin only, for now).
  • Open-source: Code is released under the GPL 3.0 license.


You can contribute to Koko Analytics in many different ways. For example:


  • Koko Analytics' dashboard to view your website statistics.
  • The settings page where you can exclude certain user roles from being counted.
  • A widget to show your most viewed posts (or any other post type) for a given period.
  • The dashboard widget to quickly show your site visits over the last 2 weeks.


  1. In your WordPress admin area, go to Plugins > New Plugin, search for Koko Analytics and click Install now.
  2. Alternatively, download the plugin files and upload the contents of koko-analytics.zip to your plugins directory, which usually is /wp-content/plugins/.
  3. Activate the plugin. Koko Analytics will start recording stats right away.
  4. Access your analytics by browsing to Dashboard > Analytics in your WordPress admin area.


Does this respect my visitor’s privacy?

Absolutely, nothing that could lead back to the visitor is recorded. If the visitor has “Do Not Track” enabled in their browser settings, the visitor won’t be tracked at all.

Does this use any external services?

No, the data never leaves your website. That’s (part of) what makes Koko Analytics such a great choice if you value true privacy.

Does this set any cookies?

By default, yes. But you can easily disable this in the plugin’s settings. Without cookies the plugin can still detect unique pageviews, but not returning visitors.

Will this slow down my website?

No, the plugin is built in such a way that it never slows down your website for your visitors. If there is any heavy lifting to be done, it is done in a background process.

In fact, because the plugin does not depend on any external services it is usually much faster than third-party analytics tools.

No pageviews are being recorded.

This is usually a file permissions issue. The first thing to check is whether the /wp-content/uploads/pageviews.php file exists and is writable by your web server.

How to only use cookies after consent?

First configure Koko Analytics to not use any cookies by default.

Then configure your cookie consent plugin to add the following code for visitors that have given consent:

if (window.koko_analytics) window.koko_analytics.use_cookie = true;

How do I give users access to the dashboard page?

You can use a plugin like User Role Editor to grant the view_koko_analytics and manage_koko_analytics capabilities to any user rolou can delete the plugin again after adding the capability.

What is the definition of a “pageview”?

A pageview is defined as a view of a page on your site. If a user clicks reload after reaching the page, this is counted as an additional pageview. If a user navigates to a different page and then returns to the original page, a second pageview is recorded as well.

What is the definition of a “visitor”?

A visitor represents the number of sessions during which your website or a specific page was viewed one or more times.


December 8, 2021
Great plugin, easy to use, and giving nice information
November 30, 2021
I use this plugin quite often when creating websites for customers who just want to see who is using their website, where the user comes from, etc. ... so, just the simple statistics. This plugin works very well for these purposes and there is no tracking cookie set in the users browser ... top!
November 8, 2021
I was looking for this kind of light-weight plugin for the last 5 years. A huge thanks to the developpers. I hope this plugin will stay free and light-weight and maintain for several years. Thank you so much guys, thank you
October 22, 2021
Very good plugin ! If you only need to check the returning visitors, the pageviews (in a non-intrusive way, cherry on the cake), then you should give Koko a try 🙂
October 13, 2021
For my webshop it does not really provide me with enough information, but never the less: 5 star appreciation for the privacy respecting, easy to use and free plugin.
Read all 74 reviews

Contributors & Developers

“Koko Analytics” is open source software. The following people have contributed to this plugin.


“Koko Analytics” has been translated into 17 locales. Thank you to the translators for their contributions.

Translate “Koko Analytics” into your language.

Interested in development?

Browse the code, check out the SVN repository, or subscribe to the development log by RSS.


1.0.28 – Sep 27, 2021

  • Account for missing configuration object, for example if theme does not properly call wp_head().
  • Cast database result to integer types so we do not have to do it client-side.
  • Cache dashboard requests to REST API for 5 minutes (using browser cache).
  • Use integers for viewbox coordinates (for increased performance).
  • Simple locking mechanism for aggregation job to detect previous runs which are still busy.
  • Add WP CLI command for aggregating stats without having to go through WP Cron: wp koko-analytics aggregate

1.0.27 – May 4, 2021

  • Use defer attribute on script to not block parsing at all.
  • Normalize Pinterest URL’s with and without www subdomain.
  • Fix some missing translations.

1.0.26 – Feb 17, 2021

  • Re-introduce last 28 days by popular request.
  • Fix date presets dropdown not working in WebKit based browsers.
  • Update built-in referrer blocklist.

1.0.25 – Feb 16, 2021

  • Add several new date presets, like yesterday or last week.
  • Add support for entering custom date ranges using keyboard input.
  • Improve algorithm for chart y-axes to prevent huge jumps.
  • Add function for manually printing tracking script: <?php koko_analyics_tracking_script(); ?>
  • Update JS dependencies.

1.0.24 – Jan 20, 2021

  • Append random query parameter to tracking request to avoid beind cached now that the plugin is using a custom tracking endpoint.
  • Update JS dependencies.

1.0.23 – Jan 15, 2021

Major performance improvement by writing an optimized endpoint file containing the correct file paths, regardless of WordPress directory structure set-up.

If your WordPress root directory is not writable, go to the Koko Analytics settings page for instructions on how to manually create this optimized endpoint file.

1.0.22 – Nov 18, 2020

  • Fix PHP warnings in migration script, for trying to unlink unexisting file (eg on new plugin installs).
  • Generate URL to custom endpoint file correctly. Fixes issue with some multilingual plugins not recording pageviews correctly.

1.0.21 – Nov 5, 2020

  • Update option that stores whether to use custom endpoint after unlinking it, to prevent sending requests to an unexisting file.

1.0.20 – Nov 3, 20202

  • Do not use custom endpoint file if using custom uploads directory.
  • Use value from KOKO_ANALYTICS_USE_CUSTOM_ENDPOINT if it is defined.
  • Only call add_cap on administrator role if such a role exists
  • Update JS dependencies.
  • Update built-in referrer blocklist.

1.0.19 – Sep 2, 2020

  • Create buffer file directory if it does not exist yet, eg on a fresh WP install.
  • Update preact and date-fns to their latest versions.
  • Update built-in referrer blocklist.

1.0.18 – Aug 25, 2020

  • Fix issue with tracking not working on AMP powered pages or issuing a request to a non-existing file on cdn.ampproject.org.

1.0.17 – Aug 19, 2020

  • Fix issue when using Modern color scheme introduced in WordPress 5.5.
  • Improve test for custom endpoint file by checking for exact response body.
  • Prevent horizontal scrollbar from showing when hovering chart near edge of screen.

1.0.16 – Jul 21, 2020

  • Fix blank screen on WordPress versions lower than 5.0.
  • Fix settings link showing despite user lacking required capability.
  • Fix code for custom referrer blocklist using filter koko_analytics_referrer_blocklist.
  • Do not use custom endpoint file when site URL differs from WordPress URL.
  • Improve test for custom endpoint file.

1.0.15 – Jun 22, 2020

  • Fix weird date for “this week” preset.
  • Fix weeknames in datepicker.
  • Fix translation files not being loaded. Hopefully…

1.0.14 – Jun 22, 2020

  • Do not use custom tracking endpoint on Multisite installations because it ignores the site-specifix database prefix.
  • Show errors in aggegration process if WP_DEBUG is enabled.
  • Update referrer blocklist.
  • Use wp.i18n for managing translations in JavaScript files.
  • Bump table row count up to 25 per page.
  • Add filter hook: koko_analytics_referrer_blocklist (example)
  • Add filter hook: koko_analytics_ignore_referrer_url (example)

1.0.13 – May 28, 2020

  • Update referrer blocklist.
  • Improve date parsing from URL parameters to account for negative UTC offsets. Fixes an issue with the date jumping back one day.
  • Don’t attempt to install custom endpoint if it was manually installed (using the KOKO_ANALYTICS_USE_CUSTOM_ENDPOINT constant).
  • Revert to using home_url() for the tracker endpoint URL.

1.0.12 – May 14, 2020

  • Add filter koko_analytics_honor_dnt to allow ignoring DoNotTrack.
  • Huge performance improvement for the tracking request if you’re on a standard WordPress installation with the root directory writable.
  • Limit scope of tracking script to prevent variable naming collisions.

1.0.11 – Apr 17, 2020

  • Add setting for specifying default date period when opening analytics dashboard.
  • Add Chrome-Lighthouse to list of ignored HTTP user agents.
  • Show notice on analytics dashboard page when buffer file is not writable.
  • Derive cookie path from home URL to work properly with WordPress installations not living at the root of a domain.
  • Track pageview on window.load instead of window.DOMContentLoaded, to make it easier to overwrite the configuration object.
  • Minor optimizations to tracking script.

1.0.10 – Mar 23, 2020

  • Print configuration object early on in page HTML so it is easier to override it using a cookie consent plugin.
  • Add help text explaining the use of a multi-select element.

1.0.9 – Mar 9, 2020

  • Use arrow keys (without Ctrl-key) for quickly cycling through date ranges.
  • Group chart by month if showing more than 2 (full) months of data.
  • Replace React by Preact to cut JS bundle size in half.
  • Normalize referrer URL’s without protocol.
  • Improve total comparision with previous period.

1.0.8 – Feb 14, 2020

  • Add date preset for last 28 days
  • Add keyboard navigation support for quickly cycling through date periods (Ctrl + Arrow key)
  • Expand referrer aggregation logic. If you have any URL’s you would like to see combined into a single domain, please post them here.
  • Fix referrer URL’s table missing the AUTO_INCREMENT statement.
  • Change dropdown to number input in most viewed posts widget.
  • Show notice on dashboard page if an issue with WP Cron is detected.
  • Improved y-axes in chart when maximum value is lower than 10.
  • Use colors from admin scheme in chart tooltip.

1.0.7 – Jan 30, 2020

  • Aggregate certain referrers, e.g. google.com/search becomes google.com.
  • Use WordPress color scheme (from user profile) for colors in chart.
  • Show more labels on the chart’s x-axes (wide screens only).
  • Show number of pageviews in the last hour.
  • Show day of week to chart tooltip.
  • Use Paul Heckbert’s loose labels (nice numbers) algorithm for labels on y-axes.
  • All colors now have a contrast ratio that is (at least) WCAAG AA compliant.
  • Revert multiple bar chart change (because of user feedback), use inner bar instead.
  • Minor performance optimisations for viewing dashboard page.
  • Fixes “Invalid time” error when re-opening the dashboard in Safari.

1.0.6 – Jan 20, 2020

  • Remember view period when navigating away from analytics dashboard.
  • Add filter hook to prevent loading the tracking script: koko_analytics_load_tracking_script
  • Ignore all user agents containing the word seo
  • Ignore requests if page is loaded inside an iframe.
  • Only read document.cookie if cookie use is actually enabled.
  • In chart, use separate bars instead of stacked bars.

1.0.5 – Dec 30, 2019

  • Add “today” option to date periods preset menu.
  • Hide chart component when viewing just a single day of data.
  • Automatically refresh data in dashboard every minute.
  • Use human readable number format on chart’s y-axes.
  • Show chart elements even if outside of chart container.

1.0.4 – Dec 13, 2019

  • Fix referrer URL’s not being saved correctly.
  • Fix unique pageview detection
  • Fix pretty number with only trailing zeroes.
  • Fix bar chart not stacking properly.
  • Improved display of Twitter or Android app referrers.
  • Improved chart tooltip.
  • Improved styling for small mobile screens.
  • Trim trailing slashes from referrer URL’s.
  • Escape all strings coming from translation files.
  • Filter out common bots by checking user agent in tracking script.

1.0.3 – Dec 6, 2019

  • Fix link to settings page from plugins overview page.
  • Fix REST API URL’s when not using pretty permalinks.
  • Add support for tracking AMP-powered pages.
  • Add setting to disable cookie usage.
  • Handle network request errors on admin pages.
  • Return HTTP 500 error when unable to write to buffer file.
  • Simplify adding post title to post type statistics.
  • Extend browser support to include older browsers.
  • Handle filesystem errors in aggregation process.

1.0.2 – Nov 22, 2019

  • Add icons to datepickers to quickly cycle through selected date periods.
  • Add capabilities view_koko_analytics and manage_koko_analytics to control whether a user role can view or manage statistics.
  • Add setting to automatically delete data older than X months.
  • Add menu item to WP Admin Bar.
  • Update URL when date range changes so page can be refreshed or shared.
  • Update browser history with chosen date ranges.
  • Show total size of Koko Analytics’ database tables on settings page.
  • Improved animations when dashboard data updates.
  • Improved column type constraints for storing data.
  • Improved labels for chart x-axes.
  • Consistent ordering of posts and referrers tables.
  • Remove trailing ? character from referrer URL’s after query parameters are stripped.
  • Fix retrieving post title when post type is excluded from search.

1.0.1 – Nov 14, 2019

  • Add dashboard widget showing site visits over last 14 days.
  • Add widget for showing most viewed posts, pages or any other post type over a given period.
  • Add [koko_analytics_most_viewed_posts] shortcode.
  • Add pagination to tables showing top posts and top referrers.
  • Add settings link to plugin row on plugins overview page in WP admin.
  • Use ASCII for storing textual data. Fixes an issue with error message “specified key is too long” on some MySQL installations when the charset is utf8mb4.
  • Remove all data when uninstalling the plugin. Thanks to Santiago Degetau.
  • Improved memory usage when handling huge bursts of traffic.
  • Load tracking script asynchronously.
  • Styling improvements for the dashboard page.

1.0.0 – Nov 4, 2019

Initial release.