When you start your business or want to measure visitors’ interactions on your running website, you should know how to set up Google Analytics 4. Therefore, I wrote this blog post to teach you how to do it.
Note: If you are a current user of Universal Analytics and want to switch from it to Google Analytics 4, please read my other article, “How to upgrade to Google Analytics 4”, instead.

Google announced that Universal Analytics would stop processing new hits in July 2023. Many people don’t know what they need to do in this case, and many ask if they should upgrade to Google Analytics 4. In this guide, I answer all these questions and show you how to upgrade to GA4.
How to set up Google Analytics 4 (GA4)?
So, you have an online business, and you are interested in installing Google Analytics 4 on your website. First, you need to understand that there are a few ways to set up GA4.
You can select the most relevant for you based on your resources and analytics knowledge.
Firstly, if you are only starting your website and don’t have an engineering team behind you, the best way is to use Google Tag Manager.
Secondly, if you are using other Google products such as Google Ads and, for them, you use GTAG. It can be more relevant for you to use the GTAG.js library for GA4 as well.
Thirdly, you can have decent experience with analytics and coding. You can want to set up GA4 by putting the code snippet into the header section of your website code. In that case, you can proceed with the Google Tag manual setup.
Now, after you have selected the most relevant approach to set up Google Analytics 4 for you, let’s create our first Google Analytics 4 property.
Time needed: 10 minutes
- Visit this page and click on “Start Measuring”
- Provide the necessary settings to set up GA account:
1. Account name (For instance, vakulski-group, etc)
2. Account Data Sharing (I select all)
3. Click on “Next” button - Provide the necessary settings for Property setup such as:
1. Property name (for instance, Raw Website Data)
2. Reporting Time zone (for me, Poland)
3. Currency – EUR, USD or other
4. Click on “Next” button - Provide the necessary information about your business
1. Industry category
2. Business size
3. Your aims to use GA4
4. Click on “Create” button - Accept Google Analytics Terms of Service Agreement
- Your GA4 property has been successfully created!
- Now, Select the Web Stream and provide the necessary parameters such as:
1. Website URL. For instance, “www.vakulski-group.com”
2. Data Stream Name – “vakulski-group.com”
3. Click on the “Create Stream” button. - Copy your measurement ID since we will need it in the next section.
After you create your first GA4 property, you should use one of the methods mentioned early to set up GA4 on your website. Let’s dive deeper into each of them.
How to set up Google Analytics 4 using Google Tag manually?
If you selected this step, then you are familiar with coding and know what you are doing. Everything that you need is go to Web Stream Detail View – Click on “View tag instructions” -> Click on “Install Manually”, copy the code and place it into the header section of your website code. When you upload this change to the production, Google Analytics 4 will start to receive data from your website.

How to set up Google Analytics 4 using GTAG.js?
If you already use GTAG.js on your website (for instance, for Google Ads), you can connect your GTAG.js to Google Analytics 4. You need to add one additional line -> “gtag(‘config’, ‘<Your GA4 measurement ID>’);” The example of the final GTAG.js code you can see below. My measurement is ‘G-KF9LRYZ10K’.
<script async src="https://www.googletagmanager.com/gtag/js?id=<Some Property ID A>"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', '<AW-RC12LRSA>');
gtag('config', 'G-KF9LRYZ10K');
gtag('event', 'sign_up', { 'method': 'email' });
</script>
After you make the change mentioned above, Google Analytics 4 stars to receive your website data and you will be able to see it in a GA4 Real-time report.
How to set up Google Analytics 4 using Google Tag Manager?

Step #1 If you use Google Tag Manager to set up GA4, the first step is to open Google Tag Manager, and click on “Add a new tag” under the “New Tag” section.

Step #2 Click on Tag Configuration and select “Google Analytics: GA4 Configuration” tag type.
Let’s name our tag “GA4 – Main Tracking Code” and paste the Measurement ID that we copied in Google Analytics 4 before.

Step #3 Select the trigger for this tag. It will be “All Pages / Page View”. Save it.

