The New Settings Variable For GA4 In Google Tag Manager
October 5, 2023
Share this post
As a digital marketer looking to implement Google Analytics 4 (GA4) in your website or mobile app, you know that variables are crucial to sending data to GA4. Variables allow you to dynamically populate values in your tags, providing flexibility and reusability. Creating a GA4 settings variable in Google Tag Manager for your GA4 implementation gives you more control and consistency over the data you send to GA4.
In this article, you’ll learn how to create a GA4 settings variable in Google Tag Manager, including event name, event parameter, and user ID variables. You’ll see how variables can simplify your GA4 implementation and provide opportunities for improved data governance. With variables set up, you’ll be well on your way to unlocking the full potential of GA4 for gaining customer insights and optimizing the digital experience.
What Are Settings Variables in Google Analytics 4?
Settings variables in Google Analytics 4 (GA4) allow you to store values that can be referenced across your GA4 implementation. They act as constants that enable dynamic configuration of your GA4 tracking.
There are two types of GA4 settings variable:
Predefined variables: These are variables created by Google with default values that can be overridden. Examples include clientId and trackingId.
Custom variables: These are variables you define to store values specific to your implementation. For example, you may create a custom variable to store an environment name like devor prod.
To create a custom settings variable in GA4:
Log in to the GA4 interface and navigate to Admin > Settings Variables.
Click “+ NEW VARIABLE” to create a new variable.
Enter a name and value for your variable. The name must start with a letter and contain only alphanumeric characters and underscores.
Choose a type of either String, Number, or Boolean for your variable value.
Click “Save” to create the variable.
Your new settings variable can now be referenced in your GA4 tags using the {Settings: name} syntax, where name is the name of your variable. The GA4 Settings variable allow for a dynamic and reusable GA4 implementation and is vital to managing complex properties.
Google Tag Manager Interface Changes
To configure Google Tag Manager for GA4, you’ll need to make some changes to the interface.
Add GA4 as a New Property
Add GA4 as a new property in your Google Tag Manager account. Select it as the default property to use it for your website.
Create GA4 Tags
You’ll need to create tags to set up GA4 tracking on your site. The key tags to create are:
GA4 Configuration – Set up the GA4 tracking ID and any default settings.
GA4 Event – Fires whenever a specific event happens on your site that you want to track.
GA4 Page View – Fires to track basic page analytics on each page view.
Set Up Variables
Create the following variables to populate values in your GA4 tags:
GA4 Tracking ID – Your unique GA4 tracking ID from Google Analytics
Event Category – An event category, like “Videos” or “Button Clicks.”
Event Action – The action of an event, such as “Play” or “Click.”
Event Label – Additional details about the event, such as a video title or button text
Apply Tags to Your Website
The final step is to install the Google Tag Manager snippet on all pages of your site. This will load the GA4 tags and variables and send data to Google Analytics. Monitor your reports in GA4 to ensure tracking is working correctly.
As a result of these changes made in Google Tag Manager, you’ll have GA4 tracking configured and collecting valuable insights from your website. Be sure to check back frequently for new features and updates to take advantage of the full power of GA4.
The new Google Tag
You must set up some variables to properly configure the new Google Analytics 4 (GA4) tag in Google Tag Manager. GA4 uses different parameters than Universal Analytics, so updating your variables is essential.
Tracking ID
Your GA4 tracking ID is different from your UA tracking ID. In the tag configuration, set a variable for your GA4 tracking ID. You can find your GA4 tracking ID in the Admin settings of your GA4 property.
Event parameters
With GA4, you’ll track events to measure user interactions and behaviours. Set up variables for the event parameters:
Event Name: The name of the event you want to track. For example, “button_click”.
Event Action: A description of the type of event. For example, “play_video”.
Event Label (optional): Additional information about the event. For example, “how_to_video”.
Event Value (optional): A numeric value associated with the event. For example, 10.
User properties
You can set user properties in GA4 to segment your users. Create variables for:
User ID (optional): A unique identifier for a user. For example, a login ID.
Session number (optional): The number of sessions for a user. For example, 5.
Traffic source (optional): A user’s traffic source. For example, “social_network” or “search_engine”.
Campaign name (optional): The name of a marketing campaign. For example, “holiday_sale”.
Content group (optional): Groups content into categories. For example, “videos” or “blog_posts”.
Creating dedicated variables for these GA4 parameters allows you to update and reuse them across your tags easily. Double-check that all variables are mapped correctly in your tags in order to ensure accurate tracking in GA4.
Creating a New Configuration Tag for GA4
To set up GA4 in Google Tag Manager, you’ll need to create a new configuration tag.
Select the desired container in the Google Tag Manager interface and click “New.” Select “Tag” as the tag type.
For the tag name, enter “GA4 Configuration”. Select “Google Ads: GA4 Configuration” as the tag template.
Enable the GA4 Measurement ID field and enter your GA4 measurement ID. This ID can be found in your Google Analytics account under Admin > Data Streams.
Set the Data Stream Name to the name of your GA4 data stream. This helps identify the data stream in reports.
Select your GA4 Reporting Timezone. This determines the timezone used for GA4 reporting features like the real-time report.
Enable any optional fields like Advertising ID Collection or IP Anonymization if desired. Advertising ID collection allows GA4 to associate ad clicks with conversions. IP Anonymization hides the last octet of IP addresses.
Click “Continue” then “Submit” to save your new GA4 configuration tag.
Place the GA4 configuration tag on all website pages to ensure GA4 correctly tracks website data and events. The tag should be placed immediately before the closing tag on each page.
Test and verify your GA4 implementation before launching. Check that data is populating in your reports and events are firing as expected. Make any needed tweaks to the configuration tag or triggers.
Once verified, you can utilize the many features of GA4, like real-time reports, customer journey analytics, and predictive analytics, to gain valuable insights into your business and optimize your marketing campaigns. Continuous testing and improvement of your GA4 implementation will help maximize its value.
Adding Additional Parameters
You can set custom parameters to track additional dimensions in your GA4 property. Custom parameters allow you to add extra information to your events, allowing for more granular analysis and segmentation.
Adding Parameters
To add a custom parameter in Google Tag Manager:
Go to Variables and click “New.” Select “Custom Parameter” as the variable type.
Name your parameter and give it a value. For example, you might name a parameter “page_type” and give it a “home page” value. You can leave the value blank for now if you prefer to set it dynamically using a data layer variable.
Select the GA4 Trigger containing the event to which you want to add the parameter. Click “Add Variable” and choose your new custom parameter.
Your custom parameter will be added to all GA4 events fired by that trigger. You can view your custom parameters in the GA4 interface under “Events” → “Custom parameters.”
To dynamically set a custom parameter value using the data layer, select “Data Layer Variable” as the variable type instead of static text. Then, choose the data layer variable that will hold the custom parameter value. The value of that data layer variable will be sent with the event.
You can add multiple custom parameters to a single GA4 event. Just repeat the steps to add more parameters.
Custom parameters allow for more advanced analysis and segmentation in GA4. You can create custom reports, dashboards, and audiences based on parameter values. Parameters are key for enriching your GA4 data and gaining insights into user behaviour and site engagement.
What’s New in Variables Settings?
Google Analytics 4 (GA4) has introduced enhanced capabilities for variables in Google Tag Manager. Variables allow you to populate field values in your tags dynamically. Some of the new variable types in GA4 include:
Data Layer Variables: Pull values from your website’s data layer to use in your tags. For example, you can create a data layer variable to capture a product name or price from your e-commerce data layer and use it in your GA4 tag.
Constant Variables: Define static default values for rarely changed fields. For example, you can create a constant variable with your website or app name for multiple tags.
JavaScript Variables: Execute custom JavaScript to return a value for use in your tags. This allows for dynamic values that change based on user interaction or other events on your site.
Lookup Variables: Lookup the value of a key in a lookup table. The lookup table lists keys and values, allowing you to map one value to another.
Auto Event Variables: GA4 auto-detects events on your site, like page views, button clicks, and form submissions. You can create variables to capture the values of those auto-detected events for use in your tags.
Path Variables: Define a base path value and a list of path segments to construct a full path. Path variables are helpful when you have dynamic paths on your site that you want to capture in your tags.
Query String Variables: Parse query string parameters from a URL and capture the values for use in your tags.
These enhanced variable options provide more flexibility and control in setting up your GA4 implementation. You can construct values dynamically based on user interaction, data on your site, or static default values. Variables help reduce the need to manually update tag values and ensure you capture the right data in your GA4 reports.
With Google Analytics 4 now available, you have a powerful new version of Google Analytics at your disposal. By creating GA4 variables for your GA4 measurement ID and viewing the ID in Google Tag Manager, you ensure that you can update these values without modifying your GA4 tags themselves. Using variables also keeps your GA4 implementation clean and modular.
Finally completing your GA4 setup and settings variable, you now have a solid foundation for leveraging the new capabilities of Google Analytics 4. At this time, you can begin sending event data, setting up conversion events, and building dashboards to gain insights into how users interact with your website or mobile app. In conclusion, Google Analytics 4 opens up many new opportunities for understanding your users and optimizing their experience. Therefore, with time invested upfront in planning your implementation, GA4 can become an indispensable tool for gaining actionable insights and driving growth.
Thanks For Reading !
Author - Athira Balan
I'm a dedicated blogger specializing in SEO and technology, offering practical insights and strategic guidance to keep you at the forefront of the digital world. My focus is on delivering clear, actionable content that demystifies even the most intricate subjects.
The most important part of any engagement is knowing what
you need and how we can help you get there. Let’s grab a
coffee and take it from there or contact us directly!
*MANDATORY FIELDS
Let us know you Better
The most important part of any engagement is knowing what
you need and how we can help you get there. Let’s grab a
coffee and take it from there or contact us directly!
Comments