For more information on setting up GA4, refer to Set up Analytics.
If you were using GA4 configuration tags, they have been automatically upgraded to the Google tag. Your measurement and capabilities will work just as before and you don’t need to take any action.
Your GA4 event tags stay the same.
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 tag
The Google tag establishes the data flow from your website to Google Analytics and other destinations you might have set. Create one Google tag per domain and place it on every site that you want to measure. - 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.
How the Google tag works with GA4
The Google tag loads 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
About parameters
A parameter is a key-value pair (e.g., 'currency': 'USD'
) that provides additional information about events or configuration settings on your page. The Google tag sends event parameters with automatically collected and recommended events already.
If you need more information about an event, you can add parameters. You can look up pre-defined parameter names or create a custom parameter, if you need it.
For example, when someone adds a product to a shopping cart, the Google tag sends an add_to_cart
event. To get more detailed data on the item, you can encode parameters for that event, such as the product name, and price.
Share parameters across tags
To keep data consistent across all your tags, you can configure shared parameters using configuration and event settings variables. The Google tag can inherit parameters from a settings variable like measurement IDs, user ID, and many more.
GA4 Event tags inherit the parameters of the Google tag. Parameters set by the Google tag remain static for all events occurring on a page. The parameters are refreshed only when the Google tag fires again, typically the next time the page is loaded.
If a GA4 Event tag has a parameter with the same name as a Google tag parameter, the GA4 Event tag parameter value will override that of the Google tag, but only for that event. All other GA4 Event tags that do not have the same parameter name will continue to reference the parameter value initially set by the Google 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 tag
Step 1: Create a Google tag
Start by creating a Google tag to send data to your Analytics property.
- Open Google Tag Manager
- Select the container you want to configure. Open the
Tags menu.
- Create a New tag. Enter a name for the tag at the top (e.g., "Google tag configuration - example.com").
- In the Tag Configuration box, select
Google tag.
- Configure your tag. In the field Tag ID, enter your Google tag ID.
Where is my Google tag ID?
You can find your Google tag settings within Google Ads, Google Analytics, and Google Tag Manager. Log in to a product and follow the instructions to view your tag ID:
Google Ads instructions
Open the Google tag settings.Google Analytics instructions
- Open Google Analytics.
- Go to the
Admin screen.
- In
Data Streams, click on a stream to see details.
Result: Your screen should show you the Google Analytics settings and the Google tag settings.
Google Tag Manager instructions
Note: To see Google tag IDs in Google Tag Manager, you need to manage a Google Ads, Analytics or Google tag in a container.
- Open Google Tag Manager.
- Click on the tab Google tags to see Google tags you have previously set up.
- Click on the tag name to edit the Google tag settings.
- Optional: You can set up additional configuration options to govern how your Google tag communicates with its destinations. If you set up the Google tag and want to keep all its default settings, you can now skip to Step 2: Create a trigger.
Optional settings
Global parameter settings
If you need to establish common context across several Google tags, you can specify global parameters using gtag.js directly on your website.
Learn how to reuse parameters across multiple tags, in the developer documentation.
Configuration settings
You can specify additional configuration parameters that influence the Google tag settings.
To reuse configuration across Google tags, create a configuration settings variable.
Shared event settings
You can specify additional parameters that are sent with every event, for example the currency
of a price. Event parameters are only valid for the tag you add them to.
To reuse event settings across Google tags, create an Google Tag Event Settings variable. Use recommended event parameter names so that Google Analytics can populate dimensions and metrics for you.
Send data to a tagging server
Server-side tagging allows you to move some tags off of your website or app and onto a server instead, which allows you to improve performance. Learn more about server-side tagging.
To send all events to a Tag Manager server container instead of Google Analytics, you need to configure the following parameter:
- Open the Configuration settings menu.
- Set up the server container URL by adding a new configuration parameter:
- Name:
server_container_url
- Value: Set to the server container URL of your Tag Manager server container
- Name:
Result: Your configuration parameters should look like this:
Set up user properties
User properties are attributes that describe groups of your user base, such as their language preferences or geographic locations. You can use user properties to define audiences.
For example, you can set a user property called favorite_food
, which you can use to record each user's favorite food. You can use the data to segment users by their favorite food.
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.
To measure custom user properties you need to create a new Google Tag Event Settings variable and then assign it to the Google tag.
7. Save your Google tag.
Step 2: Create a trigger
Next, set up a trigger to load the Google tag when someone loads your website.
- To ensure that the Google tag fires before other triggers, click Triggering and use the Initialization - All pages trigger. Learn more about Page triggers.
- Name the tag and Save the tag configuration.
Result
Your tag configuration should look like this:
Step 3: Verify your tag works
To make sure your tag works as intended:
- In your Workspace, click Preview. 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.
- ✅ If your tag fired successfully, the Tag Assistant UI look like this:
- When you are done with debugging, close Preview mode.
- In your Workspace, click Submit to publish your changes.