What is the Google tag (gtag.js)? Definition and how it works
Published November 13, 2026
The Google tag, also called gtag.js, is a single script that sends data to Google Analytics, Google Ads and other Google products. Here is what it does, what is documented, and what it means for consent.
gtag.js, now called the Google tag, is a single JavaScript tag you add to your website so that it can send data to Google measurement and advertising products. Google's own documentation describes it as "a single tag you can add to your website to use Google measurement and advertising products" and lists Google Ads, Google Analytics, Campaign Manager, Display & Video 360 and Search Ads 360 among them (Google tag documentation).
What does the Google tag actually do?
The tag loads from Google's servers, receives events from your page and forwards them to the destinations you configured. Each destination is identified by a tag ID. Google's reference lists the forms G-XXXXXX for Google Analytics, AW-YYYYYY for Google Ads and GT-XXXXXX, and says the ID tells the tag where to send event data (gtag.js reference).
In practice, one installed tag can serve several tools at once: a page view going to Google Analytics, a conversion going to Google Ads. That is why many sites have it even if nobody chose it on purpose, for example because a plugin or a theme added it.
How is it installed?
The documented route is to paste a snippet near the top of the <head> of each page. The snippet loads the script from Google's domain with your tag ID and initialises window.dataLayer. Google's documentation also says the older gtag('config') pattern is deprecated in default installation snippets, while existing snippets keep working. Two Google pages show slightly different snippets, so copy the one Google gives you for your account rather than from a blog post.
Is it the same as Google Tag Manager?
Not exactly, but they are related. Google recommends using Google Tag Manager to set up and deploy tags, and states that all Google tags (gtag.js) were upgraded to include Tag Manager capabilities, so sites that only use gtag.js can use interface-driven tagging, debugging and version control. Existing gtag.js setups continue to be supported.
What is documented, and what is not?
Documented by Google:
- The tag sends data to the products named above, based on the tag IDs you configure.
- It supports consent commands:
gtag('consent', 'default', ...)should run on every page before any command that sends measurement data, andupdatesends the visitor's choice later. The parameters aread_storage,ad_user_data,ad_personalizationandanalytics_storage, each set tograntedordenied(consent guide). - When
ad_storageis denied, new advertising cookies are not set for advertising purposes. - Consent mode does not save the visitor's choice: your site must store it.
- If the consent code runs out of order, the defaults do not work.
Not stated on those pages: which cookie names the tag sets and for how long. For that, see our explainers on the _ga cookie and the _gcl_au cookie, and on Google Consent Mode.
What does it mean in practice?
Adding the Google tag is not neutral for privacy. Whether a site needs the visitor's consent for it depends on the products used, the settings and the country, and the site owner stays responsible. If you only need audience numbers, a cookieless tool is an alternative: see how Klickbee compares with Google Analytics 4. Klickbee is a cookieless analytics tool made in France that installs with a script tag or an npm package, and its free plan lets you test it on one site: sign up here.
This is information, not legal advice.
FAQ
Is gtag.js the same as Google Analytics?
No. gtag.js is the tag that sends data. Google Analytics is one of the products that can receive it, alongside Google Ads and others.
Do I still need gtag.js if I use Google Tag Manager?
Google recommends Tag Manager to deploy tags, and says its tags now include Tag Manager capabilities. Check your own setup to avoid loading the tag twice.