Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Google Analytics Consent mode (beta) - Sends data but is not reflected on dashboard

I wanted to use the new analytics consent mode which is gdpr compliant following this official guide

Placed following into the header:

    <script>
 

     window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
    
      gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'});
     
    </script>
        
    <script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXX"></script>
    <script>
      window.dataLayer = window.dataLayer || [];
      function gtag(){dataLayer.push(arguments);}
      gtag('js', new Date());
    
      gtag('config', 'G-XXXXXXXX');
    </script>

Analytics consent mode works with:

 gtag('consent', 'default', {'ad_storage': 'denied'})

However no longer works (no user activity on dashboard) if I deny cookies in the settings like so:

gtag('consent', 'default', {'ad_storage': 'denied', 'analytics_storage': 'denied'});

My understanding is that it should still reflect page hits without the cookie.

I can see the POST request being sent to their go server with status 204.

What am I doing wrong?

like image 830
Phil15 Avatar asked Nov 22 '20 08:11

Phil15


1 Answers

The hits with 'analytics_storage' set to 'denied' are not shown in GA reports at all now. Initially I could see them in the real-time report, but now that seems to be gone too.

Having said that, it is possible to manipulate the request with the customTask API and rewrite the 'gcs' parameter (or drop it altogether). This way, you would see the anonymized (on user level) hits in GA while not using cookies.

like image 82
florian Avatar answered Jan 02 '23 09:01

florian