Install Google Analytics 4 with Google Tag Manager

After launching my personal website, I have to install Google Analytics to track the performance of the site. As I already planned to insert schema markup to my website manually, I decided to use Google Tag Manager for my analytics and other SEO needs.

This is a blog post to document how I install GA4 with Google Tag Manager, so I can refer to the process without Googling again the next time. 

Do you need Google Tag Manager with GA4?

While you don’t need Google Tag Manager to use Google Analytics 4, using both tools together can offer additional benefits and make tracking your website’s data even easier.

Google Tag Manager is a tool that allows you to manage and deploy marketing tags (such as tracking codes) on your website without having to modify the code directly. By using Google Tag Manager, you can quickly and easily add and update tracking tags, and you can also set up triggers and variables that control when and where tags fire on your website.

When using Google Tag Manager with Google Analytics 4, you can set up a GA4 Configuration tag that contains your Measurement ID, which is used to track data in Google Analytics 4. You can also use Google Tag Manager to set up additional tags for tracking other types of data, such as clicks on specific buttons or links.

Overall, using Google Tag Manager with Google Analytics 4 can make it easier to track data on your website, and can provide more flexibility and control over how that data is collected and analyzed.

Steps to install google analytics 4 with google tag manager

To set up Google Analytics 4 with Google Tag Manager, follow these steps:

1. Set up a Google Analytics 4 property in your Google Analytics account.

Login to Google Analytics, and then click on the left bottom corner to open the “Admin” section. Choose “Create Account” or “Create Property” according to your need

Usually, you would create a separate account for different website. But in this case, I was creating a GA4 property for a WordPress blog that already has an Universal Analytics property, so I would go for the “Create Property” options to keep everything under the same account.

Create Google Analytics 4 property

Fill in the property name and answer the questions about your business information. Click ‘Create’ to finish the property set-up.

2. Set up data stream

When setting up Google Analytics 4 (GA4), you need to set up a data stream to collect data from your website. A data stream is a connection between your website and your GA4 property, and it allows GA4 to receive data and events that occur on your website in real-time.

Click on the “Data Streams” tab within your GA4 property, and click “Add Stream”. Select the type of data stream you want to set up – in this example, as we needfor a website, choose and click on ‘Web‘.

Set up data streams for web

Enter the appropriate information for your data stream, such as your website’s URL and give it a name (be descriptive, you don’t want to be confused later if you have multiple data streams).

Choose the data settings you want to apply to your data stream, such as which events you want to track or which user properties you want to collect.

Then click on “Create stream” and you will get your stream details like the one below. Don’t close your browser tab as you will need to copy your Measurement ID later when configuring it in Google Tag Manager.

Stream details

3. Set up Google Tag Manager

Next, set up your Google Tag Manager if you don’t have one already. Simple head to Google Tag Manager and sign in to your account. Click the “Create Account” button.

Fill in the necessary information, and setup the container for “Web”.

Click “Create”, then read and accept the Google Tag Manager Terms of Service Agreement. And follow the instruction to insert the code to your website.

4. Create a new GA4 Configuration tag in Google Tag Manager.

Create a new tag in Google Tag Manager

In your Google Tag Manager account, you will see the dashboard. Simply click “Add a new tag”. In the pop-up, give a name for the tag at the top. Click on the Tag Configuration box and choose “Google Analytics: GA4 Configuration” as the tag type.

Then configure the tag by selecting the appropriate Google Analytics 4 property, and now paste the Measurement ID you have obtained in Step 2.

5. Add a trigger to the tag that specifies when the tag should fire.

Next, you have to choose and name the trigger to specify when the tag should fire. Click the “Triggering” box and you can choose from the list there. A lot of tutorial websites suggest choosing “All Pages – Page View“, but here is what Google said:

To ensure that the Google Analytics 4 Configuration tag fires before other triggers, click Triggering and use the Initialization – All pages trigger.

– Google Tag Manager Help [1]

6. Save the tag and publish your changes.

Save your tag. Go back to the Google Tag Manager interface, click on the “Preview” button in the top right corner. This will open a new window where you can preview your tags.

Navigate to the page on your website where you have implemented the tags. You should see a Google Tag Manager debug console at the bottom of the page. This console will show you which tags fired and which ones did not.

Tags Fired in Tag Assistant

If the tag is correctly setup, then you can close Tag Assistant and submit your change.

Once you’ve completed these steps, Google Analytics 4 will be set up to collect data from your website, and you can start analyzing the data in your Google Analytics account. Note that it may take 24-48 hours for data to start showing up in your account.

Conclusion

After configuring Google Analytics 4 in Google Tag Manager, the next step is to set up tags and triggers to track specific events on your website, such as pageviews, clicks, and form submissions. By setting up tags and triggers, you can start collecting data on specific events and actions that occur on your website, and use that data to gain insights into your website’s performance and user behavior. You can also set up custom reports and dashboards in Google Analytics 4 to view this data in a more meaningful way.


Reference:

[1] Google Tag Manager Help: Configure Google Analytics 4 tags in Google Tag Manager

Aubrey Yung

Aubrey Yung

Aubrey is an SEO Consultant with 5+ years of B2B and B2C marketing experience.