Simplifying website analytics: A beginner's guide to implementing Google Tag Manager
Google Tag Manager (GTM) allows you to gain valuable insights into your website visitors’ behavior and manage various tracking and Google Analytics in one place, eliminating the need for constant website code modifications. Below, we provide a step-by-step guide on how to implement GTM on your website, regardless of your technical expertise.
Understanding Google Tag Manager
GTM acts as a container for all your website's tracking codes, such as Google Analytics, Facebook Pixel, or conversion tracking codes. Instead of directly adding code snippets to your website, you insert a single GTM container code. This container houses all the necessary tracking tags and can be easily updated without touching your website's source code.
Setting up a Google Tag Manager account
First and foremost, check with your team if you already have an existing GTM and/or Google Analytics account. If one does not exist, then proceed with the instructions below.
To get started with GTM, visit tagmanager.google.com and sign in with your Google account. Create a new account and container for your website. The container name should reflect your website domain. In Drupal, navigate to your GTM module and configure the module by entering your GTM container ID.
Note: For Drupal Lite sites, the GTM module will need to be enabled. Please reach out to the OIT Drupal support team at firstname.lastname@example.org for further instructions or contact your Drupal Lite site manager for additional support.
This module will handle the insertion of the GTM container code into your Drupal website, typically in the `<head>` section of your theme. Save the configuration and your GTM container will be active on your Drupal site.
Creating a GA4 tag
After setting up your GTM container, you can create a Google Analytics 4 (GA4) tag to track and analyze user interactions on your website. In the GTM interface, navigate to the "Tags" section and click on "New." Select the tag type as "Google Analytics: GA4 Configuration" and provide your GA4 Measurement ID, which you can obtain from your GA4 property Data Streams setting.
To find your ID, in Google Analytics go to Admin>Data Streams>Click on your Data Stream> and your Measurement ID will be far right under the MEASUREMENT ID header. It will begin with the letter “G”.
Finally, define your trigger as a ‘pageview’ on ‘all pages’.
Preview and publish
Before making your changes live, it's crucial to preview your GTM container. This feature allows you to test and validate your tags and triggers. After verifying that everything works as intended, click the "Submit" button to publish your container. The updated container code will then be served to your website visitors.
If you have any additional questions or need guidance on your GTM or Google Analytics account, please reach out to Eric Meyer, Director of Measurement and Analytics, at email@example.com.