Comprehensive Guide: Set up GA4 Tags using Google Tag Manager

Optimizing data tracking, and gaining invaluable insights into user behavior

Understanding user behavior and website performance is important for any business or individual wishing to succeed online. The insights derived from this data empower marketers, data professionals, webmasters, and even business owners to make informed decisions that can significantly impact growth trajectory.

Google Analytics 4 (GA4) – is the next generation of web analytics from Google, designed to provide a more holistic and user-centric view of website and app data. GA4 when compared to Universal Analytics provides better event tracking, cross-platform tracking, channel grouping, and reporting options.

But how do you efficiently integrate GA4 into your website? That's where Google Tag Manager (GTM) comes into play.

GTM is a free tool that allows you to easily manage and deploy marketing tags (snippets of code or tracking pixels) on your website (or mobile app) without having to modify the code. This versatility has made GTM an indispensable tool for many as it streamlines the process of tag implementation and management.

This guide is intended to bridge the gap between GA4 and GTM, providing you with a step-by-step walkthrough on how to seamlessly integrate GA4 tags into your website using GTM. Whether you are new to digital analytics or a seasoned pro looking to transition to GA4, this comprehensive guide has been curated to ensure you're equipped with the knowledge and skills needed to succeed in the modern digital landscape and track your website traffic without any errors.

Setting up GA4 Configuration Tag

The GA4 Configuration Tag acts as the foundation for all other GA4 event tags you'll deploy on your site. Think of it as the bridge that connects your website to your GA4 property, ensuring data flows seamlessly between the two.

Unlike Universal Analytics (the previous version) where each interaction is tracked using different tags, GA4 centralizes most of its tracking around this one primary configuration tag. On the same note, if you are a migrating user from Universal Analytics, here are a few guides on how you can export your raw data, save your historical data, and upgrade your reports.

What does the GA4 Configuration Tag do?

The GA4 Configuration Tag performs several functions:

  1. Session Establishment: It initiates and tracks user sessions on your website, providing insights into user engagement durations and behavior patterns.
  2. Pageview Tracking: By default, once the GA4 Configuration Tag is set up, it will start capturing pageviews. This allows you to understand which pages of your site are attracting the most attention.
  3. The Base for Event Tracking: Beyond just pageviews, the configuration tag serves as a foundation for tracking additional events. This means if you want to monitor specific interactions like button clicks, form submissions, form tracking, or video views, this tag needs to be in place first.
  4. Client Identification: The Client ID tag helps in recognizing returning users by assigning unique identifiers, thus allowing you to segment new vs. returning visitors and understand user journeys over multiple sessions.

How to Set Up the GA4 Configuration Tag using GTM

  1. Log into your Google Tag Manager account: Navigate to the desired container for the website you're working on.
  2. Create a New Tag: Click on 'Tags' from the left-hand menu, then click the 'New' button.

  1. Configure the Tag: Under 'Tag Configuration', choose 'GA4 Configuration'.

  1. Enter Measurement ID: You will need to input your GA4 Measurement ID, which can be found in your GA4 account under 'Admin' > 'Data Streams'. It typically starts with the format ‘G-XXXXXXX’.


  1. Advanced Settings (optional): If you have specific configurations or parameters you want to pass (like user-defined variables), you can set them up in this section.

  1. Triggering: Choose the trigger for this tag. For basic pageview tracking, select the 'All Pages' trigger, which ensures the tag fires on every page of your website.

  1. Save and Test: After setting up the tag and choosing its trigger, save your changes. Use the 'Preview' mode in GTM to test and ensure the tag fires correctly on your site.

 

  1. Publish Changes: Once you're satisfied with the setup, click on 'Submit' to publish the changes to the live environment.

    With the GA4 Configuration Tag successfully set up via GTM, your website is now primed to send data to your GA4 property. Remember, this is just the beginning; the real power of GA4 lies in its flexibility to customize event tracking based on your specific needs.

    We will now explore the setting up of the Event tag. As an example, we will consider an e-commerce site & set up the events that are typically required for e-commerce.

GA4 Event Tag: Deeper Insights from User Interactions

While the GA4 Configuration Tag lays the groundwork for your data collection in Google Analytics 4, the GA4 Event Tag is where the magic truly happens. This tag allows you to capture a wide range of user interactions on your website, providing granular insights that drive decision-making.

Utility of the GA4 Event Tag:

