使用 SameSite 和 Secure 属性设置 Google Tag Manager cookie [英] Setting Google Tag Manager cookies with SameSite and Secure attributes
问题描述
Chrome 报告以下警告:
Chrome is reporting the following warning:
与 https://www.googletagmanager.com/ 上的跨站点资源相关联的 cookie 是设置没有 SameSite
属性.如果使用 SameSite=None
和 Secure
进行设置,Chrome 的未来版本将仅提供具有跨站点请求的 cookie.您可以在应用程序>存储>Cookies 下的开发人员工具中查看 cookie,并在 https://www.chromestatus 上查看更多详细信息.com/feature/5088147346030592 和 https://www.chromestatus.com/feature/5633521622188032.
A cookie associated with a cross-site resource at https://www.googletagmanager.com/ was set without the
SameSite
attribute. A future release of Chrome will only deliver cookies with cross-site requests if they are set withSameSite=None
andSecure
. You can review cookies in developer tools under Application>Storage>Cookies and see more details at https://www.chromestatus.com/feature/5088147346030592 and https://www.chromestatus.com/feature/5633521622188032.
我有两个此类警告.我看到的三个 cookie 是 gtm_auth
、gtm_preview
和 gtm_debug
.所有会话 cookie.我看到 gtm_auth
设置了 Secure
属性(SameSite
属性为空).其他两个 cookie 没有设置任何一个属性.
I have two warnings of this type. The three cookies I see are gtm_auth
, gtm_preview
, and gtm_debug
. All session cookies. I see gtm_auth
is set with Secure
attribute (SameSite
attribute is empty). The other two cookies do not have either attribute set.
顺便说一下,它们被归类为分析 cookie,而不是营销 cookie.
They are classified as analytical cookies, not marketing cookies, by the way.
使用 Google Tag Manager
,我该如何设置或修改这些 cookie?我不想在我的代码中更新 cookie.我想使用 Google Tag Manager
添加 cookie 属性应该是可行的.对于如何使用 Google Analytics
和 Google Tag Manager
解决这个问题,Google 的立场是什么?
Using Google Tag Manager
, how do I set or modify these cookies? I'm not looking to update the cookies in my code. I imagine adding cookie attributes should be doable using Google Tag Manager
. What is Google's stance on how to address this with Google Analytics
and Google Tag Manager
?
推荐答案
对于这些警告中的任何一个,如果您不负责域,则您不负责更新 cookie.Google 跟踪代码管理器团队将负责更新为 googletagmanager.com
中的 cookie 设置 SameSite
属性的相关代码.
For any of these warnings, if you are not responsible for the domain then you are not responsible for updating the cookies. The Google Tag Manager team will be responsible for updating the relevant code that sets the SameSite
attributes for cookies from googletagmanager.com
.
此时,警告纯粹是提供信息,不会影响功能.计划在 M80 之前在稳定的 Chrome 中强制执行此行为,目前目标是 2020 年 2 月.
At this point, the warnings are purely informational and are not impacting functionality. Enforcing this behaviour in stable Chrome is not scheduled until M80, currently targeted for Feb 2020.
这篇关于使用 SameSite 和 Secure 属性设置 Google Tag Manager cookie的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!