How to install Google Tag Manager on your website

Author:

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:

  1. Sign In: Go to the Google Tag Manager website and log in with your Google account.
  2. Create Account:
    • Click on Create Account.
    • Enter your Account Name (usually your business or website name).
    • Select your Country from the dropdown.
  3. 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)
  4. Click “Create” to proceed.

Step 2: Accept the Terms of Service

  1. Read the Terms: Review Google Tag Manager’s Terms of Service.
  2. 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:

  1. 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.

Step 4: Install the GTM Snippet on Your Website

For HTML Websites

  1. Access Your Website’s Code:
    • Use a code editor or your website’s content management system (CMS) to access the HTML files.
  2. 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.
  3. Save Your Changes: After adding the snippets, save the changes to your HTML file.

For WordPress Websites

  1. 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.
  2. 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

  1. Open Google Tag Manager: Go back to your GTM account.
  2. Enable Preview Mode:
    • Click the Preview button in the top right corner of the GTM interface.
  3. 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:

  1. Go to the GTM Dashboard.
  2. Click on Submit in the top right corner.
  3. 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:

  1. Click on Tags in the left sidebar.
  2. Click on New to create a new tag.
  3. Select the type of tag (e.g., Google Analytics, AdWords).
  4. Configure the tag and set triggers.
  5. 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.