Step #4 Publish the GTM container.

After you publish the GTM container, Google Analytics 4 will receive your website data. You can visit your website and find yourself in the GA4 Real-time report.
How to set up Google Analytics 4 using a website builder or CMS?
If your website is built on one of the CMS such as WordPress, Wix, Squarespace, One.com, Typo3, Drupal or Duda, you can install Google Analytics 4 using an external plugin or widget.
Everything you need to do is to go back to GA4 -> Admin -> Data Streams -> Web Stream Details -> “View Tag Instructions” and select “Install Website with a website builder or CMS”. After that, provide the URL of your website and use the instructions provided by Google on how to install GA4 on your website.

How to track the first event in Google Analytics 4 using Google Tag Manager?
When you add the GA4 main tracking code on your website, Google Analytics will start to collect some default events, including pageviews. Apart from tracking pageviews, you can track many different actions on your website. Some of them are:
- Link or button clicks
- Form submissions (contact forms, comment forms, etc.)
- E-commerce Tracking (purchases, refunds, etc.)
- Scroll Depth Tracking
- Youtube Video Tracking
I will show you how to add the event to track whenever a website visitor clicks on the button.
So, to add your first event in GA4, you need to open your website through Google Tag Manager Preview Mode.
I opened my website page and wanted to track the clicks on “Read More” buttons. Indeed, it’s not necessary to track it because whenever someone clicks on it, they generate page views but let’s use this button for the example.
Step #1

Now, I click on the button, click the “ESC” button on the keyboard to prevent this action and go to GTM Tag Assistant and find my click there, select “Variables” tab and see all parameters associated with this click.

I see that the button has the following parameters:
- Click Text = “Read More”
- Click Class = “btn”
- Click URL = “https://www.vakulski-group.com/blog/post/google-analytics-4-filters-” +
“complete-guide/”
I can use this parameter to set up the trigger in GTM to send the event data into GA4. Let’s look at how to set it up.
Step #2

Let’s go to GTM and set up the trigger.
The trigger will have the following parameters. It will trigger whenever someone clicks on the button “Read More” with class “btn” and Click URL contains “https://www.vakulski-group.com/blog/post/”. We use “contents” for Click URL to track all buttons on this page.
Name it “blog front page – read more button” and save the trigger.
Step #3

Let’s set up the new tag in GTM.
Tag Name – “GA4 – Event – Read More”
Tag Type – Google Analytics: GA4 Event
Configuration Tag – “GA4 – Main Tracking Code”
Event Name – read_more
Trigger – “blog front page – read more button”
Save the tag in GTM and Publish the GTM container.
You can also preview your changes in GTM Preview Mode and see if you can send the event into GA4 when you click on “Read more” button, to do that, click on “Preview” and land on the same page once again. Then click on the button and click “ESC” on your keyboard and check Tag Assistant Tab whether you see your tag triggered on your button click.

If you see it, you can also look at the GA4 Realtime report and see your event there. If you don’t see it, please investigate your trigger parameters. Most likely, there is a mistake there.
How to set up ecommerce tracking in Google Analytics 4?
Ecommerce Tracking is a broad topic that requires an entirely new article; therefore, I wrote one.
In general, to set up ecommerce tracking in Google Analytics 4, you need to send a “purchase” event with the product and purchase amount information. The example of the code you need to fire to send the “purchase” event into GA4 is presented below.
dataLayer.push({ ecommerce: null }); // Clear the previous ecommerce object.
dataLayer.push({
event: "purchase",
ecommerce: {
transaction_id: "T_12345",
affiliation: "Google Merchandise Store",
value: 25.42,
tax: 4.90,
shipping: 5.99,
currency: "USD",
coupon: "SUMMER_SALE",
items: [
{
item_id: "SKU_12345",
item_name: "Stan and Friends Tee",
affiliation: "Google Merchandise Store",
coupon: "SUMMER_FUN",
currency: "USD",
discount: 2.22,
index: 0,
item_brand: "Google",
item_category: "Apparel",
item_category2: "Adult",
item_category3: "Shirts",
item_category4: "Crew",
item_category5: "Short sleeve",
item_list_id: "related_products",
item_list_name: "Related Products",
item_variant: "green",
location_id: "ChIJIQBpAG2ahYAR_6128GcTUEo",
price: 9.99,
quantity: 1
}]
}
});
I recommend you to follow my dedicated article: “How to set up ecommerce tracking in Google Analytics 4”, where you can fully figure out how to set up one of two e-commerce trackings and learn more about their advantages and disadvantages. I mean basic ecommerce tracking and enhanced ecommerce tracking.

