Skip to content

Google Analytics 4 (GA4) guide: setup, reports and privacy

Google Analytics 4 (GA4) guide: setup, reports and privacy

There is no disputing how much data matters in business today. What you need is the ability to find meaningful patterns in data, interpret them and use them to make decisions that improve your business’s performance. This is where the world’s most popular web analytics tool comes in: Google Analytics.

Have you noticed that the world of analytics is in upheaval? The old, familiar Universal Analytics is history, and Google Analytics 4 (GA4) has taken its place. At the same time, Europe is having a heated debate about privacy and GDPR. In this guide I go through everything that matters: how to set the service up, how the new event-based model works and what you need to know about privacy.

Let’s dive into the deep end of web analytics, but keep it easy to follow.

What is Google Analytics and why did GA4 replace Universal Analytics?

At heart, web analytics means measuring, collecting and reporting web data in order to understand and optimise how the web is used. Google Analytics (GA) is a free service from Google that has dominated this field for years.

In recent years, however, we have seen one of the biggest changes in digital marketing. The previous version of Google Analytics, Universal Analytics (UA), stopped collecting new data on 1 July 2023. All access to UA data, including historical data, was removed completely on 1 July 2024.

Why was the change made?
The world has changed. UA was built at a time when people browsed the web on desktop computers and cookies worked flawlessly. Today we use the web on several devices (phones, tablets and smartwatches), often during the same purchase journey. Google Analytics 4 (GA4) is the answer to this complexity. It has been rebuilt from the ground up to meet today’s challenges: it combines website and app analytics, uses AI to fill in missing data and is designed with privacy first.

A Google Analytics 4 dashboard on a screen, showing users in the last 30 minutes, users per minute and top countries

Installing and setting up GA4: page tags and Google Tag Manager

Google Analytics is something the website owner puts in place, and it needs a technical installation. In practice, this means installing “page tags” on the site.

Here are the two most common ways to set up GA4:

1. Installing the tracking code (gtag.js) directly

The most traditional way is to add a small piece of JavaScript, called the tracking code, to every page of your site.

  • Placement: the latest tracking codes (such as gtag.js) are asynchronous. Asynchronous code can safely be placed between the page’s <head> ... </head> tags. Because the code is asynchronous, it runs while the rest of the page loads and doesn’t delay the page appearing for the user the way older codes did.
  • How it works: when a visitor arrives on the page and their browser supports JavaScript, the code is activated. It collects information about the visitor and sends it to Google’s data collection server. One source describes this basic principle as follows: “The program gets information about a website visitor when the visitor’s browser runs a JavaScript script that is fetched from Google’s server by a short call included in the web page’s source code.”

2. Google Tag Manager (GTM) – the recommended way

Many professionals now prefer Google Tag Manager (GTM).

  • Why use GTM? GTM is a popular way to implement tracking. It lets you manage and update tracking codes without constantly editing the site’s source code, which makes it less time-consuming and less complicated than the older method.

The event-based data model: how do GA4 events work?

This is perhaps the biggest stumbling block for anyone used to the old Universal Analytics.

In the old world (UA), everything was based on sessions and page views. Analytics measured how long a user spent on the site during a given session. In the new GA4 world, everything is based on events.

What does this mean in practice? In GA4’s flexible data model, every interaction is an event:

  • Loading a page is an event (page_view).
  • Clicking a link is an event (click).
  • Downloading a file is an event (file_download).
  • Scrolling down the page is an event (scroll).

This change matters because it allows much more precise tracking.

The challenges of data collection: the role of cookies and JavaScript in analytics

GA4 is powerful, but it doesn’t see everything.

The role of cookies
When the tracking code is activated, it sets a first-party cookie in the user’s browser. In Universal Analytics, this cookie was known as _ga. The cookie’s most important job is to store the ClientId, an anonymous identifier used to recognise the user.

JavaScript and blocking it
Because Google Analytics is a JavaScript-based solution, it only works if JavaScript is switched on in the user’s browser. Users can block tracking:

  1. By switching JavaScript off: this stops the program getting any information about the visitor.
  2. By using browser extensions: for example NoScript, Ghostery or Google’s own Google Analytics Opt-out Browser Add-on stop the data from being sent.
  3. With ad blockers: many ad blockers also stop analytics scripts from loading.

This means that analytics data is never a 100% complete picture of reality.

Google Analytics and privacy (GDPR): IP anonymisation in GA4

Using Google Analytics in the European Union comes with significant challenges, even legal ones. Several European data protection authorities (including those in Austria, France, Italy and Finland too) have taken a position on the use of Google Analytics.

The core problem is the transfer of data to the United States. GDPR requires European users’ data to be processed to certain standards, and for years the view was that data in the US was not protected the way the EU requires. In July 2023 the European Commission adopted the EU-US Data Privacy Framework, and since September 2023 Google has relied on it to transfer data from its advertising and analytics products to the US.

