To set up Google Analytics 4 (GA4) in Google Tag Manager, you need to configure the Google tag. The Google tag enables data to flow from your website to Google Analytics and any other designated destinations. Ensure you create a unique Google tag for each website. For additional instructions on setting up Google Analytics, refer to Set up Analytics.
How the Google tag works
The Google tag works by loading your Google Analytics property on a page and:
- Declaring common settings for Google Analytics tags
- Setting Google Analytics cookies
- Sending automatically collected and enhanced measurement events
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 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
- Go to https://tagmanager.google.com.
- Sign in to your Google Account. Learn how to create a Google Account.
- In Tag Manager, click the Accounts tab (top left), then select your container. Find your way around Tag Manager.
- In the Workspaces tab, go to Tags, then click New (top right).
- In the panel, follow these steps:
- Replace Untitled Tag with the name of your tag (for example, 'Google tag').
- In the Tag Configuration section:
- In Choose tag type, select Google Tag.
- In Tag ID, enter your Tag ID. Learn how to find your Tag ID.
- 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 skip the optional settings.
- In the Triggering section, select Initialization - All Initialization Events or Some Initialization Events. Learn more about Page view triggers.
- Click Save.
Verify and publish
Verify
- Go to https://tagmanager.google.com.
- Sign in to your Google Account. Learn how to create a Google Account.
- Open the Tag Manager container you want to edit. Find your way around Tag Manager.
- In the Workspace tab, click Preview (top right) to launch Google Tag Assistant in a new tab.
- Enter your website URL and click Connect. Learn to debug with Tag Assistant.
Publish
- In the Workspace tab, click Submit (top right)
- In the Submission Configuration section, follow these steps:
- Select Publish and Create Version to publish the changes to your site. To save the changes without publishing them, select Create Version instead.
- Enter a name and description for the version.
- Select Activity History to review the changes you've made since the previous version.
- Click Publish (top right).