Installing Google Tag Manager (GTM) on your website allows you to manage and deploy various tracking and marketing tags without modifying your website’s code directly. Here’s a step-by-step guide to installing GTM on your website:
Table of Contents
Toggle1. Sign in to Google Tag Manager:
- Navigate to the Google Tag Manager website (tagmanager.google.com) and sign in with your Google account. If you don’t have one, you’ll need to create it.
2. Create an Account and Container:
- If you’re setting up GTM for the first time, you’ll need to create an account and container. Follow the instructions provided earlier in this conversation under “How to create and configure your first container in Google Tag Manager.”
3. Get the GTM Snippet:
Once you’ve created your container, Google Tag Manager will provide you with a snippet of code. This snippet needs to be added to every page of your website. Here’s how to get the snippet:
- In the GTM interface, click on the Admin tab (the gear icon) at the top right corner.
- In the Container section, click on “Install Google Tag Manager.”
- You’ll see two code snippets: one for the
<head>
section of your website and one for the<body>
section. Copy both snippets.
4. Paste the Snippets into Your Website’s Code:
Now, you need to add the copied snippets to your website’s HTML code. Here’s how to do it:
a. Head Section Snippet:
- Paste the first snippet just after the opening
<head>
tag in the HTML code of every page of your website. This snippet typically includes your GTM container ID.
b. Body Section Snippet:
- Paste the second snippet just after the opening
<body>
tag in the HTML code of every page of your website.
5. Verify Installation:
- After adding the GTM snippets to your website’s code, it’s essential to verify that they’re working correctly. You can use tools like Google Tag Assistant or enable Preview mode within Google Tag Manager to verify the installation.
6. Test:
- Before going live, thoroughly test your GTM setup to ensure that tags, triggers, and variables are working as expected. You can use Preview mode within GTM to test your configurations before publishing them live.
7. Publish Container:
- Once you’ve verified and tested your GTM setup, it’s time to publish your container. Click on the “Submit” button in the top right corner of the GTM interface, enter a version name and description for your changes, then click “Publish.”
That’s it! You’ve successfully installed Google Tag Manager on your website, and you can now start managing and deploying various tracking and marketing tags with ease.