Title: Cookie Analytics problem
Last modified: May 9, 2018

---

# Cookie Analytics problem

 *  Resolved [pakino](https://wordpress.org/support/users/pakino/)
 * (@pakino)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/cookie-analytics-problem/)
 * I would need another help if possible.
    I followed the guide at this link
 * [https://gdpr-wp.com/knowledge-base/enabling-or-disabling-functionality-based-on-consent-and-cookies/](https://gdpr-wp.com/knowledge-base/enabling-or-disabling-functionality-based-on-consent-and-cookies/)
 * to block analytics cookies. When I load the site these are not installed and 
   that’s okay. But when the user accepts using the I Agree button cookies are installed
   _ga and _gid although they have not been accepted as cookies

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

 *  Thread Starter [pakino](https://wordpress.org/support/users/pakino/)
 * (@pakino)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/cookie-analytics-problem/#post-10266275)
 * to clarify
    I inserti this code in my function.pfp file in child-themes.
 *     ```
       add_action( 'wp_head', 'my_google_opt_out' );
       function my_google_opt_out() {
         if ( ! has_consent( 'statistici' ) || ! is_allowed_cookie( '_ga' ) ) {
           ?>
           <script>
             window['ga-disable-UA-XXXXXXXX-X'] = true; // Don't forget to replace X for your actual UA numbers.
           </script>
           <?php
         }
   
         if ( ! has_consent( 'statistici' ) || ! is_allowed_cookie( '_gali' ) ) {
           ?>
           <script>
             window['gali-disable-UA-XXXXXXXX-X'] = true; // Don't forget to replace X for your actual UA numbers.
           </script>
           <?php
         }
   
        if ( ! has_consent( 'statistici' ) || ! is_allowed_cookie( '_gat' ) ) {
           ?>
           <script>
             window['gat-disable-UA-XXXXXXXX-X'] = true; // Don't forget to replace X for your actual UA numbers.
           </script>
           <?php
         }
   
         if ( ! has_consent( 'statistici' ) || ! is_allowed_cookie( '_gid' ) ) {
           ?>
           <script>
             window['gid-disable-UA-XXXXXXXX-X'] = true; // Don't forget to replace X for your actual UA numbers.
           </script>
           <?php
         }
   
       }
       ```
   
 * I setting this cookies _ga, _gali, _gat, _gid with name Statistici
    end I create
   consentse Statistici..
 *  Plugin Author [Fernando Claussen](https://wordpress.org/support/users/fclaussen/)
 * (@fclaussen)
 * [8 years, 1 month ago](https://wordpress.org/support/topic/cookie-analytics-problem/#post-10266543)
 * Hi [@pakino](https://wordpress.org/support/users/pakino/),
 * If all those cookies are for the same thing, you can check for only one of them.
 * Can you share your site with me?
 *  Thread Starter [pakino](https://wordpress.org/support/users/pakino/)
 * (@pakino)
 * [8 years ago](https://wordpress.org/support/topic/cookie-analytics-problem/#post-10274169)
 * I apologize, but I solved it. It was my mistake, a plugin was used, MonsterInsight,
   and therefore did not block cookies. Entering the analytics code directly works
   perfectly.
 * Thanks to the availability
 *  [gianlucap](https://wordpress.org/support/users/gianlucap/)
 * (@gianlucap)
 * [8 years ago](https://wordpress.org/support/topic/cookie-analytics-problem/#post-10276252)
 * Hi [@pakino](https://wordpress.org/support/users/pakino/)
 * I don’t understand where I should create “statistici”.
 * Thanks

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

The topic ‘Cookie Analytics problem’ is closed to new replies.

 * ![](https://ps.w.org/gdpr/assets/icon.svg?rev=1837142)
 * [GDPR](https://wordpress.org/plugins/gdpr/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/gdpr/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/gdpr/)
 * [Active Topics](https://wordpress.org/support/plugin/gdpr/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/gdpr/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/gdpr/reviews/)

 * 4 replies
 * 3 participants
 * Last reply from: [gianlucap](https://wordpress.org/support/users/gianlucap/)
 * Last activity: [8 years ago](https://wordpress.org/support/topic/cookie-analytics-problem/#post-10276252)
 * Status: resolved