How to Install GA4 on Your Website?

Google Analytics is a rich tool that allows us to collect data about a website. Thanks to it, we are able to generate multiple reports, study user behavior on the site, and analyze whether our campaign is effective. In recent years, Google provided a tool called Universal Analytics. If you have this version of GA, you have certainly already noticed that as of July 1, 2023, a new version appeared, which replaced the existing one. In this article, we will present a method for installing GA4 on a website using Google Tag Manager.

For those who did not have a UA property

If you haven't used Google's analytics services yet, it is worth starting with this step.

  1. Go to https://analytics.google.com/ and click Start measurement.
  2. Next, we need to name our property. We suggest naming it according to the domain name. At this stage, we can also choose what data we want to share with Google.
  3. The next step is naming our GA4 property. For data organization, we suggest using "domain name - GA4". We also set the country and reporting time zone - it is best to select the location from which we will manage our account. We also select the currency - a point particularly important for e-commerce websites.
  4. In the next step, we can select our industry and indicate the purposes for which we want to use GA. After proceeding to the next step, the terms of service will appear. Once accepted, the account will be created.

For those who already had a Universal Analytics property

Log in to your account. Once the tool's interface is visible, perform the following steps:

  1. Go to the Admin tab
  2. Click Create Property and then follow the same steps 3 and 4 described in the instructions above.

Creating a data tracking stream in Google Analytics 4

If you completed the previous steps correctly, you should see a view where you decide where you want to collect data from:

Creating a data stream in Google Analytics 4

In the case of a website, we are naturally interested in the "Web" platform. In this step, enter the full address of your website and name your stream. It is also worth keeping "Enhanced measurement" selected, as it allows us to collect more meaningful data regarding user behavior on the site.

data stream configuration

After entering this data, our individual Measurement ID will appear. It is worth saving it, as we will need it in the following steps. We now have the property created. All that remains is to add it to our website. If the GA4 property detects that plugins like Google Site Kit or MonsterInsights are available on our site, it will also display additional instructions on how to install GA4 using these plugins. If you use them - you can of course install the property this way and skip the rest of the article. There is also the option to install the tracking code directly into our site's code. However, if you have or want to use Google Tag Manager - we encourage you to read on.

Let's check your website's potential

Share your website and email - we'll get back to you with a real analysis, no strings attached.

Your data is used only to get back to you. See our Privacy Policy.

Great! We'll be in touch soon!

Something went wrong while submitting the form. Please try again.

Installing GTM on a website

You can read what exactly Google Tag Manager is here. For us, its most important feature is that with a simple implementation of two short snippets of code on the site - it allows us to fully manage tags that enable us to track events on the site and conversions.

Creating a Google Tag Manager account

If you already have this service - you can proceed to the next steps. Otherwise, follow the instructions below:

  1. Go to https://tagmanager.google.com/ and click "Create Account":
creating a GTM account
  1. In the next step, just like when creating a GA4 property, name your account, select the country, enter your website address, and choose the target platform - in this case, "Web".
setting up a GTM account
  1. A window with the terms of service will appear. After accepting them, the account will be created.
  2. After the account is created, two code snippets that must be implemented on your site will be displayed automatically. The first one must be added to the <head> section of our site as high as possible, while the second is implemented immediately after the opening <body> tag. Once added, the service should work across our website.

Installing Google Analytics 4 using Google Tag Manager

If we have correctly created the Google Tag Manager container and implemented the tracking code across our site, we can proceed to add the GA4 property to our website.

  1. From the main management panel, select "Add a new tag":
creating tags in GTM
  1. Name your tag - preferably according to its purpose. In this case, it is "GA4 - configuration".
  2. In the Tag Configuration section, select "Google Analytics: GA4 Configuration":
creating a GA4 configuration tag
  1. Here, you need to enter your GA4 Measurement ID, which you obtained after creating the data stream in Google Analytics and which you should have saved during that step. If you didn't, however - no worries. You can find it in GA4 at: Admin -> Data Streams.
GA4 measurement ID
  1. After adding the Measurement ID, go to the "Triggering" section below and select "All pages":
setting up a trigger in GTM
  1. Once you have set up the tag configuration and trigger, click "Save" in the upper right corner. The configuration tag has been created.
  2. For our configuration to be added to the website, we still need to publish the changes. To do this, click the "Submit" button:
publishing changes in GTM
  1. Here, you can name your version and add its description. It is worth doing this to keep your work organized and, in case of any issues, to know when you deployed changes. This will make it easy to restore the previous state. Click "Publish" in the upper right corner, and your changes will be deployed. At this point, Google Analytics 4 begins collecting data from your website.

Summary

As you can see, installing analytics tools on a website is quite user-friendly. Thanks to this, you can analyze user behavior on your website, which can help increase traffic as well as improve conversions. Additionally, you can monitor whether your marketing efforts are bringing the intended benefits. However, if you encountered issues during the installation of these tools or want to set up specific marketing goals for your online campaign - contact us.