Adsense/Analytics First Party Cookie with cache everything

Hi,

Google adsense set First part cookie __gads and same with Google Analytics _ga. They both are saved under domain name. If I use cache everything on Cloudflare, will it cache those cookie as well?

(In case of third party cookie or script I know they wont be cached).

To see this thing in real life. I have Cloudflare busines plan on one domain. I enabled cache everything and enabled bypass cache on cookie and add _ga|__gads in it. All the pages are now serving as cf-cache-status: DYNAMIC.

How to get rid of this situation. I do not want to cache adsense and analytics cookie at all at Cloudflare.

Unless you are processing those cookies on your Origin server (which you generally do not do), there is no need to use Bypass Cache on Cookie.

The Cache needs to be aware of Cookies in two situations. The first is where you need to see each individual users Cookie on the incoming Request so that Origin can do something (such as making a decision or logging the Cookie value). The second is where your Origin is sending a Set-Cookie Response header that should not be cached and send to each user. I suspect neither is relevant to your situation.

michael,

But caching a ad cookie really mess up with entire ad eco system.

Caching a Set-Cookie header in a response and delivering that to everybody from the cache would probably be a disaster for lots of things.

However, if the Response from your Origin is the same for all users without reference to the Cookie Request header, then the client performance will be better by allowing that asset to be cached. In return you will (apparently) make more money!

In a default configuration, the Cookie request header is not part of the cache key, and it is not served to other users from the cache.

This situation is no different to other common Header vs Cache areas. Consider the Accept-Language Request header. Most Origin servers do not use it to make decisions about the response, so caching Responses that are made as a result of a request with the Accept-Language header is not an issue. But if the Origin does use that header to serve different languages then blindly caching the response will result in undesirable behaviour.

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.