14

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?

Phil15
  • 515
  • 5
  • 14

2 Answers2

2

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.

florian
  • 461
  • 1
  • 5
  • 11
  • A cannot get thi customTask API to remove/modify gcs. Do you have any resources for this? – Lukáš Řádek May 17 '21 at 10:04
  • Simo Ahava has a good introduction to customTask: https://www.simoahava.com/analytics/customtask-the-guide/ – florian May 19 '21 at 09:06
  • Also, you can just send Universal Analytics hits with the 'storage' field set to 'none' (in GTM, use the 'Fields to set' menu in tags or in GA settings variable). This will just collect page-scope data without setting up any cookies. (This is actually much simpler than manipulating consent mode with customTask) – florian May 19 '21 at 09:08
  • Yup, I know Simo's blog, but gcs (or similar) parameter is not documented in G's reference https://developers.google.com/analytics/devguides/collection/analyticsjs/field-reference . And "blind" modification by model.set('gcs', 'G101') does nothing. True concernign UA vs GA4, but I have to go with GA4. – Lukáš Řádek May 20 '21 at 11:18
  • With GA4, I don't think you can go cookieless (unless with Consent Mode). So, no luck. – florian May 22 '21 at 19:40
  • @LukášŘádek - I came across [this](https://support.google.com/analytics/thread/104505089?hl=en) question in Google Analytics' help, where the writer says that `gcs=G111` is the value that is sent when consent is granted – pinkasey Oct 12 '22 at 10:25
  • also, I've found this neat reference to what G111 means: https://www.thyngster.com/ga4-measurement-protocol-cheatsheet/ – pinkasey Oct 12 '22 at 10:31
0

Currently (beta) with analytics_storage denied Google Analytics will not use the _ga cookie to identify the user, even if already present in the browser, but will associate a temporary identifier that only exists on the current page. This guarantees the non-traceability of navigation however, despite the interactions being sent to the Google Analytics servers, the data set in question, characterized by a parameter that identifies the consent method, is not currently collected / exposed in the reports.

Anyway GA4 always sets IP anonymization by default, so this thing doesn't need to be managed.

Michele Pisani
  • 13,567
  • 3
  • 25
  • 42
  • Then why do I see it working for others on multiple videos? https://youtu.be/g3ovxQY87dM?t=150 https://youtu.be/U4Z47s0W1W8?t=473 – Phil15 Nov 22 '20 at 18:10