Varnish 和 Google Analytics
我不太明白 Google Analytics cookie 如何与 Varnish 配合使用。
- 包含 GA cookie 的页面不会被缓存吗?
- 我需要删除vcl_recv中的GA Cooke吗?
- 如果我删除它们,GA 会停止跟踪访问者吗?
I don't quite understand how Google Analytics cookies work with Varnish.
- Do pages that contain GA cookie not get cached?
- Do I need to remove the GA cooke in vcl_recv?
- If I do remove them, does that stop GA tracking visitors?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果未设置 Vary 标头,Cookie 会使缓存失效。例如,访问具有特定登录 cookie 的 URL 的客户端将收到与具有不同 cookie 的客户端不同的页面。
为了缓存具有不影响页面缓存能力的 cookie 的页面(例如,静态站点上的 Google Analytics),必须删除 cookie,否则缓存将不知道是否应将两个页面视为相同的资源。
Cookies invalidate the cache if the Vary header is not set. For example, a client that goes to a URL with a certain login cookie will receive a different page than a client with a different cookie.
In order to cache a page that has cookies that do not affect the cache-ability of the page (for example, Google Analytics on static sites), the cookies must be stripped or the cache won't know whether two pages should be considered the same resource.