Drupal Google Tag Manager, Analytics, & Search Console

Drupal Google Tag Manager, Analytics, & Search Console

Installing GTM to Drupal adds a layer of complexity, but it's far more flexible & powerful than GA4 alone.

About the Google Tag Manager Module

Even though installing Google Tag Manager (GTM) on your Drupal site adds a layer of complexity, it is far more flexible (and powerful) than Google Analytics (GA4) alone:

  • GTM can be set up to track advanced analytics, like Scroll Depth, Link Clicks, & Video Playback information.
  • GTM makes it easy to install custom tracking, like LinkedIn Insights or Facebook Pixel, without developer help.
  • GTM makes it easier to track transaction data, like order amount, which is essential for ROI calculations for your ad campaigns.

While not difficult, it does take a little time and effort to complete. Below are the steps we go through to do a Google Tag Manager install on a clients’ Drupal websites.

A NOTE OF CAUTION IF YOU ALREADY HAVE GOOGLE ANALYTICS INSTALLED
Except in very special cases, you do not want to have both the Google Analytics and Google Tag Manager modules (or embedded code snippets) enabled on your site at the same time -- it can skew your Analytics. We recommend coordinating the Google Tag Manager installation & configuration with disabling your Google Analytics module. Contact your developer if you have questions on how Google Analytics is currently installed on your website -- or if you have multiple GA4 codes deployed, which can complicate things further.

Google Account Sign Ups

While we offer top level instructions in this section, you may need to find additional resources on the exact steps for signing up for these accounts. Google tends to change things periodically, so it’s best to find their step by step instructions. We've included links to their current instructions in this section.

  1. If you don’t already have one, sign up for a free Google Account.
       
    This will include a Gmail account. If your company already uses Gmail for email, then you can use that Google Account. You’ll use this account for all the sign ups that follow.
  2.  Sign up for Google Analytics for your website. When you complete this process, you will have created a property for your website on the GA4 admin area. To find this in an already existing analytics account, from the Admin page, click Data Streams and select the specific site's data stream. There will be a measurement id there that looks something like this:

    G-XXXXXXXXXX
       
    We recommend opening a text editor and copying and pasting this measurement id so you have it handy for your GTM set up. You’ll be using that text document again later, so leave it open.
  3. Create a Google Search Console (GSC) account for your website. This account will track organic (search) traffic to your website and can also be integrated into your Google Analytics (GA4) account. We recommend using the Domain property type, but you may need to contact your web developers or other technical contacts since it required DNS verification

    For information on integrating GSC into your GA4 account, go here for their detailed instructions.
  4. Submit your website's XML Sitemap to Google by following Google's instructions.
  5. Set up your website’s Google Tag Manager account. Make sure to fill out the Account Name and Container name fields with your organization’s and website’s information, and select “Web” within the Container Setup section under "Target platform."
  6. Click Create, agree to the terms of service and GDPR rules, and you should be presented with a pop up window containing two different code snippets. The top one will have a "GTM-XXXXXXX" code at the end of the script block - you'll want to copy that.

    Alternatively, if you already have a GTM container set up, you can find the Container ID at the top of the container area, under the account name.
  7. Highlight the GTM-XXXXXXX then copy and paste that number into the same text editor you placed your Google Analytics measurement id.
  8. Deploy Google Analytics using Google Tag Manager by following Google's instructions. NOTE: You’ll need the GA4  G-XXXXXXXXXX number you pasted into your text document for this step.

Install The Google Tag Manager Module

extend section of drupal

You may need to get help from your developer with this process. Contact them should you have any questions or issues. Sending along a link to this page could help speed things up.

  1. Make a backup of your website. If something goes wrong, you’ll need to restore your website from a backup.
  2. Install the Drupal Google Tag Manager module available here: https://www.drupal.org/project/google_tagNOTE: Drupal module installation instructions can be found here: https://www.drupal.org/docs/extending-drupal/installing-modules
  3. Once the module is installed, make sure it’s enabled by going to the Extend page of your website: Click Extend or visit https://yourdrupalwebsite.com/admin/modules.
  4. In the search box, enter “google tag” to find the Google Tag Manager module.

    - If the check box next to the module is checked, then the module has been enabled and is ready for configuration. Move on to the next section, "Configure The Google Tag Manager Module."

    - If the check box next to the module is not checked, it will need to be enabled.

    If you have permissions to enable a module, you can select the check box next to the module, and click the Install button at the bottom of the page.

    NOTE: If you do not have permissions to enable the module, you’ll need to contact your web developer to enable it and give you the appropriate permissions to install and configure the GTM module.

Configure The Google Tag Manager Module

google tag id location

Make sure you have that text document handy that contains the GTM container ID that was generated above.

  1. On your Drupal site, go to Configuration > Web Services > Google Tag or visit http://<www.yourdrupalwebsite.com>/admin/config/services/google-tag in your browser.

    This will take you to the Google Tag Manager Default Tag Settings page.
  2. Enter your Google Tag Manager Container ID within the  field.
  3. Click the Add another ID button at the bottom of the page to save the ID.

Testing Your Installation

We recommend testing to make sure your Google Tag Manager is properly installed and configured.

Go into the Google Tag Manager workspace for your website and follow Google's instructions for testing with Preview mode.

There you have it. You should be all set to gather Google Analytics data and make deployment of 3rd party scripts to your website much easier.

We always try to make sure our posts are as accurate and up to date as possible. If you find something is wrong, or you need advanced GTM setup for your Drupal website, please feel free to contact us with any questions or feedback you might have.

And remember, we have teams that stand ready to help you implement your Google Tag Manager and Google Analytics should you need us to.

Drupal Google Tag Manager, Analytics, & Search Console

Hi, I'm Ben Finklea, Volacci's Founder, CEO, as well as a Fractional CMO to Home Services companies.