Koko Analytics | WordPress.org

[ad_1]

I finally got it working.
For those who are interested here is how it works:

Create a service and add this code to “execute at optin:
<script>
if (window.koko_analytics) window.koko_analytics.use_cookie = true;
</script>

In the corresponding content blocker add this to blocked elements section:
*/koko-analytics/assets/dist/js/script.js*

Keep in mind that Koko does not record visits if the “don not track” option is set in the browser options.
It will not collect data even if the visitor consents in real cookie banner. To avoid this add the following to the functions.php of your theme:

add_filter('koko_analytics_honor_dnt', '__return_false');

add_action('wp_enqueue_scripts', function() {
    wp_add_inline_script('koko-analytics', 'window.koko_analytics.use_cookie = navigator.doNotTrack !== "1"', 'before');
});

Cheers
Ralf

Hi Ralf,

Thank you for your inquiry. Your solution is a bit hacky, as I understand you are misusing the Do Not Track functions a bit.

We have a service template with a clean integration, which it needs due to the architecture of Koko Analytics, already on our to-do list.

However, please note that we currently receive a lot of requests for new service templates, so we have to prioritize its implementation. The template you requested has not been requested very often yet, so I have to ask you for some patience. Currently, we expect a waiting time of more than two month.

We will come back to you by as soon as the service template is available in Real Cookie Banner!

Best regards,

Jan

 

This site will teach you how to build a WordPress website for beginners. We will cover everything from installing WordPress to adding pages, posts, and images to your site. You will learn how to customize your site with themes and plugins, as well as how to market your site online.

Buy WordPress Transfer