Google Analytics 4 tags

Google Analytics 4 properties bridge the gap between web and mobile analytics. Google Tag Manager supports Google Analytics 4 properties with two tags that work together:

  • Google Analytics: GA4 Configuration
  • Google Analytics: GA4 Event

The Google Analytics 4 Configuration tag

The Google Analytics: GA4 Configuration tag initializes Google Analytics for your Google Analytics 4 property on a particular page. It handles behavior such as setting of Google Analytics cookies, sending automatic and enhanced measurement events, and declaration of common settings.

The Configuration tag should be fired on every page where you want to collect data for a Google Analytics 4 property, and should be triggered to fire as soon as possible, before any other Google Analytics 4 event tags.

To create a Google Analytics 4 Configuration tag:

  1. Click Tags > New.
  2. Click Tag Configuration.
  3. Select Google Analytics: GA4 Configuration.
  4. Enter your measurement ID.
  5. Optional: Add any parameters you'd like to configure in Fields to Set. Use recommended event parameter names for best results.
  6. Optional: Add any custom user properties that you'd like to configure in User Properties. Note: Analytics automatically logs some user properties. You can set up to 25 additional user properties per Google Analytics 4 property.
  7. Optional: Use Advanced Settings to set a Tag Firing Priority or use Tag Sequencing to help ensure that the Configuration tag fires before any other event tags that require it.
  8. Click Triggering and select appropriate events that would cause the tag to fire.
  9. Save the tag configuration and publish your container.

Use Fields to Set to set persistent parameter values for all pages that fire the given tag.

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

The Google Analytics 4 Event tag

The Google Analytics 4 Event tag lets you send custom events to Analytics, in addition to the events that are sent automatically or through enhanced measurement. For example, if you want to collect scroll depth data or more granular intervals than provided via enhanced measurement, you can trigger an Google Analytics 4 Event tag to fire based on Tag Manager’s scroll depth trigger.

To create a Google Analytics 4 Event tag:

  1. Click Tags > New.
  2. Click Tag Configuration.
  3. Select Google Analytics: GA4 Event.
  4. For Configuration Tag, select the Configuration Tag you created earlier.
  5. For Event Name, specify the name of the event. Use the recommended event names for best results.
  6. Optional: Enter Event Parameters. Use recommended event parameter names for best results.
    1. Click Add Row.
    2. Enter a Parameter Name.
    3. Enter a Value.
    4. Repeat until all desired parameters have been added.
  7. Optional: Add any custom user properties that you'd like to configure in User Properties. Note: Analytics automatically logs some user properties. You can set up to 25 additional user properties per Google Analytics 4 property.
  8. Optional: Use Advanced Settings to set a Tag Firing Priority, or use Tag Sequencing to help ensure that the Configuration tag fires before any other event tags that require it.
  9. Click Triggering and select appropriate events that would cause the tag to fire.
  10. Save the tag configuration and publish your container.

Example Event tag configuration:

  • Event Name: scroll
  • Parameter Name: percent_scrolled
  • Parameter Value: {{Scroll Depth Threshold}} (populated by built-in variable)
Use Advanced Settings > Tag Sequencing to specify that an Event tag should fire after a Configuration tag.
Was this helpful?
How can we improve it?

Need more help?

Sign in for additional support options to quickly solve your issue