Varnish 和 Google Analytics

发布于 2024-09-11 09:17:09 字数 165 浏览 4 评论 0原文

我不太明白 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

街角卖回忆 2024-09-18 09:17:09

如果未设置 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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文