Interactions: While the Configuration Tag captures standard pageviews, the Event Tag lets you dive deeper into specific user actions. This could be anything from playing a video, downloading a PDF, clicking on a specific link, or even scrolling to a particular section of your website.

Conversion Tracking: For marketers and business owners, understanding conversion touchpoints is crucial. The Event Tag allows you to track these specific moments, whether it's signing up for a newsletter, completing a purchase, or filling out a contact form.

Flexibility and Customization: GA4 Event Tags are not restricted to predefined actions. If there's a unique user interaction specific to your website or business model that you wish to track, GA4 allows for this level of customization.

Reporting: With event tracking in place, you can segment your audience better, understand user pathways, and refine your funnel visualization. This aids in spotting friction points and optimizing the user experience.

Setting Up the GA4 Event Tag using GTM:

  1. Access Google Tag Manager: Start by logging into your GTM account and selecting the appropriate container.
  2. Initiate a New Tag: Click on 'Tags' from the sidebar, followed by the 'New' button.
  3. Choose Tag Type: Under 'Tag Configuration', select 'GA4 Event'.
  4. Configuration Details: Here, you'll need to specify the event name and parameters. For instance, if tracking a video play button, the event name might be 'video_play'. You can also send additional event parameters, such as 'video_title' or 'video_duration'.
  5. Link to Configuration Tag: Under 'Tag Configuration', there's an option to select or enter your GA4 Configuration Tag. This ensures the event data gets sent to the right GA4 property.
  6. Determine Trigger: The trigger defines when this event tag will fire. For a video play, this could be when a specific button element is clicked. GTM offers various trigger types like 'Element Clicks', 'Form Submissions', or 'Scroll Depth' to capture a wide range of user interactions.
  7. Test Your Setup: Before going live, use GTM's 'Preview' mode to ensure the event tag fires correctly when the specified interaction occurs on your site.
  8. Deploy Changes: Once testing is complete and you're satisfied, click 'Submit' to push the changes live.

With the GA4 Event Tag in place, your ability to capture and understand user interactions on your site becomes infinitely more detailed. The more events you track, the richer your data becomes, granting you a clearer picture of user behavior and preferences.

Set up Guide for Common Events for an Ecommerce Site

If you set up tag for e-commerce event and you have already implemented e-commerce format GA4 in the dataLayer, you should enable e-commerce tracking in the tag and add in Event parameters e-commerce variables (you can see how to do it by clicking the link)

If you set up a tag for an e-commerce event, you should know what format dataLayer you use - GA4.

This is important because the tag settings depend on the format type of dataLayer.

Here you can see the table of e-commerce events GA4. It should help you with setting up tags.

GA4 action

Description

Event parameter

DataLayer Variable GA4 event

view_item_list

View of item impressions in a list

items

ecommerce.items

item_list_id

ecommerce.item_list_id

item_list_name

ecommerce.item_list_name

select_item

Click on an item in a list

items

ecommerce.items

item_list_id

ecommerce.item_list_id

item_list_name

ecommerce.item_list_name

view_item

View item details

items

ecommerce.items

value

ecommerce.value

currency

ecommerce.currency

add_to_cart

Add item(s) to cart

items

ecommerce.items

value

ecommerce.value

currency

ecommerce.currency

add_to_wishlist

Add item(s) to a wishlist

items

ecommerce.items

value

ecommerce.value

currency

ecommerce.currency

view_cart

View the contents of the shopping cart

items

ecommerce.items

value

ecommerce.value

currency

ecommerce.currency

remove_from_cart

Remove item(s) from the cart

items

ecommerce.items

value

ecommerce.value

currency

ecommerce.currency

begin_checkout

Initiate the checkout process

items

ecommerce.items

value

ecommerce.value

currency

ecommerce.currency

coupon

ecommerce.coupon

add_shipping_info

Add shipping info during the checkout flow

items

ecommerce.items

value

ecommerce.value

currency

ecommerce.currency

coupon

ecommerce.coupon

shipping_tier

ecommerce.shipping_tier

add_payment_info

Add payment info during the checkout flow

items

ecommerce.items

value

ecommerce.value

currency

ecommerce.currency

coupon

ecommerce.coupon

payment_type

ecommerce.payment_type

purchase

Purchase items that were checked out

items

ecommerce.items

transaction_id

ecommerce.transaction_id

value

ecommerce.value

tax

ecommerce.tax

shipping

ecommerce.shipping

currency

ecommerce.currency

coupon

ecommerce.coupon

refund

Refund one or more items

items

ecommerce.items