How does GA4 respond to this?
Google has developed GA4 on a “privacy-first” principle:

  • IP anonymisation by default: in the old UA, you had to add a separate snippet (anonymizeIp) that removed the last digits of the IP address. GA4 does this automatically, and Google says it no longer logs or stores users’ IP addresses from traffic that comes from the EU.

This move responds to the fact that if an IP address counts as personal data, using GA scripts without further measures is not lawful.

GA4’s advanced features: machine learning and free BigQuery

GA4 is not just a new interface: it brings features that used to be available only to users of the expensive version (Google Analytics 360).

One of the most significant changes is the deeper integration of machine learning. GA4 uses AI to fill gaps in the data and to model behaviour.

  • Predictive metrics: the system can predict future trends and behaviour, such as how likely a user is to leave the site without buying (churn probability).

GA4 also offers all users a free integration with Google BigQuery. BigQuery is Google’s cloud-based data warehouse. This feature used to be limited to the paid GA 360 version.

Reading GA4 reports: analysing the user journey and conversions

The value of analytics lies in how it helps you make better decisions. With GA you can track the performance of your advertising campaigns more effectively.

GA4’s reporting puts the emphasis on the user lifecycle. The reports are divided into sections such as “Acquisition”, “Engagement” and “Monetization”.

With GA4 you can analyse:

  • Traffic sources: where visitors came from (for example campaign tracking, Google search).
  • Key events (formerly conversions): you can mark any event as a key event.
  • Attribution: how did different channels influence the purchase decision? The Google Ads integration lets you compare your advertising spend directly with the revenue it generated.

By bringing website and mobile app analytics together in one view, you get a complete picture of your customer’s journey.

If you’d like me to set up GA4 and build your conversions for you, take a look at web analytics.


Key takeaways: five facts about GA4

  • GA4 is the new standard: Universal Analytics stopped collecting new data on 1 July 2023. GA4 has replaced it for good, and the old data has not been available since July 2024.
  • Everything is now an event: GA4’s flexible data model is based on events, which allows more precise tracking than UA’s session-based model.
  • Technical implementation with JavaScript: analytics only works with a JavaScript tracking code installed on the site. The recommended way to install it is Google Tag Manager (GTM).
  • Privacy is central: GA4 anonymises IP addresses by default, but transferring data from the EU to the US still raises legal challenges under GDPR.
  • AI and BigQuery are available to everyone: the new version brings predictive metrics based on machine learning and offers free access to the BigQuery data warehouse.

Frequently asked questions about Google Analytics 4

Why has using Google Analytics been seen as legally questionable in Europe?

Using Google Analytics has been found problematic in several EU countries (for example Austria, France and Finland), because the service transfers users’ data to the United States, where its processing was not then considered to meet the level of data protection that GDPR requires. Since 2023, these transfers have rested on the EU-US Data Privacy Framework.

What data does Google Analytics (GA) collect about users?

GA collects information such as session length, the pages viewed, the traffic source, the device and browser used, and the user’s ClientId, which is stored in cookies.

How can users block Google Analytics tracking?

Users can block tracking by stopping JavaScript from running, by using ad blockers or by installing the Google Analytics Opt-out browser add-on.

What is the main difference between Universal Analytics (UA) and Google Analytics 4 (GA4)?

The most significant difference is the data model: UA was based on sessions, whereas GA4 is event-based, so every interaction is an event.

Why was Universal Analytics discontinued?

UA’s technology was outdated and didn’t match the way people now use the internet on different devices. A replacement was needed that could better combine data from different platforms and meet privacy requirements.

What is web analytics generally used for?

It is used to understand and optimise how a web service is used. Businesses use it to assess how effective their advertising campaigns are and to spot pages that perform poorly.

How do you install Google Analytics on a website?

You install it by adding its JavaScript tracking code directly to the site’s HTML or, most often, by using Google Tag Manager (GTM) to make it easier to manage.

Blog

Read next

All articles
Google Tag Manager: what it is and how to use it

Guides

Google Tag Manager: what it is and how to use it

Google Tag Manager transforms the way digital marketing work gets done. In this guide I explain what GTM is, why every website needs it and how to set it up step by step, from installation all the way to the Consent Mode v2 settings.

How to stop spam on your WordPress site

Guides

How to stop spam on your WordPress site

Spam is one of the most common headaches for anyone who runs a WordPress site, but today it is easier to fight than ever. This guide covers the most effective ways to stop spam on your WordPress site, from good-quality web hosting to smart plugins and privacy-friendly CAPTCHA alternatives.

What is DNS?

Guides

What is DNS?

Without DNS, we would have to remember long strings of numbers to visit websites. This article explains in plain language what DNS is, how a lookup happens in milliseconds and why optimising your name server settings can make your browsing faster and safer.

Need a hand with this? Ask me.

Tuomas LindroosI answer myself, usually within two hours. You can also send a message through the contact form.