This document provides an overview of the Google tag (gtag.js) and Tag Manager and when to use one over the other one on a website. If you are setting up Google Analytics on an app, also see the Firebase documentation.
The Google tag (gtag.js) and Tag Manager provide two different, fully supported methods to collect data from a website and send the data to Google advertisement and measurement products like Google Analytics.
The Google tag (gtag.js)
The Google tag is a single snippet of code that you paste in the
library called gtag.js. When you want to collect additional data from your
Learn more about the Google tag
Google Tag Manager
Google Tag Manager is a tag management system by Google. To use Tag Manager, you
need to add two snippets of code to your website HTML code — one in the
<head> HTML tag and one at the top of the
<body> HTML tag.
Differences between gtag.js and Tag Manager
Consider using Tag Manager if you need:
- The ability to deploy and modify both Google and 3rd party tags
- The ability to deploy and modify tags for both web and mobile apps
- The ability to deploy and modify tags on the fly from a web interface
- Collaboration and versioning capabilities
Consider using gtag.js if you are unable to use Tag Manager, or the following capabilities are important to you:
- The ability to install tags directly on your site, without the ramp-up time of setting up a tag management system