The Google Tag in Google Tag Manager

The Google Tag in Google Tag Manager

How to Configure the New Google Tag and Variables in Google Tag Manager

The Google Tag is an important element of a Google Analtyics 4 set up in Google Tag Manager (GTM). It’s necessary to understand the basics of how this Tag should be configured in GTM.

The Google Tag should fire before pageview events, especially if you want the Google Tag’s settings to apply to the event tags.

To learn more about how to implement and configure the Google Tag, you can either watch our video here or you can read the blog below.

Understanding the New Google Tag Message in GTM

You may have seen this message in GTM: “Your Google Analytics GA4 Configuration tags are now Google tags with new capabilities, including settings variables. Your existing measurement has not changed, and no action is required.”

While partly correct, to fully utilise these new tags and variables, there will need to be some changes. Let’s dive into your GTM container for a detailed walkthrough.

Navigating the Google Tag Manager Container

In your GTM container, use the search icon to find the Google Tag. Even if not named Google Tag, it appears because that’s now the type of tag.

Step-by-Step Guide to Configuring the Google Tag

1. Renaming and Reviewing the Tag

First, rename your Config Tag to the “Google Tag”. Click into the tag to see if send_page_view is set to false, meaning no page view is sent with this tag. If it is set to “true”, it originally fired a page view with the Config tag. However, if you also have a separate page_view event, and the Google Tag is set to send a page_view event, this will result in duplicate page_view events.

Create a separate page_view event in GTM and not to rely on the Google Tag to fire the page_view event. This is because the sequence and timing of events can be critical to get the optimal event tracking configuration. For example, the Google Tag should always fire before a page_view event, but the page_view event may have to be aligned with certain dataLayer events (e.g. login event) to ensure user status is up-to-date.

For server-side GTM users, you’ll see “server_container_url” has been automatically added to the Google Tag.

2. Changing the Tag ID to a Variable

Consider changing the tag ID to a variable. This allows you to more easily add the measurement ID to each tag and event in GTM. Go to Variables > User-Defined Variables, and create a new constant variable. Add the measurement ID for the GA4 Property as the value and save. You can then add the variable to all tags and events instead of manually pasting the measurement ID into the tag ID field. For multiple environments, use a lookup table to define the measurement ID for each GA4 Property.

3. Configuring Settings Variables

Next, check the configuration settings variable. Create a new variable to easily add settings to any Google tags. Name it Configuration Settings or GTAG, then add parameters like send_page_view (false) and UTM parameters.

Save the variable, then remove duplicated parameters from the tag. Google has a list of valid parameters for the configuration settings variable, shared below the video.

4. Setting Up Event Settings Variables

Look at the event settings variable. If not created, set up a new variable. Add all your custom parameters like client_id, session_id, content_group, custom_timestamp, page_location, browser_language and so on. Save the new variable and add it to all your event tags. This simplifies sending custom parameters with event tags.

Google provides documentation on valid parameters for the events settings variable. However, this does not prevent you from adding your own custom parameters.

Configuring Individual Events in GTM

Now, save the Google Tag and configure individual events. Check each GA4 event, ensuring the shared events settings variable is added. Remove unnecessary user properties from the event itself.

For pageview events, ensure parameters are added via the shared events settings variable. Set your tag sequence to fire the Google Tag before page_view events. This ensures the Google Tag fires first, especially important for single-page applications.

Summary of Key Steps

Here you will find a link to an excellent article by Simo on Google Tag implementation.

Finally, to summarise:

  1. Fire the Google Tag early on initialization or consent initialization.
  2. Set up a tag sequence to ensure it fires before pageview events.
  3. Create configuration settings and event settings variables.
  4. Remove redundant parameters from event tags.
  5. Add user scoped parameters to the event settings variable.

By following these steps, you’ll optimise your use of the new Google Tag and variables in Google Tag Manager. Thanks for watching. You can watch more of our YouTube videos here, or you can find more of our articles about Google Tag Manager here.

More reading

How to Redact Email Addresses and Query Parameters in Google Analytics 4

Creating a Real-Time Dashboard with Google Analytics 4 Data

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *