Back to guides
guides

How To Set Up GA4 On Your Website Step By Step

If you are serious about understanding how your website performs, who is visiting it, and what those visitors are doing once they arrive, then setting up Google Analytics 4 is not optional, it is esse...

August 1, 2026
9 min read
How To Set Up GA4 On Your Website Step By Step

If you are serious about understanding how your website performs, who is visiting it, and what those visitors are doing once they arrive, then setting up Google Analytics 4 is not optional, it is essential. GA4 is Google's current generation analytics platform, replacing the now defunct Universal Analytics, and it brings with it a fundamentally different approach to tracking user behaviour across websites and apps. For many website owners and marketers, the transition has raised plenty of questions, and getting the setup right from the very beginning is the difference between having reliable, actionable data and flying blind. This step by step guide will walk you through exactly how to set up GA4 on your website, covering everything from creating your account through to verifying that data is flowing correctly.

Understanding What GA4 Actually Is

Before you dive into the technical process, it is worth taking a moment to understand what makes GA4 different from what came before it. Universal Analytics, which many website owners used for years, was built around sessions and pageviews as its core measurement model. GA4, by contrast, is built around events. Every interaction a user has with your website, whether that is viewing a page, clicking a button, or completing a purchase, is recorded as an event. This makes GA4 far more flexible and powerful when it comes to understanding user journeys, but it also means the setup process requires a little more thought. The good news is that once you have GA4 configured properly, the depth of insight it provides is genuinely impressive and worth every minute of the setup process.

Creating Your Google Analytics 4 Account

The first step is straightforward. Head over to analytics.google.com and sign in with the Google account you want to associate with your analytics data. If you have used Google Analytics before, you may already have an account, in which case you can add a new property to it. If you are completely new to the platform, you will be prompted to create a new account from scratch.

When creating your account, you will be asked to provide an account name. This is typically your business or organisation name. You will then move on to creating a property, which is where you name your website and select the relevant time zone and currency. These settings matter more than people realise, particularly the time zone, because all of your reporting will be anchored to whichever time zone you choose. Select the one that matches where your business operates, and if you are working across multiple regions, choose the one most relevant to your primary audience.

You will then be asked a few questions about your business, including its size and the primary ways you intend to use Analytics. These answers help Google tailor some of the default reporting views, but they do not lock you into anything permanent.

Setting Up Your Data Stream

Once your property is created, GA4 will prompt you to set up a data stream. A data stream is essentially the connection between your website (or app) and your GA4 property. For a website, you will select the Web option and then enter your website URL along with a descriptive name for the stream, something like the name of your website works perfectly well.

After confirming these details, Google will generate a Measurement ID for your property. This ID follows the format G-XXXXXXXXXX and is the unique identifier you will need when adding the tracking code to your website. Keep this to hand because you will need it in the next step.

Want more insights like this?

Join thousands of marketers getting weekly tips and strategies.

Within the data stream settings, you will also notice a section called Enhanced Measurement. This is one of GA4's most useful features and it is switched on by default. Enhanced Measurement automatically tracks a range of interactions without requiring any additional code, including scroll depth, outbound link clicks, site search queries, video engagement, and file downloads. It is worth reviewing each toggle in this section to make sure you are capturing the interactions that are relevant to your website and your goals.

Adding the GA4 Tracking Code to Your Website

This is the step where many people encounter uncertainty, but it is more approachable than it might first appear. There are two main methods for adding GA4 to your website, and the right choice depends on how your site is built and managed.

Installing Via Google Tag Manager

If you already use Google Tag Manager on your website, this is the recommended approach. Google Tag Manager allows you to manage all of your tracking scripts and tags from a single interface without needing to edit your website's code directly each time you make a change. To add GA4 through Tag Manager, log into your GTM account, create a new tag, and select Google Analytics: GA4 Configuration as the tag type. You will then enter your Measurement ID, configure the trigger to fire on all pages, and publish the container. That is broadly it. Your GA4 data will begin flowing within a short period of the tag being published.

Installing the Code Directly

If you are not using Google Tag Manager, you can add the GA4 global site tag directly to your website's HTML. Google provides you with a snippet of JavaScript code within your data stream settings. This code needs to be placed in the head section of every page on your website, ideally as close to the opening head tag as possible. If your website is built on a platform such as WordPress, Shopify, or Squarespace, each of these platforms has its own method for adding custom code or a specific field for your GA4 Measurement ID, which makes the process considerably simpler. Most modern themes and site builders have a dedicated analytics or tracking section in their settings where you can paste your ID directly.

Configuring Key Events and Conversions

Installing the tracking code is only part of the picture. To get real value from GA4, you need to define what success looks like for your website and make sure GA4 is measuring those specific outcomes. In GA4, the actions you care most about are marked as key events, which were previously referred to as conversions in the platform.

GA4 automatically tracks a number of events out of the box, including page views and sessions, but if you want to track specific actions such as a contact form submission, a product purchase, a newsletter sign-up, or a phone number click, you will need to either configure these through Google Tag Manager or set them up within GA4 itself using its event creation tools. Within GA4, navigate to the Admin section, then to Events under your property. From here you can create new events based on existing ones and mark them as key events so they appear prominently in your reporting.

For e-commerce websites, GA4 offers a comprehensive e-commerce tracking framework that can capture product impressions, add to cart events, checkout steps, and purchase completions. This does require more detailed implementation, often via Google Tag Manager with a properly configured data layer, but the reporting it unlocks is among the most valuable data a retailer can access.

Verifying That Your Setup Is Working

Once everything is in place, the most important thing you can do is verify that data is actually being collected correctly. GA4 provides a Realtime report that shows you active users on your website at that very moment. Open your website in a browser, navigate to the Realtime section within GA4, and you should see yourself reflected in the data within a matter of seconds. If you see activity, your basic setup is working.

For a more thorough check, use the Google Tag Assistant browser extension, which can confirm whether your GA4 tag is firing correctly on each page. If you installed via Google Tag Manager, GTM's built-in Preview mode is an equally powerful way of verifying that your tags are triggering as expected before you publish any changes.

It is also worth connecting your GA4 property to Google Search Console if you have it set up for your website. This connection enriches your GA4 data with organic search performance information, giving you a much more complete picture of how people are finding and engaging with your content.

Linking GA4 to Google Ads

If you run paid search campaigns, linking your GA4 property to your Google Ads account is a step well worth completing. This link allows you to import your GA4 key events into Google Ads as conversion actions, enabling your campaigns to optimise towards the outcomes that genuinely matter to your business rather than simply generating clicks. The linking process is managed through the Admin section of GA4 under Product Links, and once connected, the data flows between the two platforms automatically.

Getting the Most From Your GA4 Data

Setting up GA4 correctly is the foundation, but the value comes from actually using the data it provides. The Acquisition reports will show you where your traffic is coming from, the Engagement reports will reveal which pages and content resonate most with your audience, and the Monetisation reports are invaluable for anyone running an online shop. GA4's Explore section also offers a powerful suite of custom reporting tools, including funnel exploration and path analysis, which allow you to dig into user behaviour in ways that simply were not possible with the previous generation of analytics.

One thing that catches many people out is that GA4 processes data differently from Universal Analytics, and some reports have a short data processing delay. Do not be alarmed if some of the more detailed reports take a few hours to populate fully. The Realtime report, however, updates immediately and is your first port of call when checking that everything is functioning as it should.

A Final Word on Getting Set Up Properly

Knowing how to set up GA4 on your website step by step is one of the most valuable things you can do for your digital marketing efforts, regardless of whether you run a small business site or a large e-commerce operation. The data GA4 provides, when configured properly and used consistently, gives you the foundation to make informed decisions about your content, your marketing channels, and your website's user experience. Take the time to get it right from the beginning, verify everything is tracking correctly, and make sure your key events reflect the outcomes that genuinely matter to your business. Everything else flows from having that reliable, accurate data in place.

I

Ian

Ian has worked in Digital Marketing for decades, and is a Google Partner for Google Ads and an expert in onsite and technical SEO. He has worked with hundreds of clients, helping them achieve success online, through SEO, PPC and Digital Marketing, working with local businesses through to national retailers.

View all posts →

Related Articles