简体   繁体   English

Google Analytics 同意模式(测试版)- 发送数据但未反映在仪表板上

[英]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我想按照此官方指南使用符合 gdpr 的新分析同意模式

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:但是,如果我在如下设置中拒绝 cookie,则不再有效(仪表板上没有用户活动):

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

My understanding is that it should still reflect page hits without the cookie.我的理解是它仍然应该反映没有 cookie 的页面点击量。

I can see the POST request being sent to their go server with status 204.我可以看到 POST 请求被发送到他们的 go 服务器,状态为 204。

What am I doing wrong?我究竟做错了什么?

The hits with 'analytics_storage' set to 'denied' are not shown in GA reports at all now. 'analytics_storage'设置为'denied'现在根本不显示在 GA 报告中。 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).话虽如此,可以使用 customTask API 操作请求并重写 'gcs' 参数(或完全删除它)。 This way, you would see the anonymized (on user level) hits in GA while not using cookies.这样,您将在不使用 cookie 的情况下在 GA 中看到匿名(在用户级别)点击。

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.目前(测试版)与 analytics_storage 被拒绝 Google Analytics 不会使用 _ga cookie 来识别用户,即使已经存在于浏览器中,但会关联一个仅存在于当前页面上的临时标识符。 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.这保证了导航的不可追溯性,尽管交互被发送到 Google Analytics 服务器,但当前未在报告中收集/公开以标识同意方法的参数为特征的相关数据集。

Anyway GA4 always sets IP anonymization by default, so this thing doesn't need to be managed.反正GA4总是默认设置IP匿名化,所以这个东西不用管。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM