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.
- Enter an account name (usually your company name) and your country.
- Enter a container name. Your website address works well.
- Choose Web as the target platform.
- 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.
- In your GTM workspace, go to Tags and click New.
- Click Tag Configuration, choose Google Analytics, then Google Analytics again. (Choosing Google Tag as the tag type also works.)
- Paste your “G-” Measurement ID as the tag ID.
- Under Triggering, choose Initialization – All Pages so the tag loads on every page before other tags.
- 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.
Step 8: Link Google Search Console
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.











