G Suite is now Google Workspace: everything your business needs to get work done.

[GA4] Configure Google Analytics 4 tags in Google Tag Manager

This article is for users who already use Google Analytics 4 (GA4) and want to maintain their tags within Google Tag Manager. For more information on setting up GA4, refer to Set up Analytics.
This article covers what you need to do so a Google Tag Manager web container sends events to GA4.

Google Tag Manager allows you to set up and manage GA4 events all in one place. To send event data from Google Tag Manager to GA4, you need two tags that work together:

  • Google Analytics: GA4 Configuration
    The GA4 Configuration tag ensures data flow from your website to Google Analytics. 
    Create one configuration tag on every page where you want to collect analytics data.
  • Google Analytics: GA4 Event
    The GA4 Event tag lets you set up events on your website without writing code. The event data shows up in your GA4 reports.
    Create as many event tags as you need to measure your recommended or custom events.

Diagram that shows how Google Tag Manager relates with your website or app and Google Analytics 4. The Google Analytics Configuration tag ensures data flow from your website to Google Analytics. The Events tag lets you set up events without writing code.

This article shows you how to set up the GA4 Configuration tag.

About the Google Analytics 4 Configuration tag

The Google Analytics: GA4 Configuration tag loads Google Analytics for your Google Analytics 4 property on a particular page by: 

About parameters

You can configure Fields to Set in the GA4 Configuration tag to set parameters (e.g., tracking ID, user ID, or cookie domain) that need to remain consistent across all events on a page. GA4 Event tags inherit the parameters of the GA4 Configuration tag. Parameters set by the GA4 Configuration tag remain static for all events occurring on a page. The parameters are refreshed only when the Configuration tag fires again, typically the next time the page is loaded.

If an Event tag has a parameter with the same name as a Configuration tag parameter, the Event tag parameter value will override that of the Configuration tag, but only for that event. All other Event tags that do not have the same parameter name will continue to reference the parameter value initially set by the Configuration tag.

Before you begin

This guide assumes that you've done the following:

It also assumes that you have the following:

  • Access to the Tag Manager container for the website
  • The Editor (or above) role to the Google Analytics account

Set up the Google Analytics 4 Configuration tag

Step 1: Create a GA4 Configuration tag

Start by creating a Google Analytics: GA4 Configuration tag to send data to your Analytics property.

  1. In Google Tag Manager, click Tags > New.
  2. Enter a name for the tag at the top (e.g., "GA4 Configuration - example.com").
  3. In the Tag Configuration box, select Google Analytics: GA4 Configuration.
  4. Configure your tag:
    • In the field Measurement ID, enter your "G-" ID.
    • Keep the Send a page view event when this configuration loads option checked to automatically send pageview events.
  5. Optional settings:
    • Server-side tagging: Select Send to server container to send all GA4 events to a Tag Manager server container instead of Google Analytics. Specify the Server Container URL of your Tag Manager server container. Learn more about Server-Side Tagging.
    • Parameters: Add any parameters you'd like to configure in Fields to Set. Use recommended event parameter names so that Google Analytics can populate dimensions and metrics for you. 

      Example 1: To set a user ID, add a row to Fields to Set. Set the Field Name to user_id, and the Value to a Tag Manager Variable that returns the user ID.

      Example 2: Use Fields to Set to configure cookie field settings:

      Parameter Name Example
      cookie_prefix SubscriberCookie
      cookie_domain tickets.example.com
      cookie_expires 31536000
    • Custom properties: Add any custom user properties that you'd like to configure in User Properties.
      Note: Analytics automatically collects some user dimensions so you don't have to define user properties for them. You can set up to 25 additional user properties per Google Analytics 4 property.

Step 2: Create a trigger

Next, set up a trigger to load the Google Analytics: GA4 Configuration when someone loads your website. 

  1. To ensure that the Google Analytics 4 Configuration tag fires before other triggers, click Triggering and use the Initialization - All pages trigger. Learn more about Page triggers.
  2. Save the tag configuration.

Result

Your tag configuration should look like this:

Screenshot of Google Tag Manager that shows the result of the setup.

Step 3: Verify your tag works

To make sure your tag works as intended:

  1. In Google Tag Manager, click Preview. The Tag Assistant opens.
  2. Enter your site's URL.
  3. Check if the Google Analytics: GA4 Configuration fired when the page loaded.
    • ✅ If your tag fired successfully, the Tag Assistant UI look like this: Screenshot of the Google Tag Assistant showing a successfully configured GA4 Configuration tag
    • ❌ If your tag didn't fire, check your tag's trigger settings.
  4. When you are done with debugging, close Preview mode.
  5. In your Workspace, click Submit to publish your changes.

Next steps

Now that your Tag Manager container can communicate with your Google Analytics property, add event tags to your site.

Set up GA 4 Event Tags

Was this helpful?
How can we improve it?
Search
Clear search
Close search
Google apps
Main menu
Search Help Center
true
true
true
true
102259
false
false