To use measurement and advertising products such as Google Analytics, Ads conversion measurement, remarketing, and more, you add Google tags to your website. You can write tags in JavaScript, using the global site tag, or add them with configuration, using the graphical Google Tag Manager user interface. Tag Manager supports both websites and mobile apps. If you use Firebase to build mobile apps, an API is available to provide the required information to Google measurement and advertising products.
What is a "tag"?
What is the global site tag?
What is Google Tag Manager?
In Google documentation, global site tag examples consist of gtag.js
code,
while Tag Manager examples provide the steps necessary to configure tags.
Usage example
The following example illustrates the difference between use of the global site tag and Tag Manager. This global site tag shows a snippet that you could add to each page of your website to enable Google Analytics:
<script async
src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID">
</script>
<script>
window.dataLayer = window.dataLayer || [] ;
function gtag(){dataLayer.push(arguments);}
gtag( 'js', new Date () ) ;
gtag( 'config', 'GA_TRACKING_ID');
</script>
Then to enable conversion tracking for Google Ads, add the
following in the global site tag on each page: gtag( 'config', 'AW-
CONVERSION_ID');
:
<script async
src="https://www.googletagmanager.com/gtag/js?id=GA_TRACKING_ID">
</script>
<script>
window.dataLayer = window.dataLayer || [] ;
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date ()) ;
gtag('config', 'GA_TRACKING_ID');
gtag('config', 'AW- CONVERSION_ID');
</script>
To use Tag Manager to enable measurement of ads conversions, you can enable the same functionality as the above example by configuring a tag in the Tag Manager user interface and publishing it with one click to all pages of a website. See Google Ads conversions to learn more.
Tags supported by global site tag and Tag Manager
Global site tag and Tag Manager provide the following tag support:
Tag Type | gtag.js | Tag Manager |
---|---|---|
Google Analytics 4 | Yes | Yes |
Google Analytics: Universal Analytics | Yes | Yes |
Google Ads Conversions | Yes | Yes |
Google Ads Remarketing | Yes | Yes |
Floodlight | Yes | Yes |
Google Optimize | Yes | Yes |
Google Surveys Website Satisfaction | No | Yes |
Third-party tags | No | Yes |
In addition to the Google measurement products listed here, Tag Manager supports a wide variety of third-party tags. The Community Template Gallery contains additional tag and variable templates maintained by third parties. You can also create and share your own tags with custom templates.