Skip to Content
Platform.Ontology

Google tag (gtag.js)

Google's page script for analytics and ads; sets IDs like _ga and _gcl_au in the browser.

Used to track youTracking across apps and sitesAd pixelsWeb browsersWhile you use itAfter you leave the site

In one line

Can tell Google about your visits and actions on a site that uses the tag

Google's page script for analytics and ads; sets IDs like _ga and _gcl_au in the browser.

_ga (2 years, capped at 400 days in Chrome) joins visits into one user, _gid lasts 24 hours, _gcl_au 90 days for ad conversions. Consent Mode v2 changes what is sent if the person declines.

What it can and can't do

What the user does: Nothing. It happens when you open a page with the Google tag

It can

  • Set IDs such as _ga and _gcl_au in your browser
  • Report page views, clicks and purchases to Google
  • Link visits over time with the same ID
  • Feed Google Analytics and Google Ads

It cannot

  • Run on sites that do not include the tag
  • See other sites unless they also use it
  • Keep the ID if you clear cookies or block the script
  • Know your name unless you sign in to Google or the site shares it

How it differs between platforms: Safari and Firefox limit how long some of its cookies last. Chrome keeps them for longer.

Browser support

BrowserStatusFirst versionReleasedNote
ChromeSupported12008-12-11Script runs in any browser, cookie lifetimes vary
EdgeSupported1Not listedScript runs in any browser, cookie lifetimes vary
FirefoxSupported12004-11-09Script runs in any browser, cookie lifetimes vary
SafariSupported12003-06-23Script runs in any browser, cookie lifetimes vary
Safari on iPhoneSupported12007-06-29Script runs in any browser, cookie lifetimes vary
Chrome on AndroidSupported1Not listedScript runs in any browser, cookie lifetimes vary
Samsung InternetSupported12013-04-27Script runs in any browser, cookie lifetimes vary

How a site asks for it

APIgtag('event', ...); requests to google-analytics.com/g/collect
How access is grantednone
What the user seesNone
Needs a secure context (HTTPS)No
Needs a user gestureNo
How long it lasts_ga about 2 years (400 days in Chrome), _gid 24 hours, _gcl_au 90 days
How to take it backClear site data, browser privacy settings
Inside an iframeNot listed

Data you get

What comes back: Analytics events
Shape: event
How often: per action

No individual data fields. The signal is the access itself.

Technical limits

  • Safari caps JS set cookies at 7 days
  • Consent Mode modelling fills gaps for declined users
  • Blocked by many blockers

The story

What it is

Google's page script for analytics and ads that sets IDs in your browser.

For you

You do not see the script. It sets small files like _ga that tell Google you are the same visitor, and counts what you do. If you decline cookies, Consent Mode can still send limited signals.

For makers

The Google tag is the base for Analytics and Google Ads on a large share of the web. It counts visits, sales and ad clicks in one tool. Consent Mode lets sites model results when people say no.

Where you see it

TypeExampleApps
analyticsA blog owner sees how many people visited today, which pages they read and where they came from.Google Analytics
adsA shop sees which Google ad made each sale, using the _gcl cookies and click IDs.Google Ads
gamesA browser game site sees how many players come from a search, and how long they stay.CrazyGames, Poki
shoppingA retailer builds a remarketing list of people who looked at a product.Shopify, Wayfair
mediaA news site measures which stories keep readers longest, to decide what to write.BBC, The Guardian
securityConsent Mode sends pings with no cookies if a person declines, which Google uses to model the missing data.None named

Risks

  • Follows you across visits
  • Google sees data from huge number of sites

What the platform says

Good uses and abuse

Legitimate uses

  • Analytics, conversion measurement

Known abuse

  • Cross-site ad profiles and remarketing lists

Scores

ScoreValueMeaning
Sensitivity4 of 5How revealing the data is
Utility5 of 5How useful it is to honest apps
Friction0 of 5How much the user has to do
Fingerprint bitsNot ratedRough identifying entropy, when known

History

  • 2023-07, all: Universal Analytics stopped processing; GA4 only
  • 2023-11, all: Consent Mode v2 required for EEA ad personalisation from Mar 2024

Sources

How well checked: Based on official documentation.

On this page