Setup and install Tag Manager
- Create an account, or use an existing account, at tagmanager.google.com. (A new container is created by default, and you can create additional containers within each account.)
- Install the container in your website or mobile app.
- Add and publish your tags.
A Tag Manager account represents the topmost level of organization. Typically, only one account is needed per company. A Tag Manager account contains one or more containers, and there are specific container types that may be used for websites, AMP pages, Android apps, and iOS apps.
Create a new account and container
- In Tag Manager, click Accounts Create account.
- Enter an account name and optionally indicate whether you'd like to share data anonymously with Google and others.
- Click Continue.
- Enter a descriptive container name and select the type of content: Web, AMP, Android, or iOS. If setting up a mobile container, select whether you're using the Firebase SDK or one of the legacy SDKs.
- Click Create.
- Review the Terms of Service and click Yes if you agree to those terms.
When your new container first loads, you will be prompted with the web container installation code snippet, or to get started with Tag Manager as part of the SDK for your chosen mobile platform. You can install your code snippets now, or click OK to clear this dialog. You can always set up your container first and install the container snippet or SDK later.
Add a new container to an existing account
- In Tag Manager, click Accounts next to the relevant account name.
- Choose Create Container.
- Repeat steps 4–6, listed above.
Install the container
- In Tag Manager, click Workspace.
- Near the top of the window, find your container ID, formatted as "GTM-XXXXXX".
- Click your container ID to launch the Install Tag Manager box.
- Copy and paste the code snippets into your website as instructed in the Install Tag Manager box, or download and install the appropriate mobile SDK. See below for tips on web, AMP, and mobile installation.
- Place the
<script>code snippet in the
<head>of your web page's HTML output, preferably as close to the opening
<head>tag as possible, but below any dataLayer declarations.
- Place the
<noscript>code snippet immediately after the <body> tag in your HTML output.
To ensure that tags do not fire twice, remove from your code any hardcoded tags that have been migrated to your Tag Manager container.
To help protect your container from 3rd party snooping, the Tag Manager web page snippet uses HTTPS by default.
If you have reason to deploy your Tag Manager containers in a way that supports non-secure pages, you may do so by adjusting the source URL protocol in your container snippet to
// instead of
https://. Learn more about using protocol-relative URLs.
- Place the
- Place the
<amp-analytics>section immediately after the opening
Add, update and publish tags
Now that a container is installed, you're ready to add new tags.
- Click Tags from the navigation menu.
- To add a tag: Click New. Select the tag type and specify triggers for when the tag should fire.
- To edit a tag: Click a tag in the list and make changes on the "Edit Tag" page. For example, you might update the triggers for when the tag should fire.
- To delete a tag: Click a tag in the list. On the "Edit Tag" page, click the menu in the upper right corner of the screen and choose Delete.
- Preview mode gives you an opportunity to inspect your Tag Manager configuration on your site or app to make sure everything behaves as expected. On the web, you can use the debug option to see which tags fire as you browse and interact with the site.
- When you're ready, click Submit in the upper-right corner of the screen to begin publishing your changes. Add details such as a Version Name and Version description, then click Publish.