When you have the business online and want to see its revenue, you need to set up ecommerce tracking in Google Analytics 4. As Peter Drucker said, “You can’t improve what you don’t measure.” It suits our case too. If you can’t see the revenue in GA4, you won’t be able to increase it. Therefore I dedicated this article to explain how to set up e-ommerce tracking in Google Analytics 4 and what e-commerce tracking variant exist.
How to properly document the implementation of the GA4 event?
After you set up events and ecommerce tracking for Google Analytics 4, I highly recommend you find the time to document everything you made. It will help you to remember what every event is responsible for, how it was set up and what additional event parameters can be used.
Maybe right now, you can’t see the value of having this documentation but after a year or when you onboard new people, this documentation will help you to save time to explain yourself or them why you did what you did and what this GA event means and which GTM trigger and tag is responsible for that.
You can create your own documentation or use my template, presented below.
After you note all events, you send into Google Analytics 4, you can integrate other Google products with GA4.
How to integrate GA4 with other Google products?
Google Analytics 4 can be integrated with other Google products, such as:
- Google Ads
- Google Search Console
- Google Optimise
- Google BigQuery
- and others.
You can find the complete list of integrations in GA4 -> Admin -> “Product Links” section.

If you use any other Google products that can be integrated with Google Analytics 4, I highly recommend that you set up the integration. It doesn’t take more than 5 minutes.
Moreover, I recommend that you integrate Google Analytics 4 with BigQuery. It will help you to have full data (not sample one) and be able to use SQL to get even deeper insights about your customers.
What else should you set up in Google Analytics 4 (best practices)?
Apart from tracking events, setting up e-commerce tracking and integrating Google Analytics 4 with other Google products, you can also consider improving your set-up with the following things:
- GA4 filters. Filters will help you to have reliable data and don’t track your and your team’s traffic.
- Internal Traffic Filter
- Developer Traffic Filter
- GA4 Hostname Filter (workaround solution)
- Content Grouping. It’s a powerful tool that can help you to analyse groups of pages separately. It’s highly relevant to analyse blogs, product pages and etc.
- Import data from others sources in Google Analytics 4. You can set up GA4 to import paid ads or product costs data from the SFTP server or load this data using .CSV files.
- Advanced Scroll Depth Tracking. Google Analytics 4, by default, tracks only 90% of scroll depth. If you want to track other scroll depth % as well, you should set up advanced scroll depth tracking in GA4.
Google updates Google Analytics 4 regularly, and to keep your GA4 set-up according to the best practices, I recommend you subscribe to my GA4 newsletter.
Final Word
Google Analytics 4 is a great tool that you can install on your website to measure its traffic. I offered you three ways to set up GA4 on your website. Thus, you can select the most relevant one.
After you install GA4 and add your first events, I encourage you to read more about GA filters and, more specifically, consider setting up an internal and developer traffic filter in Google Analytics 4.
Moving on, you can integrate GA4 with other Google products such as Google BigQuery, Google Optimise, Google Ads and others.
Google Analytics 4 offers three ways to set it up on your website:
1) by adjusting existing GTAG.js you can have on your website
2) by using Google Tag Manager
3) by adding Google Tag in the header of your website code
You can select the most relevant one considering your resources, and programming knowledge.
Yes! Google Analytics 4 is free. There are no costs associated with using it.