Skip to content

Analytics

Google Analytics 4 Setup: A Step-By-Step Guide

You cannot improve a website you do not measure. This guide walks you through setting up Google Analytics 4 with Google Tag Manager, from the first property to key events.

Analytics dashboard on a laptop showing load time vs bounce rate charts, 479K sessions and 40.6% bounce rateGoogle Analytics 4 Setup: A Step-By-Step Guide

Google Analytics is Google’s free tool for measuring your website’s traffic and how visitors behave once they arrive. Without it, you are guessing which pages work and which campaigns bring customers. This guide sets up Google Analytics 4 (GA4) through Google Tag Manager (GTM), so you can add and change tracking later without editing your site’s code each time.

Note: Universal Analytics stopped processing data for standard properties on July 1, 2023, and Google removed access to its interface and data on July 1, 2024 (Google Analytics Help). Every step below is for GA4. Google updates menu labels from time to time, so if a name on your screen differs slightly, look for the closest match.

What You Need Before You Start

  • A Google account that your business controls, not a personal account that belongs to one employee.
  • Access to your website’s code or to a CMS (content management system) setting where you can paste scripts into every page.
  • A short list of the actions that matter on your site, such as enquiries, sign-ups or purchases.

Step 1: Create Your GA4 Account and Property

Go to analytics.google.com and sign in. If you are new to Google Analytics, it walks you through creating an account. If you already have one, open Admin, click Create and select Property.

Name the property after your website, then set your reporting time zone and currency. Answer the short questions about your business and goals, and accept the terms.

Step 2: Add a Web Data Stream

A data stream is the source that sends data to your property. In Admin, under Data collection and modification, open Data streams, click Add stream and choose Web. Enter your website URL and a stream name.

Leave Enhanced measurement switched on. It automatically collects page views and common interactions such as scrolls, outbound clicks and file downloads (Google’s setup guide).

Copy the Measurement ID. It starts with “G-” and tells Google Analytics which property should receive your data. It appears in your site’s code, so it is not a secret, but do protect access to the Google Analytics account itself.

Step 3: Create a Google Tag Manager Container

Go to tagmanager.google.com and sign in with the same Google account. Click the Accounts tab, then Create Account.

  1. Enter an account name (usually your company name) and your country.
  2. Enter a container name. Your website address works well.
  3. Choose Web as the target platform.
  4. Click Create and accept the terms of service.

GTM lets you manage tracking tags for Google Analytics, ad platforms and tools such as heatmaps in one place, and publish changes without a developer each time (Tag Manager Help).

Step 4: Install the Tag Manager Code on Your Site

After you create the container, GTM shows two code snippets. Paste the first as high as possible inside the <head> of every page, and the second immediately after the opening <body> tag. Many CMS platforms and themes have a field for this, so check before you edit template files.

If you lose the snippets, you can find them again from your container’s workspace by clicking your container ID (it starts with “GTM-”).

Step 5: Add the Google Analytics Tag in Tag Manager

Now connect Tag Manager to GA4 with a tag and a trigger. A tag tells GTM what to send and where, and a trigger tells it when.

  1. In your GTM workspace, go to Tags and click New.
  2. Click Tag Configuration, choose Google Analytics, then Google Analytics again. (Choosing Google Tag as the tag type also works.)
  3. Paste your “G-” Measurement ID as the tag ID.
  4. Under Triggering, choose Initialization – All Pages so the tag loads on every page before other tags.
  5. Name the tag clearly, such as “GA4 – Google tag”, and click Save.

These steps follow Google’s Tag Manager instructions. Older guides tell you to choose a Universal Analytics tag. That tag type no longer collects data, so ignore those instructions.

Step 6: Preview, Then Publish

Click Preview in GTM, enter your website URL and click Connect. Tag Assistant opens your site and shows which tags fired. Check that your Google Analytics tag appears under tags fired.

Then click Submit, name the version (for example, “Add GA4”) and click Publish. Open Reports and then Realtime in Google Analytics, visit your site in another tab, and confirm that your visit appears.

Step 7: Mark Your Key Events

Next, tell Google Analytics what success looks like on your site. Universal Analytics called these goals. GA4 uses events, and you mark the important ones as key events (Google previously called them conversions).

In Admin, under Data display, click Events. Find the event that represents success, such as generate_lead or purchase, and mark it as a key event (Google Analytics Help). If the action you need is not collected yet, create a GA4 event tag in GTM (the tag type is Google Analytics: GA4 Event) that fires on the right button click or thank-you page.

Keep the list short. Three to five key events that match real business outcomes are easier to act on than twenty.

