Dimensions and metrics

[GA4] Cookie usage on websites

This article is about cookies usage for Google Analytics 4 properties. To learn about cookies for Universal Analytics, see this article instead.

The GA4 JavaScript tags use first-party cookies to distinguish unique users as well as unique sessions from a single user. These libraries do not require you to set cookies to transmit data to Google Analytics.

Browsers enforce limitations on the lifespan of first-party cookies if a user does not make a return visit (maximum of 400 days for Chrome and 7 days for Safari).

GA4 cookies

The following table describes each cookie set by GA4 JavaScript tags. To learn more about the data that Analytics collects, see Safeguarding your data.

Cookie name Default expiration time Description
_ga 2 years Used to distinguish users.
_ga_<container-id> 2 years Used to persist session state.

 

When linked to a Google Ads account, GA4 JavaScript tags set additional cookies used to provide Google Ads with a more reliable way to measure interactions customers have with your business. For more details on these cookies, see Our advertising and measurement cookies.

To override default cookie expiration and cookie update settings:

  1. In Admin, under Data collection and modification, click Data streams.
    Note: The previous link opens to the last Analytics property you accessed. You can change the property using the property selector. You must be an Editor or above at the property level to change default cookie settings.
  2. Click the data stream for your website, then under Google tag, click Configure tag settings.
  3. Under Settings, click Show all.
  4. Click Override cookie settings.
  5. Select the Override default cookie settings checkbox.
  6. Under Cookie expiration select how long before cookies expire (from immediately to 25 months).
  7. Under Cookie update select either Set cookie expiration time relative to most recent visit or Set cookie expiration time relative to first visit.
  8. Click Save.

If you need to customize additional cookie settings, see Cookies and user identification.

Cookie settings configured using the global site tag or Google Tag Manager override settings configured in the Analytics interface.

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
3905104712131393482
true
Search Help Center
true
true
true
true
true
69256
true
false