transaction_id

ecommerce.transaction_id

value

ecommerce.value

tax

ecommerce.tax

shipping

ecommerce.shipping

currency

ecommerce.currency

coupon

ecommerce.coupon

view_promotion

View of promotions

creative_name

ecommerce.creative_name

creative_slot

ecommerce.creative_slot

promotion_id

ecommerce.promotion_id

promotion_name

ecommerce.promotion_name

items

ecommerce.items

select_promotion

Click on a promotion

creative_name

ecommerce.creative_name

creative_slot

ecommerce.creative_slot

promotion_id

ecommerce.promotion_id

promotion_name

ecommerce.promotion_name

items

ecommerce.items

You can see using this link how Google recommends implementing tags for ecommerce events.

Example how to set up a tag for ecommerce event

This section provides examples of configuring tags depending on which event you have implemented in the dataLayer - GA4.

Add_to_cart

When a user decides they might want to purchase an item and adds it to their shopping cart, the 'Add to Cart' event is activated. It's a strong signal of purchase intent and is crucial for monitoring the shopping funnel.

  • Tag - you can use the variable with an event name in the chapter “Event Name”

  • Trigger

  • Variables - use similar settings for all variables

Remove_from_cart

The 'Remove from Cart' event provides insights into moments when users decide against a purchase, removing a product from their cart. Analyzing this can offer clues on product uncertainties or user indecision.

View_item_list

The 'View Item List' event is fired when users browse or scroll through a list of products, often seen on category pages or search results. It's essential for understanding product discoverability and user browsing patterns.

Select_item

Triggered when a user selects or clicks on a specific product from a list, the 'Select Item' event provides insights into which items are grabbing user attention from a list or category view.

View_item

The 'View Item' event captures moments when users delve deeper to check out a product's detailed information. Monitoring this event can indicate product interest and potential purchase intent.

Add_to_wishlist

The 'Add to Wishlist' event occurs when users save an item to review or purchase later. It can indicate a product's desirability and is a potential lead for future sales.

View_cart

Triggered when users view the contents of their shopping cart, the 'View Cart' event helps in understanding potential drop-offs or bottlenecks before the checkout process begins.

Begin_checkout

Initiating the final purchasing phase, the 'Begin Checkout' event captures when users start the checkout process. It's a key step in the e-commerce conversion funnel.

Add_shipping_info

This event takes place when customers enter or confirm their shipping details. It provides insights into user progression in the checkout phase.

Add_payment_info

Activated when users input their payment details, the 'Add Payment Info' event is a crucial step towards completing a purchase and indicates a high level of purchase intent.

Purchase

The most coveted of all e-commerce events, the 'Purchase' event signifies a successful transaction. It's pivotal for tracking conversion rates and overall business success.

Refund

Representing the flip side of purchases, the 'Refund' event tracks when customers are issued refunds, helping businesses understand product returns and areas of dissatisfaction.

View_promotion

The 'View Promotion' event is triggered when users interact with or view promotional content, offers, or ads on the site. It's instrumental in gauging the effectiveness of marketing campaigns or special deals.

Select_promotion

The 'Select Promotion' event is recorded when users actively engage or choose a promotional offer, be it by clicking on a promotional banner or selecting a promotional product. This event offers critical insights into the attractiveness and effectiveness of promotional campaigns, helping businesses optimize their marketing strategies for better engagement and conversions.

FAQ

Expand all Close all
  • How do I get my GTM code in GA4?

    To get your Google Tag Manager (GTM) code for Google Analytics 4 (GA4), follow these steps: Log in to your Google Tag Manager account. Create a new container for your GA4 property. In the container settings, you'll find the GTM container code snippet. Copy and paste this code into the section of your website's HTML. This code will be used to deploy and manage GA4 tags via GTM. For example, this container has all the tags you need to get started with events tracking whatever business you are.
  • How to use GA4 for SEO?

    Utilize GA4 for SEO insights by: Setting up key events (pageviews, clicks) as goals to track user engagement. Analyzing user paths, behavior flows, and site search data to understand user journeys. Creating custom reports to track organic search traffic, landing pages, and user demographics, aiding SEO strategy refinement.
  • Can you use GTM for GA4?

    Yes, you can use Google Tag Manager (GTM) to manage and deploy GA4 tags. Create GA4 event tags within GTM, define triggers (user interactions), and set up variables (dynamic data). Then, associate these tags with triggers to track specific user actions and send data to your GA4 property for detailed analysis.