Title: Koko Analytics
Last modified: October 31, 2022

---

# Koko Analytics

 *  Resolved [ralfkerkhoff](https://wordpress.org/support/users/ralfkerkhoff/)
 * (@ralfkerkhoff)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/koko-analytics/)
 * Hi,
    has anybody implemented Koko analytics with real cookie banner?
 * I am struggling to_:
    1. Avoid that the analytics cookie will be set. 2. the 
   tracking is recorded.
 * It would be cool if someone can share his solution.
 * Thanks for your help
    Ralf

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

 *  Thread Starter [ralfkerkhoff](https://wordpress.org/support/users/ralfkerkhoff/)
 * (@ralfkerkhoff)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/koko-analytics/#post-16149665)
 * 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
 *  Plugin Author [devowl.io GmbH](https://wordpress.org/support/users/devowl/)
 * (@devowl)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/koko-analytics/#post-16149689)
 * 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
 *  Thread Starter [ralfkerkhoff](https://wordpress.org/support/users/ralfkerkhoff/)
 * (@ralfkerkhoff)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/koko-analytics/#post-16150186)
 * Hi Jan,
    i am looking forward for the new service template 🙂
 * I think the “problem” is that Koko does not record any hits when DNT is set. 
   That is different from Statify (visits are counted with DNT set).
 * Without the addition to the themes function file no visits are counted when DNT
   is set – in this case there is no need to consent.
 * So, yes my solution is not 100% clean.
 * Ralf
 *  Thread Starter [ralfkerkhoff](https://wordpress.org/support/users/ralfkerkhoff/)
 * (@ralfkerkhoff)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/koko-analytics/#post-16153374)
 * Hi Jan,
    one additional question: After the visitor consents, a cookie is set
   with: <script> if (window.koko_analytics) window.koko_analytics.use_cookie = 
   true; </script>
 * Is there a way to delete the cookie if the user removes his consent via the privacy
   settings?
    At the moment no visits are counted when the user removes his consent–
   but the cookie is still there.
 * Cheers
    Ralf
 *  Plugin Author [devowl.io GmbH](https://wordpress.org/support/users/devowl/)
 * (@devowl)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/koko-analytics/#post-16155184)
 * Hi Ralf,
 * if you go in your WordPress to _Cookies > Services > Koko Analytis (created by
   yourself) > Edit_, you have to add all cookies to the “Technical cookie information”
   section. In addition, you have to activate the option “Delete all first-party
   cookies after opt-out. First-party cookies are only cookies that are set by or
   for this domain.” in the section “Technical handling”.
 * Afterwards, once the user opt-out, all first party cookies of the service will
   be deleted.
 * Best regards,
 * Jan
 *  Thread Starter [ralfkerkhoff](https://wordpress.org/support/users/ralfkerkhoff/)
 * (@ralfkerkhoff)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/koko-analytics/#post-16173863)
 * Hi Jan,
 * “delete all first party cookies after opt-out” did the trick.
 * Sorry for my late “thank you” – the flue has got me in the last days.
 * Ralf
 *  Plugin Author [devowl.io GmbH](https://wordpress.org/support/users/devowl/)
 * (@devowl)
 * [3 years, 6 months ago](https://wordpress.org/support/topic/koko-analytics/#post-16173998)
 * Hi [@ralfkerkhoff](https://wordpress.org/support/users/ralfkerkhoff/),
 * great to hear this solved the issue for you.
 * I hope you get well soon 🙂
 * Best regards,
 * Jan

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

The topic ‘Koko Analytics’ is closed to new replies.

 * ![](https://ps.w.org/real-cookie-banner/assets/icon-256x256.png?rev=2419813)
 * [Real Cookie Banner: GDPR & ePrivacy Cookie Consent](https://wordpress.org/plugins/real-cookie-banner/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/real-cookie-banner/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/real-cookie-banner/)
 * [Active Topics](https://wordpress.org/support/plugin/real-cookie-banner/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/real-cookie-banner/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/real-cookie-banner/reviews/)

 * 7 replies
 * 2 participants
 * Last reply from: [devowl.io GmbH](https://wordpress.org/support/users/devowl/)
 * Last activity: [3 years, 6 months ago](https://wordpress.org/support/topic/koko-analytics/#post-16173998)
 * Status: resolved