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.
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.
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:
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.
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
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."
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.
Highlight the GTM-XXXXXXX then copy and paste that number into the same text editor you placed your Google Analytics measurement id.
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
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.
Make a backup of your website. If something goes wrong, you’ll need to restore your website from a backup.
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.
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
Make sure you have that text document handy that contains the GTM container ID that was generated above.
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.
Enter your Google Tag Manager Container ID within the field.
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.
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.