You are most likely familiar with the Universal Analytics (UA) settings variable. This lets you define your Google Analytics (GA) property and any parameters that need to be set or passed along with an event or pageview. You then apply the variable to your tags, ensuring that those settings and parameters are applied to all GA tags.
This is a little different in Google Analytics 4 (GA4) for Google Tag Manager (GTM). Now, you have a configuration tag where you can set default parameters (in the Fields to Set section). Each event tag (remembering again that everything in GA4 is an event), needs to call this a ‘configuration tag’. Furthermore, the configuration tag can send a pageview, or you can send that as a separate event.
A little confusing, huh? Well let’s see if we can break it down somewhat.
First, when setting up tagging for GA4 you will set up a configuration tag. This tag holds your measurement ID, can fire a pageview, and holds fields to set, or default parameters. A properly-formatted base-level tag will look like the one below:
Note the following:
- Your measurement ID – You can hardcode it here or set it to a variable if needed.
- The “send a page view” checkbox – If you need to pass custom parameters with your pageview, you will want to UNCHECK this box and set up a separate pageview event to pass your pageviews with.
- Your firing trigger – To make this available for all tags, set this to fire on all pages.
You CAN set user properties here if needed as well. These again would be user properties to persist across all tags.
You also can pass any parameters that need to be consumed by all tags using this configuration variable. For example, publish date of the content.
Next, your event tag will call this GA4 configuration tag. Let’s see how that looks for a page_view event tag:
Note the following:
- The configuration tag is set to the tag we just set up.
- The event name is filled in, in this case to page_view.
- We have added some event parameters that will be sent every time this tag fires.
- We have added a firing rule to fire this tag on all pages.
Now, when the tag fires on a page it will send a page_view event to GA with the author, publication date, and category (assuming those exist on the page).
So what in the end does the GA4 configuration tag get you? Well, it gives you one place to enter your measurement ID so there is no confusion. You can set user properties in the config tag to keep them the same across events. And yes, you can automatically pass a pageview if needed from the config tag. Finally, you still can pass along your global custom parameters just as you did with the UA config variable.