
April 1, 2025
How to Setup and Install Google Analytics 4 (3 ways)
Updated: April 1st, 2025
If you want to measure the performance of your website, you must use some web analytics tool. Google Analytics 4 is one of them. It allows you to see the number of sessions, visitors, most popular traffic sources, etc.
But to get that, first, you need to install GA4 on a website.
In this blog post, I will show you three ways to do that. With the native GA4 tracking code (a.k.a. GTAG, a.k.a. Google Tag), with Google Tag Manager, and with a plugin (native integration).
Table of Contents
Here’s what you will learn in this article
- #1. Create a Google Analytics 4 Property & Data Stream
- #2. Install Google Analytics 4
- #3. Check the DebugView in Google Analytics 4
- #4. Publish your changes in Google Tag Manager
- #5. Google Analytics 4 real-time reports
- #6. What’s next?
- Final words
We have lots to cover, so let’s dive in.
Ā
A Video Tutorial on How to install Google Analytics 4
I have recorded a quick tutorial on my YouTube channel if you prefer video content. But if you want to learn additional details, read this blog post as well.
You’ll learn the most if you do both: watch the video and read the tutorial.
#1. Create a Google Analytics 4 Property & Data Stream
It all starts with a new property.
To create a new Google Analytics 4 property, go to the Admin section of your Google Analytics interface (by clicking theĀ Admin at the bottom-left corner) and then (in theĀ Property section) clickĀ Create Property.
Note: if you have never worked with GA before, then just go to analytics.google.com and then follow the steps to create your first property.
Then, enter the name of your property. It might be the name of your website, your company, a brand, etc. Choose your companyās country, reporting time zone, and the main currency your business operates.
Then pressĀ Next, and answer several questions. Then, you will need to select your business objectives. Based on these choices, the reports that you will have in the interface will change too. To make things simpler right now, selectĀ Get baseline reports.
ClickĀ Create.
The next step is to configure your first data stream. This is a data source from which events will be sent to your Google Analytics 4 property. You can have multiple data sources in a single property. For example, there are three web properties: one for the web, one for an Android app, and one for an iOS app.
In this blog post, I will focus on a Web stream. Select it.
Then, enter your website’s URL (for example, https://www.mywebsite.com). Note that the protocol (https) is already selected. After that, enter your website’s name.
When you create a web data stream in Google Analytics 4, you can enable/disable Enhanced Measurement. It is designed to help marketers get as many events in the reports as possible without the need to cooperate with developers or configure them in Google Tag Manager.
By default, this feature is enabled and will automatically track the following events:
- Page view (event name: page_view)
- Scroll (event name: scroll)
- Outbound link click (event name: click with the parameterĀ outbound: true)
- Site search (event name: view_search_results)
- Video Engagement (events:Ā video_start, video_progress, video_complete)
- File Download (event name:Ā file_download)
- Form events (form_start, form_submit)
If you want, you can disable/enable events individually. You can do that by clicking the gear icon in theĀ Enhanced MeasurementĀ section and then clicking the toggle buttons.
When you’re ready, press the Create stream button.

#2. Install Google Analytics 4
There are three ways to install Google Analytics 4 (which depend on your website and context):
- Install GA4 with a Google Analytics plugin/integration
- Install with GTAG (a.k.a. Google Tag, a.k.a. native GA4 tracking code)
- Install GA4 with Google Tag Manager
You will need to choose one option.
#2.1. Install Google Analytics 4 with a plugin
This is a good option for popular content management systems with built-in GA4 support or support GA4 plugins. Popular platforms includeĀ WordPress, Squarespace, Shopify, Magento, etc. For example, if you are using Shopify, some alternatives are listed here.
There are many different platforms/systems, and they work differently, so you will need to do your research to find out if they support Google Analytics 4 natively. If not, maybe your system supports 3rd party plugins that can be installed?
This could be done quickly by googling “[your platform name] google analytics 4“, for example, “WordPress google analytics 4“.
Once you find the instructions, follow them, and you should be good.
For example, on WordPress, there are various plugins that offer GA4 integration, like GA4WP. After you install the plugin, it will ask you to enter the Measurement ID.
You can find the ID by going to Google Analytics > Admin > Data Streams > Select your web data stream. Finally, at the top right corner, you will see the ID that starts with G-.
This is the measurement ID. Copy it, paste it into the plugin’s settings, and save the changes. Done! The next step is to test, and you will learn how to do that here.
#2.2. Install Google Analytics 4 with the native tracking code
If you are working with a website that does not have a native GA4 integration or doesn’t support GA4 plugins, then you can ask the developer to install the native GA4 tracking code directly in the source code of the website.
In GA4 Admin > Data Streams, select your Web Data Stream. Then click View tag instructions.
Then select Install manually and copy the code that you’ll get:
You should give that code to a developer and ask him/her to install this code in the <head> section of *all* pages of your website. The developer will know what this means.
Done! The next step is to test, and you will learn how to do that here.
#2.3. Install GA4 with Google Tag Manager
If you want to have more flexibility and power in managing tracking codes, then the third installation option (Google Tag Manager) is what you need. First, you must install GTM on your site (learn how to do that here).
After that, go to GA4 > Admin > Data Streams, select your web data stream, and copy the measurement ID.
Then go to your Google Tag Manager container (if you havenāt worked with it, hereās aĀ tutorial on how to get started)Ā > Tags > NewĀ and chooseĀ Google Tag.
In theĀ Tag IDĀ field, enter the ID that you copied in the GA4 interface.
In the Triggering section, select Initialization ā All PagesĀ and then name the tag, e.g.,Ā Google Tag.
Then it’s time to test it. Click Preview in the top right corner of the GTM interface.
Once you enable the preview mode, you should see the new Google tag among the tags that fired.
The next step will be to check if the data is displayed in Google Analytics 4. I will explain thisĀ in the next chapter of the blog post. After that, you will need to publish the changes.
#3. Check the DebugView in Google Analytics 4
Once you install Google Analytics 4, it’s time to test. The primary feature built for debugging GA 4 data is the DebugView section.
Head over to yourĀ Google Analytics 4 account > Admin > Debugview.
Most likely, you will not see any data there (yet). That’s because that data in the DebugView is visible ONLY when the debug mode in GA4 is enabled. Do not mix this with the GTM Preview and Debug mode. They are two different beasts.
If you installed GA4 by choosing method 1 (plugin) or method 2 (GTAG), install theĀ Google Analytics Debugger extension in your Chrome browser. In the list of installed extensions, click the GA debugger’s icon.
After that, go to your website (where GA4 is installed), browse the site, and visit several pages.
If you installed GA4 with Google Tag Manager, having the GTM Preview mode enabled automatically makes the data visible in the GA4 debug view.Ā
Then, you should start seeing data in the DebugView. Click on every individual event to see the list of parameters.
Click on that parameter to see the value that was received by GA4. Now, that is some granular debugging!
If debugview is not working for you, read this troubleshooting guide.Ā Sometimes, refreshingĀ DebugView’s page helps too.
Also, ensure you have selected the correct Debug device in the top left corner.
If multiple visitors have enabled the debug view (e.g., they all have enabled the Chrome extension), you will see multiple devices there and it might require some time to find yourself. This especially applies to my blog, when many of my readers have enabled the GA Debugger Extension, and I have to guess which device (out of the other 15) is mine š
Anyway, once you start seeing data in DebugView, things will look like this.
If you see your events in the debugview, GA4 was installed properly.
#4. Publish your changes in Google Tag Manager
This step is required only if you are using GTM to install GA4. Once you have made sure that the data is coming in and it is displayed properly, you should submit your GA4 changes in the GTM container and publish it.
You can do that by clicking the SUBMIT button in the top right corner and then completing all the other steps that the user interface asks you to do.
After that, you should soon start seeing the new data coming in your real-time reports as well.
#5. Google Analytics 4 real-time reports
On the left sidebar of the Google Analytics 4 interface, go to Realtime. This is where you will see the data coming into your reports. Unlike in the previous version (Universal Analytics), the new report offers you capabilities to see the data on a much more granular level.
First, you will see a map and a bunch of cards with traffic sources, the most popular events, and the number of users in the last 30 minutes.
You can also take a look at the snapshot of an individual user. You can do that by clicking theĀ View user snapshot button in the top right corner.
Then, you will see a stream of all events of that particular user, you can click on them (just like in the DebugView) to see things on a more granular level. If you wish to look at another user/visitor, you can click the button here:
To exit the snapshot, press theĀ Exit snapshotĀ button in the top right corner.
#6. What’s next?
I will not go into too much detail here, but here are several things for you to configure next:
- Exclude your internal traffic
- Increase data retention to 14 months (because the default for most of the data is two months)
- Configure cross-domain tracking
- Track events with GA4
- Optional: Review Enhanced Measurement events and disable those that are irrelevant.
- For businesses showing ads in the EU, UK, and Switzerland, configureĀ consent mode.Ā I have an in-depth module in my GTM course for beginners.
Final words on how to install Google Analytics 4
And that’s how you install Google Analytics 4 on your website.
Speaking of the process, here’s a summary:
- Create a new GA4 property
- Create a data stream (in this blog post, I focused on the Web stream)
- Install GA4. You can do that with a plugin, native tracking code, or Google Tag Manager.
- Check the debugview and real-time reports and see if your data is coming in
Got more questions? Feel free to ask in the comments below.
Ā
24 COMMENTS
Hey,
I wonder if it“s possible to anonymize IP in the configuration tag in GTM?
https://developers.google.com/analytics/devguides/collection/gtagjs/ip-anonymization
Is it done by adding a new field with anonymize_ip: true ?
Ga4 automatically anonymizes IP. Nothing to add.
Hi Julius, great content.
One question, in GA4 if you want send custom data (like old custom dimensions, for example page_section) inside the page_view event, how do you have to add this data in GTM?
Thanks,
Hi, find my blog post about custom event tracking. You will find more information about custom parameters there
Hi Julius.
I set up just GA4 for a new client who had no Analytics. I did not see the option to add the old UA Property as well. The GA4 interface is not what I expected and a real let down as far as drilling down into the data. So I want to add a UA Property for the client as well.
Although I added a new UA Property on it's own after initially creating a GA4 and linked it to the GA4 ID it's not tracking anything. Do I have to add the UA-xxxxxxx-xx tracking code to the website in addition to the GTM tracking code or just add the Universal tracker to GTM?
Thanks in advance
Dave
Just the UA tag in GTM. And if you want to use GA4, have a separate GA4 config tag in GTM as well.
Hi.. I need your help in Ecommerce tracking in GA4.. I am very much confused .. Can you please help me out?
HI, The entire process of GA4 ecommerce setup with very detailed instructions is here https://www.analyticsmania.com/courses/intermediate-google-tag-manager-course/
Hi Julius,
If we already installed Universal Analytics using GTM, then if we want to install GA4 using tag manager, does it mean we have to create a new GTM account ? or can it be the same GTM account that we use to install Universal Analytics? I'm a bit confused there.
Use the same container
sorry Julius, i meant "new container", not account.
"same container" implies that the account will also be same :)
Hi again,
I have followed this steps.
Is it normal not seeing my GA4 measurement ID in the source code of the our website?
Thank you.
Yes, normal
Question about the GA4 Configuration Trigger. I know with UA we would always use the "Page View" trigger, but when looking at 'Google Support Documents' they want you to use an "Initialization" trigger instead. Is there a reason why we still use a Page View trigger instead of what Google suggested?
Here is the link to Tag Manager Help of the information I'm referring to.
https://support.google.com/tagmanager/answer/9442095?hl=en&ref_topic=6333310&sjid=12951177416240877338-NA
Correction: use an "Initialization" trigger for GA4 property instead.
There is no big difference
If I've installed GA4 on my website do I also need to to install it in GTM?
Is it ok to install GTM and GA4 on the same site?
I wanted to express my sincere gratitude for your informative blog post on setting up and installing Google Analytics 4. Your step-by-step guide and clear instructions have been incredibly valuable for someone like me, seeking to harness the power of data analytics for my website.
Your blog provided me with the confidence and knowledge I needed to successfully integrate Google Analytics 4 into my website. The detailed explanations and screenshots you provided made the process seamless and hassle-free.
Looks like Google Analytics migrated over to GA4. Under "Properties & Apps" it shows my old account with an arrow to "Views". That account is no longer getting data. So I created a new "Property & Apps" for the same site but renamed it. How do I delete the original Property?
if we install GA4 code manually on site and create google tag(aka Configuration tag) is there dublicate on data?
Hi Julius,
Very informative post. We are trying to transition from UA to GA4 for our mobile app. We are able to perform the required steps in Google Analytics but when are trying to change the tag type in GTM we do not see the Google Tag option and can see Google Analytics (Firebase) option. Is this the correct one to choose from? As we are not able to get any specific documentation related to this. Please share your thoughts and share any references you have for mobile if any.
If I install 1.st GA4 and then GTM it looks that GA4 does not load acording to Google console? Is that order important or not?