gpt4 book ai didi

firefox - _ga 因 Firefox 中的无效域问题而被拒绝

转载 作者:行者123 更新时间:2023-12-05 05:54:09 24 4
gpt4 key购买 nike

我在此处指定的脚本中使用带有跟踪代码和 cookie_domain 的 ga() 命令队列 https://developers.google.com/analytics/devguides/collection/analyticsjs#the_google_analytics_tag

<!-- Google Analytics -->
<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','https://www.google-analytics.com/analytics.js','ga');

ga('create', 'UA-XXXXX-Y', '<site_name>');
ga('send', 'pageview');
</script>
<!-- End Google Analytics -->

但是,当我使用 Firefox 浏览器打开我的页面站点时,控制台会记录以下警告消息:

Cookie “_ga” will be soon rejected because it has the “sameSite” attribute set to “none” or an invalid value, without the “secure” attribute. To know more about the “sameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite

Cookie “_gid” will be soon rejected because it has the “sameSite” attribute set to “none” or an invalid value, without the “secure” attribute. To know more about the “sameSite“ attribute, read https://developer.mozilla.org/docs/Web/HTTP/Headers/Set-Cookie/SameSite

Cookie “_ga” has been rejected for invalid domain.
Cookie “_gid” has been rejected for invalid domain.

我该如何解决这个问题?

最佳答案

尝试使用这种配置:

ga('create', 'UA-XXXXX-Y', { 'cookieFlags': 'SameSite=None; Secure' });

有关“Cookie 和用户标识”的更多详细信息:https://developers.google.com/analytics/devguides/collection/analyticsjs/cookies-user-id

关于firefox - _ga 因 Firefox 中的无效域问题而被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/69702672/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com