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.
This article shows you how to set up the GA4 Configuration tag.Get started with Google Analytics
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:
- Declaring common settings for GA4 tags
- Setting Google Analytics cookies
- Sending automatically collected and enhanced measurement events
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:
- Create a Google Analytics 4 account and property
- Create a web data stream for your website
- Set up and install Tag Manager
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.
- In Google Tag Manager, click Tags > New.
- Enter a name for the tag at the top (e.g., "GA4 Configuration - example.com").
- In the Tag Configuration box, select Google Analytics: GA4 Configuration.
- 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
- 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 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.
- 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.
- Save the tag configuration.
Your tag configuration should look like this:
Step 3: Verify your tag works
To make sure your tag works as intended:
- In Google Tag Manager, click Preview. The Tag Assistant opens.
- Enter your site's URL.
- Check if the Google Analytics: GA4 Configuration fired when the page loaded.
- ✅ If your tag fired successfully, the Tag Assistant UI look like this:
- ❌ If your tag didn't fire, check your tag's trigger settings.
- When you are done with debugging, close Preview mode.
- In your Workspace, click Submit to publish your changes.