#

Google Tag Manager Logo

Google Tag Manager

Manage all your website's tags in one place.

SIGN UP

Tag management made easy. Google Tag Manager delivers simple, reliable, easily integrated tag management solutions - for free.

# Prerequisites

# Install GTM on your Website

  1. Go to Google Tag Manager and login to your account. If you don't have one, create a new account.

  2. Set up a container for your website (e.g., "www.example.com").

  3. After creating the container, Google Tag Manager will provide you with two code snippets: one for the section and another for the section of your website.

  4. Add the GTM Code to Your Website.

Copy snippet in head tag

  1. Copy the first code snippet.

GTM snippet code

  1. Navigate to the CMS and select the website where you want to add GTM to.

  2. Click on Update Website.

Update Website CMS

  1. Navigate to the Meta Information tab.

CMS Meta Information Tab

  1. Paste the code snippet on the Global Header Insert textarea.

CMS Global Header Insert Textarea

  1. Click Submit.

Copy snippet in body tag

  1. Copy the second code snippet.

GTM snippet code

  1. Go to the file that serves as your base template.

CMS base template in the left nav

  1. Paste the code snippet at the top of the file.

CMS base template with analytics snippet

  1. Click Publish.

CMS publish button

Copy snippet in head tag

  1. Copy the first code snippet.

GTM snippet code

  1. Log in to your WordPress Dashboard.

  2. Navigate to Tools and then to Theme File Editor.

WordPress Theme File Editor

  1. Paste the code snippet in the header.php file.

CMS Meta Information Tab

  1. Click Update File.

Copy snippet in body tag

  1. Copy the second code snippet.

GTM snippet code

  1. Paste the code snippet in the footer.php file.

CMS base template with analytics snippet

  1. Click Update File.

Copy snippet in head tag

  1. Copy the first code snippet.

GTM snippet code

  1. Log in to your Drupal Admin Dashboard.

  2. Navigate to Admin and then to Appearance to find your active theme.

  1. Find the html.html.twig file in your active theme directory (e.g., /themes/custom/[your-theme-name]/templates/).
  1. Paste the code snippet in the html.html.twig file immediately before the closing </head> tag.

Copy snippet in body tag

  1. Copy the second code snippet.

GTM snippet code

  1. Paste the code snippet in the html.html.twig file immediately after the opening <body> tag.

  2. Clear your Drupal cache by navigating to Configuration > Performance and clicking Clear All Caches.

  1. Use the "Preview" mode in Google Tag Manager to check if the tags are firing correctly, or use the Google Tag Assistant extension in your browser to verify the installation.