Support article
How to Configure Google Analytics 4 on Your Website
Install and configure Google Analytics 4 on your website: create property, measurement code, WordPress plugin and key events.
Introduction
Google Analytics 4 (GA4) is Google’s free tool to measure your website’s traffic. It tells you how many visits you receive, where they come from, what pages they see and what they do. Without Analytics, you’re flying blind.
In this article you’ll see how to configure it step by step.
GA4 replaced Universal Analytics (UA) in July 2023. If you still have UA, it no longer collects data: you must use GA4.
Step 1: Create a Google Analytics account
- Go to analytics.google.com.
- Sign in with your Google account.
- Click Start measuring.
- Create an account (your business name).
- Create a property (your website name, time zone, currency).
Step 2: Add your website as a data stream
- Choose Web as the platform.
- Enter your website’s URL (
https://yourdomain.com). - Name the stream (for example “My website”).
- Click Create stream.
Google shows you a measurement ID (starts with G-) and a tracking code.
[Imagen sugerida: screenshot of data stream creation in GA4]
Step 3: Install the code on your website
On WordPress (with plugin)
The easiest way:
- Install the GA4 Google Analytics plugin or Site Kit by Google (Google’s official).
- Connect your Analytics account.
- The plugin inserts the code automatically.
Site Kit is Google’s official plugin that connects Analytics, Search Console and AdSense in one. Highly recommended.
On WordPress (manual)
Edit your theme’s header.php and paste the code before </head>:
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
Replace G-XXXXXXXXXX with your real ID.
On static HTML
Paste the same code in the <head> of each page.
Step 4: Verify it works
- Enter your website.
- Go to GA4 → Reports → Realtime.
- You should see yourself as an active visitor.
If it doesn’t appear in 5-10 minutes, check the code is properly installed.
Step 5: Configure key events
GA4 measures events automatically, but it’s worth configuring the ones that matter most:
- Page view (automatic).
- External link clicks (automatic).
- Website search (configurable).
- Form conversion (configurable).
- WooCommerce purchase (with plugin).
For online stores, configure e-commerce tracking in GA4. It shows you what products sell, from where and how much you invoice.
What to look at in GA4
The most useful metrics:
| Report | What it tells you |
|---|---|
| Realtime | Who’s on your website right now |
| Acquisition | Where your visits come from (Google, social, direct) |
| Pages | Which are the most visited |
| Users | How many there are, new vs returning |
| Events | What actions they take on your website |
Useful tips
- Don’t obsess over the number of visits. Better look at quality: time on website, pages per session.
- Filter your own IP. Otherwise your visits inflate the statistics.
- Connect GA4 with Search Console. This way you see which searches bring you traffic.
- Configure goals or conversions. To measure what really matters (sales, registrations, contacts).
- Review at least once a month. Data without action is useless.
Common problems
No data appears in realtime
Check the code is properly installed and that no cache plugin is blocking it.
Figures don’t match Search Console
It’s normal. Each tool measures differently. GA4 measures real visits; Search Console measures Google impressions.
I don’t see which searches bring visits
Connect Search Console with GA4 in Admin → Product linking.
GA4 seems very complicated to me
GA4 is more complex than the previous version. Take time to explore it or use plugins that simplify the view (like Site Kit).
Frequently asked questions
Is Google Analytics free?
Yes, for most websites. There’s a paid version (Analytics 360) for large enterprises.
Does GA4 comply with GDPR?
Partially. You must configure IP anonymization and notify the user with a cookie banner.
Do I need Analytics if I have Search Console?
Yes, they’re complementary. Search Console tells you how Google sees you; Analytics tells you how your visitors behave.
Can I use Matomo instead of GA4?
Yes, it’s a private and open source alternative. You have a Matomo guide in our knowledge base.
Does Analytics slow down my website?
Minimally. The code loads asynchronously and doesn’t appreciably affect speed.
Measure to improve
Google Analytics 4 is the basic tool to understand your traffic. Without measuring, you can’t improve. Configure it once and review the data regularly.
If you need help configuring Analytics on your miHosting website, open a ticket from your client panel and we’ll help.