Tom
Tom

Reputation: 34366

Varnish and Google Analytics

I don't quite understand how Google Analytics cookies work with Varnish.

Upvotes: 8

Views: 5974

Answers (1)

kern
kern

Reputation: 106

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.

Upvotes: 6

Related Questions