
Will Everett
Dec 4, 2024
This step-by-step guide will walk you through the process of setting up Google Tag Manager for your website.
Step 1: Create a Google Tag Manager Account
Sign In to Google Tag Manager
Visit the Google Tag Manager website and sign in with your Google account. If you don't have a Google account, you'll need to create one.
Create a New Account
Once signed in, click on the "Create Account" button.
Enter your account name, typically your company or website name.
Select your country from the dropdown menu.
Set Up a Container
A container holds all the tags for your website. Enter a name for your container, usually your website's name.
Choose where you want to use the container (Web, iOS, Android, or AMP). For most websites, you'll select "Web."
Click "Create."
Agree to Terms of Service
Read and accept the Google Tag Manager Terms of Service Agreement.
Click "Yes" to create your account and container.
Step 2: Install Google Tag Manager on Your Website
Get the Container Code
After creating your container, Google Tag Manager will provide you with two code snippets: one for the <head> section and one for the <body> section of your website.
Add the Code to Your Website
Head Section: Copy the first code snippet and paste it as close to the opening <head> tag as possible on every page of your website.
Body Section: Copy the second code snippet and paste it immediately after the opening <body> tag on every page of your website.
If you’re using a content management system (CMS) like WordPress, you can add these snippets through the theme settings or by using a plugin designed for adding scripts to the header and body sections.
Verify Installation
After adding the code snippets to your website, save your changes and publish them. To verify the installation, go back to Google Tag Manager, click on “Submit” in the top right corner, and then “Publish.” This will make the container active on your site.
Step 3: Set Up Tags, Triggers, and Variables
Understanding Tags, Triggers, and Variables
Tags: Snippets of code or tracking pixels that collect and send data to third-party services (e.g., Google Analytics, Facebook Pixel).
Triggers: Rules that define when and where tags should be executed (e.g., page views, button clicks).
Variables: Placeholders for values that GTM can use in tags and triggers (e.g., Page URL, Click ID).
Creating Your First Tag
Add a New Tag: In the GTM dashboard, click on “Tags” in the left-hand menu, then click “New.”
Configure Your Tag: Click on “Tag Configuration” and select the type of tag you want to create (e.g., Google Analytics, AdWords Conversion Tracking).
Set Up Tag Details: Enter the required details for your tag, such as the tracking ID for Google Analytics.
Add a Trigger: Click on “Triggering” and select an existing trigger or create a new one (e.g., All Pages, Clicks, Form Submissions).
Save Your Tag: Once configured, click “Save” to add your tag to the container.
Creating Triggers
Add a New Trigger: Click on “Triggers” in the left-hand menu, then click “New.”
Configure Your Trigger: Click on “Trigger Configuration” and choose the type of trigger (e.g., Page View, Click, Form Submission).
Define Trigger Conditions: Set the conditions that will fire the trigger (e.g., when a page URL contains a specific keyword).
Save Your Trigger: Once configured, click “Save” to add your trigger to the container.
Creating Variables
Add a New Variable: Click on “Variables” in the left-hand menu, then click “New.”
Configure Your Variable: Click on “Variable Configuration” and choose the type of variable (e.g., Built-In Variable, User-Defined Variable).
Set Variable Details: Enter the details required for your variable (e.g., JavaScript variable name, Data Layer variable name).
Save Your Variable: Once configured, click “Save” to add your variable to the container.
Step 4: Testing and Debugging
Preview Mode
Before publishing your tags, use GTM’s Preview mode to test them. Click on “Preview” in the top right corner of the GTM dashboard.
Open your website in a new tab or window. GTM’s debug console will appear at the bottom, showing which tags are firing and any errors.
Testing Tags
Navigate through your website and perform actions that should trigger your tags (e.g., visiting a page, clicking a button).
Verify in the debug console that the correct tags are firing as expected.
Debugging Issues
If tags are not firing as expected, use the debug console to identify and troubleshoot issues. Common problems include incorrect trigger conditions, missing variables, or syntax errors in custom HTML tags.
Step 5: Publishing Your Container
Submit and Publish
Once you’ve tested your tags and confirmed they’re working correctly, return to the GTM dashboard.
Click on “Submit” in the top right corner, then click “Publish.” This will make your container live on your website.
Version Control
GTM keeps track of all changes made to your container, allowing you to create new versions and roll back to previous versions if needed. This ensures you can manage updates and changes without disrupting your tracking setup.
Setting up Google Tag Manager for your website is a straightforward process that offers significant benefits for managing and deploying marketing tags. By following this step-by-step guide, you can streamline your tag management, improve data accuracy, and enhance website performance. With GTM, you’ll have greater control over your tracking setup, enabling you to make informed decisions and optimize your marketing efforts effectively. Start using Google Tag Manager today and take your digital marketing strategy to the next level.