cookiesbrowsergoogle-analytics

Google Analytics cookie domain


I have noticed that my application contains more than one _ga cookie.

There are two _ga cookies with these configuration domain:

  1. Value = GA1.1.563684360.1681907587 | Domain = analytics.google.com

  2. Value = GA1.2.334704501.1681907797 | Domain = mysite.com (TLD)

We are using GA 3 and GA4 at the same time.

My questions are:

  1. Why do I have 2 _ga cookies?
  2. What is the correct domain for _ga cookie, mysite.com (my TLD domain) or analytics.google.com?

Solution

  • With GA4, per Google's documentation, there will be 2 different cookies dropped: _ga and _ga_[container id].

    I suspect the reason there are two different _ga cookies is due to both UA and GA4 being used on your site. I would recommend removing the UA tracking due to the sunsetting of the product in July 2023 and it, more than likely, not processing any more data.

    As far as the correct domain, your TLD should be the one listed for the cookie.