Google Search Console shows how your site appears in Google Search, including the searches that bring people to your pages. Linking it to GA4 puts search data and on-site behavior side by side.

In GA4, open Admin, go to Product links and click Search Console links. Click Link, choose your verified Search Console property, select your web data stream and submit (Google Analytics Help). Our guide to SEO basics that still matter in AI search explains why this data is worth watching.

What to Check in Your First Month

  • Traffic sources: which channels send visitors who complete key events.
  • Landing pages: which entry pages keep visitors engaged.
  • Engagement rate: GA4’s main measure of whether visits are meaningful. Our article on bounce rate vs exit rate explains how it relates to bounce rate.
  • Referrals from AI tools: look for sources such as chatgpt.com, perplexity.ai and gemini.google.com in your traffic acquisition report.

Google Analytics shows what your website is missing and what to change. Classic analytics does not show how AI assistants such as ChatGPT, Gemini, Claude, Perplexity and Google AI Overviews describe your brand, though. Apex®, the AI-native digital experience platform (DXP), adds GEO (generative engine optimization) intelligence, including prompt tracking and citation monitoring, alongside its analytics and insights.

FAQs

Questions, Answered

Can’t find what you’re looking for? Our team is happy to help.

What is Google Analytics 4?

Google Analytics 4 (GA4) is the current version of Google's free tool for measuring website traffic and how visitors behave once they arrive. It replaced Universal Analytics and tracks activity as events, such as page views, scrolls and purchases. Without it, you are guessing which pages work and which campaigns bring customers.

Is Universal Analytics still available?

No. Universal Analytics stopped processing data for standard properties on July 1, 2023, and Google removed access to its interface and data on July 1, 2024. Every new setup should use GA4, and older guides that tell you to create a Universal Analytics tag in Google Tag Manager are out of date.

Why set up GA4 through Google Tag Manager?

Setting up GA4 through Google Tag Manager (GTM) lets you add and change tracking later without editing your website's code each time. GTM manages tags for Google Analytics, ad platforms and tools such as heatmaps in one place, so changes can be published without a developer.

What do I need before setting up Google Analytics 4?

You need a Google account that your business controls, not a personal account belonging to one employee. You also need access to your website's code or a CMS setting where you can add scripts to every page, plus a short list of the actions that matter on your site, such as enquiries, sign-ups or purchases.

What are a data stream and a Measurement ID?

A data stream is the source that sends data to your GA4 property, such as your website. The Measurement ID, which starts with "G-", tells Google Analytics which property should receive that data. The ID appears in your site's code, so it is not secret, but access to the Google Analytics account itself should still be protected.

Where do I install the Google Tag Manager code?

Google Tag Manager provides two code snippets. Paste the first as high as possible inside the head of every page, and the second immediately after the opening body tag. Many CMS platforms and themes have a field for these snippets, so check that before editing template files.

Which trigger should the Google Analytics tag use in Tag Manager?

Use the Initialization All Pages trigger, so the Google Analytics tag loads on every page before other tags. In GTM, create a new tag, choose Google Analytics and then Google Analytics again (or the Google Tag type), paste your "G-" Measurement ID as the tag ID and name the tag clearly before saving.

How do I check that GA4 tracking works?

Click Preview in Google Tag Manager, enter your website URL and connect. Tag Assistant shows which tags fired, so confirm that the Google Analytics tag appears. Then submit and publish the container version, open the Realtime report in Google Analytics and visit your site in another tab to see your own visit appear.

What are key events in GA4?

Key events are the GA4 events you mark as important business outcomes, such as generate_lead or purchase. Universal Analytics called these goals, and Google previously called them conversions in GA4. Mark them in Admin under Events, and create a GA4 event tag in Tag Manager if the action you need is not collected yet.

How many key events should I track?

Three to five key events that match real business outcomes are usually enough. A short list, such as enquiries, sign-ups and purchases, is far easier to act on than twenty events. Add more only when there is a clear decision you will make with the data.

Why link Google Search Console to GA4?

Linking Google Search Console to GA4 puts search data next to on-site behavior, so you can see which searches bring people to your pages and what they do after they arrive. In GA4, open Admin, go to Product links, choose Search Console links, select your verified property and web data stream, and submit.

What should I check in GA4 in the first month?

Check traffic sources to see which channels send visitors who complete key events, landing pages to see which entry pages keep people engaged, and engagement rate, GA4's main measure of meaningful visits. Also look for referrals from AI tools such as chatgpt.com, perplexity.ai and gemini.google.com in the traffic acquisition report.

Put It Into Practice

Want Help Putting These Ideas to Work in Your Business?