Notification

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

Google Analytics 4

Set up Google Analytics in Tag Manager

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:

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 tag

  1. Go to https://tagmanager.google.com.
  2. Sign in to your Google Account. Learn how to create a Google Account.
  3. In Tag Manager, click the Accounts tab (top left), then select your container. Find your way around Tag Manager.
  4. In the Workspaces tab, go to Tags, then click New (top right).
  5. In the panel, follow these steps:
    1. Replace Untitled Tag with the name of your tag (for example, 'Google tag').
    2. In the Tag Configuration section:
      1. In Choose tag type, select Google Tag.
      2. In Tag ID, enter your Tag ID. Learn how to find your Tag ID.
      3. 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.

        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.

        Global parameters are read by all Google tags on your website. Use this option only for non-sensitive data.

        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:

        1. Open the Configuration settings menu.
        2. 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

        Result: Your configuration parameters should look like this:Screenshot of a server-side tagging implementation in the Google tag.

        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.

    3. In the Triggering section, select Initialization - All Initialization Events or Some Initialization Events. Learn more about Page view triggers.
  6. Click Save.

Verify and publish

Verify

  1. Go to https://tagmanager.google.com.
  2. Sign in to your Google Account. Learn how to create a Google Account.
  3. Open the Tag Manager container you want to edit. Find your way around Tag Manager.
  4. In the Workspace tab, click Preview (top right) to launch Google Tag Assistant in a new tab.
  5. Enter your website URL and click Connect. Learn to debug with Tag Assistant.

Publish

An animation showing how to publish the container on Google Tag Manager.

  1. In the Workspace tab, click Submit (top right)
  2. In the Submission Configuration section, follow these steps:
    1. Select Publish and Create Version to publish the changes to your site. To save the changes without publishing them, select Create Version instead.
    2. Enter a name and description for the version.
  3. Select Activity History to review the changes you've made since the previous version.
  4. Click Publish (top right).

Was this helpful?

How can we improve it?
Search
Clear search
Close search
Main menu
2119428521978650734
true
Search Help Center
true
true
true
true
true
102259
false
false