How to implement Google Analytics 4 with gtag via Google Tag Manager
Google Analytics 4 (GA4) is the latest version of Google Analytics. GA4 is an event-based measurement platform that gives you a deeper understanding of your users and their behavior. We have previously written about how switching to Google Analytics 4 to ensure future-proof data analysis.
Google Tag Manager (GTM) is a tool that allows you to add tracking code and other types of code to your website without having to modify the code.
By implementing GA4 via GTM, you can easily and effectively track your website activity.
Step 1: Create a GA4 property
To get started, you need to create a GA4 property. You can do this by going to Google Analytics and clicking Create Property.
When you create a GA4 property, you must provide the following information:
- Property name
- The domain of the property
- Property time zone
You can also choose to create a data feed for your property. A data feed is a connection to your data sources. In this case, your data feed will be your website.
Step 2: Create a GTM container
If you don't already have a GTM container, you'll need to create one. You can do this by going to Google Tag Manager and clicking Create Container.
When you create a GTM container, you must provide the following information:
- Container name
- Container domain
Step 3: Add the GTM code to your website
Once you have created a GA4 property and a GTM container, you need to add the GTM code to your website. You can find the GTM code in your GTM container.
Step 4: Create a GA4 configuration tag
Once you have added the GTM code to your website, you need to create a GA4 configuration tag. This tag will send your website information to your GA4 property.
To create a GA4 configuration tag, follow these steps:
- In GTM, click Tags.
- Click New.
- Select Google Analytics: GA4 Configuration.
- Please provide the following information:
- Measurement ID: This is your GA4 measurement ID. You can find it in your GA4 property.
- Data Feed: This is the name of your GA4 data feed.
- Click Save.
Step 5: Enable the GA4 configuration tag
Once you have created the GA4 configuration tag, you need to activate it. To do this, follow these steps:
- In GTM, click Configuration.
- Click Timeline.
- Find the GA4 configuration tag.
- Click Activate.
Step 6: Verify that GA4 is working
Once you have enabled the GA4 configuration tag, you can verify that GA4 is working. To do this, go to your GA4 property and make sure you see data in the Real-time report.
Additional tips
- If you already have tracking codes on your website, you can use GTM to import them.
- You can use GTM to track additional events on your website.
- You can use GTM to track users across multiple devices and channels.
Summary
Implementing Google Analytics 4 with gtag via Google Tag Manager is a simple and effective way to track your website activity. By following these steps, you can get started in no time.