Installing Google Tag Manager (GTM) on your website is a straightforward process that enables you to manage and deploy marketing tags without editing code directly on your website. Here’s a step-by-step guide to help you install GTM effectively:
Step 1: Create a Google Tag Manager Account
If you haven’t created a GTM account yet, follow these steps:
- Sign In: Go to the Google Tag Manager website and log in with your Google account.
- Create Account:
- Click on Create Account.
- Enter your Account Name (usually your business or website name).
- Select your Country from the dropdown.
- Container Setup:
- Enter a Container Name (typically the name of your website).
- Choose where to use the container:
- Web (for websites)
- iOS (for mobile apps)
- Android (for mobile apps)
- AMP (for Accelerated Mobile Pages)
- Click “Create” to proceed.
Step 2: Accept the Terms of Service
- Read the Terms: Review Google Tag Manager’s Terms of Service.
- Accept Terms: Check the box to agree to the terms and click Yes.
Step 3: Get Your GTM Code Snippet
After creating your account and container, GTM will provide you with two code snippets:
- Copy the Snippets: You will see two pieces of code:
- The first snippet is to be placed in the
<head>
section of your HTML. - The second snippet should be placed immediately after the opening
<body>
tag.
- The first snippet is to be placed in the
Step 4: Install the GTM Snippet on Your Website
For HTML Websites
- Access Your Website’s Code:
- Use a code editor or your website’s content management system (CMS) to access the HTML files.
- Insert the Code:
- Paste the first GTM snippet inside the
<head>
section of your HTML file. - Paste the second GTM snippet immediately after the opening
<body>
tag.
- Paste the first GTM snippet inside the
- Save Your Changes: After adding the snippets, save the changes to your HTML file.
For WordPress Websites
- Using a Plugin:
- Install a plugin like Insert Headers and Footers or Header and Footer Scripts.
- Navigate to the plugin settings and paste the first GTM snippet in the Header section.
- Paste the second snippet in the Body or footer section (if required by the plugin).
- Save your settings.
- Editing Theme Files (Alternative):
- Go to your WordPress Dashboard, then to Appearance > Theme Editor.
- Locate the header.php file and paste the first snippet before the closing
</head>
tag. - Locate the footer.php file and paste the second snippet immediately after the opening
<body>
tag (if needed). - Update the files.
For Other CMS Platforms
If you’re using another CMS (like Shopify, Wix, or Squarespace), you can often find specific instructions on how to add custom scripts in their help sections or support documentation. Most platforms allow you to add code in the settings or theme customization areas.
Step 5: Verify Your Installation
- Open Google Tag Manager: Go back to your GTM account.
- Enable Preview Mode:
- Click the Preview button in the top right corner of the GTM interface.
- Visit Your Website: Open your website in a new tab. You should see the GTM Debug console at the bottom of the page, confirming that GTM is functioning correctly.
Step 6: Publish Your Container
After verifying the installation:
- Go to the GTM Dashboard.
- Click on Submit in the top right corner.
- Add a Version Name and Description (optional), then click Publish.
Step 7: Add Tags (Optional)
Now that GTM is installed, you can start adding tags to your container:
- Click on Tags in the left sidebar.
- Click on New to create a new tag.
- Select the type of tag (e.g., Google Analytics, AdWords).
- Configure the tag and set triggers.
- Save your changes.
Conclusion
Installing Google Tag Manager on your website allows you to manage tags efficiently, without needing to modify your site’s code for every new tag. By following these steps, you’ll have GTM set up and ready to enhance your website’s tracking and marketing capabilities. Be sure to regularly check your GTM container and update tags as needed to reflect your changing business needs and analytics goals.