Anobee

Website Growth

Google Analytics Setup: How to Set Up GA4 on a Website, Step by Step

By Bibek Thapa · Updated · 14 min read

Quick Answer

Google Analytics setup takes four steps: create a GA4 property, add a web data stream, install its Google tag through one method only, then confirm data in Realtime and DebugView. Afterwards, set data retention to 14 months, link Search Console, and mark one or two real business outcomes as key events. Data can take up to 30 minutes to start.

Google Analytics setup in four parts: create the GA4 property, add a web data stream, install one Google tag, and verify the data, with a warning not to install the tag twice
Table of ContentsOn this page
  1. What you need before starting
  2. Step 1: Create the account and GA4 property
  3. Step 2: Add a web data stream
  4. Step 3: Install the Google tag once
  5. Step 4: Check GA4 is installed correctly
  6. Step 5: Change the settings that limit your reports
  7. Troubleshoot your Google Analytics setup
  8. Google Analytics setup checklist
  9. Frequently Asked Questions
  10. Sources and References
Key Takeaways
  • Create the GA4 property and web data stream before installing anything on the site.
  • Pick one installation route: a CMS integration, Google Tag Manager or the Google tag in code. Two routes double-count.
  • Check Realtime after installing. On Anobee, page_view and session_start appeared within seconds of a test visit.
  • Set event data retention to 14 months on day one. It controls how far back explorations and funnel reports can go.
  • Mark outcomes as key events, not attempts. Anobee counts newsletter_success, not newsletter_submit.
  • Test an internal-traffic filter before activating it. An active exclude filter permanently discards data.

A Google Analytics setup has four parts: an Analytics account, a GA4 property, a web data stream, and one Google tag on the website. None of them is hard. Most broken installs come from the choices around them. Typical ones are the wrong property, the same tag added twice, an unpublished Tag Manager workspace, or a key event marked on something that never fires.

This guide covers how to set up Google Analytics 4 and how to check it is working. It also covers the settings that quietly limit your reports if you leave them alone. Each step shows how Anobee's own GA4 property is configured, so you see a real, working setup.

How this guide was checked: every step was compared with Google's Analytics and Tag Manager help pages on 3 November 2026. The screenshots come from Anobee's GA4 property on the same day. Settings were viewed only, never changed or saved, and the account owner's name and email are cropped out. Google renames menu items from time to time, so follow the linked documentation if your screen differs.

Before you open the setup screen, write down one or two outcomes you want to measure. A completed enquiry, a purchase or a newsletter signup are typical. Google Analytics records visits and events. It does not know which of them matter to your business, and you will need that list for key events.

What you need before starting

Have these ready:

  • a Google account controlled by the business or site owner
  • permission to create or edit a Google Analytics property
  • access to the site's CMS, global code settings, templates or Tag Manager container
  • the reporting time zone and currency you want
  • a decision about who keeps administrator access

When an agency or freelancer helps, the business should still own the Analytics account. Give collaborators the lowest access level they need, and never make an outside party the only administrator.

Check whether Analytics is already installed. Run the site through Tag Assistant. Then look in the CMS settings or page source for a G- tag ID or a GTM- container ID. A second installation on top of an existing one duplicates page views and events.

Step 1: Create the account and GA4 property

Go to Google Analytics and sign in. For a first account, select Start measuring. If an account already exists, open Admin and select Create, then Account or Property.

Give the account a durable business name. Read the data-sharing options instead of accepting them unread, because they control how account data may be shared with Google.

For the property, Google asks for these fields [1]:

  1. A recognisable property name, usually the site or business name.
  2. The reporting time zone your team works in.
  3. The currency used for revenue reporting.
  4. Industry, business size and how you intend to use Analytics.
  5. Accept the terms and select Create.

Time zone and currency deserve the most care. Changing them later affects reporting from that point on rather than rewriting past data. Business objectives only tailor the default report collection. They do not change what the tag collects.

Anobee's choice: the property uses the Nepal time zone (GMT+05:45) and US dollars. The team works in Nepal, so daily reports should close at midnight Kathmandu time. The site's readers and any revenue are mostly international, so dollars are easier to compare with ad and affiliate statements.

GA4 Property details for Anobee with the reporting time zone set to Nepal, GMT+05:45, and the currency displayed as US Dollar
Anobee's GA4 property details, 3 November 2026. Changing time zone or currency later does not rewrite past data.
LevelWhat it representsTypical website setup
AccountThe organisation that owns the measurementOne business account
PropertyThe reporting container for a related digital experienceOne property for the website or connected journey
Data streamA source that sends data into the propertyOne web stream for the main site

Do not combine unrelated businesses in one property just because the interface allows several streams. Keep sites together only when they belong to the same customer journey and you want them reported as one.

Step 2: Add a web data stream

Continue from property creation and choose Web. For an existing property, go to Admin, then Data streams, then Add stream, then Web [1].

Enter the main website URL and a clear stream name. Enhanced measurement automatically collects page views and other events, and Google recommends enabling it when you create the stream [1]. Open its settings anyway. It can record scrolls, outbound clicks, site search, video engagement, file downloads and some form interactions without extra code. Keep only the interactions that fit your measurement and privacy plan.

Select Create stream. Stream details then shows a tag ID, usually called the Measurement ID, in the format G-XXXXXXXXXX [1]. Copy the ID from your own property, never one shown in a tutorial.

GA4 web stream details showing Enhanced measurement and a redacted Measurement ID
The Measurement ID starts with G-. View tag instructions, marked 3, is where Option C begins.

Anobee has one web stream, named Anobee, for https://anobee.com. Its stream list shows "Receiving traffic in past 48 hours", which is the quickest sign that the stream is alive.

Step 3: Install the Google tag once

Choose one installation route. The right one depends on how the site is built and who will maintain its tracking.

Installation methodBest fitWhat to enter or install
Native CMS integrationThe platform has a maintained GA4 field or official connectionUsually the G- tag ID
Google Tag ManagerThe site already uses GTM, or needs several tags and custom events managed centrallyA Google Analytics tag with the GA4 tag ID
Direct Google tagA developer controls the shared template and no tag manager is neededThe complete gtag.js snippet, or a framework component that loads it
Decision tree for choosing a CMS integration, Google Tag Manager, or direct Google tag installation
Pick one route. A CMS integration plus a pasted tag sends every page view twice.

Never use two routes for the same tag ID. Double installation is the most common Google Analytics setup fault. A WordPress plugin plus a manually pasted Google tag will send every page view twice.

Option A: Use a supported CMS integration

For a small website, a maintained integration is usually the least fragile choice. Google publishes platform-specific instructions and notes that accurate measurement needs the tag on every page [2].

Open the platform's analytics settings, enter the G- tag ID if asked, save, publish, and clear caches. Follow Google's instructions for your specific CMS rather than pasting a generic snippet into whatever text field you can find.

On WordPress, Site Kit by Google connects the site to GA4 without touching theme files. It is Google's own plugin and lists more than five million active installations. Avoid putting tracking code in a parent theme's header.php file. A theme update can overwrite it, and one syntax mistake can break the site.

Option B: Install GA4 through Google Tag Manager

Use this route when the site already has a working GTM web container, or needs a versioned workflow for several tags. Do not add a second container just for GA4.

Google's current recommended method adds a Google Analytics tag rather than a standalone Google tag [3]:

  1. Open the correct web container and select Tags, then New.
  2. Name the tag clearly, for example "GA4, example.com".
  3. Open Tag Configuration, then choose Google Analytics, then Google Analytics.
  4. Paste the GA4 tag ID into the Tag ID field.
  5. Under Triggering, select Initialization, All Initialization Events.
  6. Save, select Preview, and connect the site in Tag Assistant.
  7. After a clean test, select Submit, publish, and give the version a name.

Google still lists the Google Tag tag type as an alternate method, with the same Tag ID and initialization trigger [3]. Older guides tell you to create a "GA4 Configuration" tag. That tag type has been replaced, so skip any tutorial that still uses it.

Google Tag Manager tag using the alternate Google Tag type, with a redacted GA4 tag ID and an Initialization trigger
The alternate method: a Google Tag with the GA4 tag ID. Google's recommended method uses the Google Analytics tag type with the same tag ID and trigger.

If GTM is not installed yet, start with the Google Tag Manager setup guide. Installing GTM needs both container snippets, which is outside this GA4 procedure.

Option C: Add the Google tag directly

Open the web stream, select View tag instructions, and choose Install manually. Copy the entire Google tag shown for that stream. Add it immediately after the opening head tag on every page, through the shared template or a global code feature [1].

Hand this to a developer when you cannot safely edit the shared HTML. Clear application, page and CDN caches after deployment. Then test more than the homepage, because a tag placed in one template can leave articles, products or checkout pages unmeasured.

How Anobee installs it: anobee.com is a Next.js site, so it uses Option C through the framework. The GoogleAnalytics component from the @next/third-parties package sits in the site's shared layout. That puts the Google tag on every page from one place [12]. There is no Tag Manager container and no plugin, so nothing can load the tag a second time. Custom events, such as scroll depth on articles, go through the same package. They are sent only after the Google tag has started, so an early click cannot create an event the property never receives.

Step 4: Check GA4 is installed correctly

Verification has two layers, and a Google Analytics setup is only finished when both pass. First prove that the tag loads on the website, then prove that the intended GA4 property receives the events.

Check Realtime first

In GA4, open Reports, then Realtime. Visit the site in another tab and move between a few pages. Google says data collection may take up to 30 minutes to begin, so a short delay is not a failure [1].

Anobee's test on 3 November 2026: a visit to this guide appeared in Realtime within about 10 seconds. The "Views by page title" card showed one view of the guide, and the "Event count" card showed page_view and session_start. At the same moment, the "Active users in last 30 minutes" card still read 0. So read the event cards, not only the user count, when you test.

GA4 Realtime event count card showing one page_view and one session_start event from a test visit to the Google Analytics setup guide
Realtime overview, Event count by Event name, a few seconds after a test visit.

Check the tag with Tag Assistant

Open Tag Assistant, add the site URL and connect. Browse several important page types during the session and confirm that:

  • the connected domain is correct
  • the expected G- tag ID appears
  • the tag fires once per page load
  • other page templates also produce a page view
  • the consent state matches what the site intends

Tag Assistant only proves what the browser tried to send. Realtime proves the right property received it.

GA4 verification workflow from Tag Assistant to Realtime and DebugView
Tag Assistant proves the browser sent it. Realtime and DebugView prove the right property received it.

Use DebugView for detail

Enable debug mode through Tag Assistant or GTM Preview, then open Admin, Data display, DebugView. It shows events and user properties from a debug-enabled device in real time [4]. Look for:

  • page_view when a page loads or the route changes
  • session_start for your test session
  • Enhanced measurement events only when the matching interaction happens
  • the correct page location and no sensitive parameters

Never send names, email addresses, phone numbers, form contents or any other personally identifiable information as event names, values or parameters.

Step 5: Change the settings that limit your reports

A page view arriving in Realtime proves the install. It does not make the property useful. Most tutorials stop before these parts of a Google Analytics setup.

Set data retention to 14 months

Open Admin, then Data collection and modification, then Data retention. Standard properties can keep event data and user-level data for 2 or 14 months [10]. Choose 14 months unless your privacy policy requires less.

The setting only affects explorations and funnel reports, not the standard aggregated reports [10]. That is why it gets missed. Everything looks fine until you compare this quarter with last year in an exploration, and the data is gone. When you increase the period, Google applies it to data already collected [10], so change it on day one.

Anobee's property has both event data and user data set to 14 months, with "Reset on new user activity" switched on.

GA4 User and event data retention settings with event data and user data both set to 14 months
Admin, Data retention, Anobee property, 3 November 2026. Retention only affects explorations and funnel reports, which is why it is easy to miss.

GA4 can show organic search queries and landing pages from Search Console. In Admin, under Product links, open Search Console links and select Link. You need the Editor role on the GA4 property and must be a verified owner of the Search Console property [11].

Each web stream can link to only one Search Console property. Search Console data then appears in Analytics about 48 hours after Search Console collects it [11]. The Search Console reports are also unpublished by default, so publish them from the Library afterwards.

Anobee linked its URL-prefix Search Console property (https://anobee.com/) to its web stream on 16 July 2026. If Search Console is not set up yet, the Google Search Console setup guide covers verification first. The GA4 vs Google Search Console comparison explains which questions each tool answers once both are connected.

GA4 Search Console links table showing the URL-prefix property https://anobee.com/ linked to the Anobee web stream on 16 July 2026
Admin, Product links, Search Console links. The column showing who linked it is hidden.

The implementation must match the site's privacy notice, consent choices, contracts and the law where your visitors are. Requirements vary by location and data use, and this is not legal advice.

Does the business get traffic from the EEA and use Google advertising products? Then review Google's consent requirements and check the signals the implementation sends [5]. A consent banner and Consent Mode do different jobs. The banner asks for and records a visitor's choice. Consent Mode passes that choice to Google tags. Tag Manager does neither on its own.

Test the tag before consent, after acceptance and after rejection. DebugView may show nothing when consent settings prevent collection [4].

Mark outcomes as key events

A key event is GA4's name for an event that measures an action important to the business. A completed enquiry, purchase or account creation can qualify; an ordinary page view usually does not. Confirm the underlying event in DebugView first, then mark it as a key event, and check it in Realtime afterwards [6].

Anobee's property shows why the choice of event matters. The site sends newsletter_submit every time someone presses the signup button, and newsletter_success only after the signup is confirmed. The key event is newsletter_success, together with contact_success, form_submit and purchase. On 3 November 2026, none of those four had stream data in the previous 28 days, while newsletter_submit did.

GA4 key events list for Anobee with contact_success, form_submit, newsletter_success and purchase, each showing no stream data detected in the last 28 days
Admin, Events, Key events tab, 3 November 2026. newsletter_submit, the attempt, appears under Recent events instead.

So the empty report is accurate. Marking the attempt instead would have counted conversions for signups that never completed. Mark the outcome, keep the list short, and expect a small site's key events to stay at zero for weeks at a time.

Is the report empty for longer than you expect? Compare the names under Key events with the Recent events list in Admin, then Events. A key event whose name never appears in Recent events is either misspelled or never sent.

Test internal-traffic filtering before activating it

Visits from owners, staff or an agency can distort reports on a small site. GA4 can identify internal traffic by IP address and exclude it with a data filter. Each property can have up to 10 data filters [7].

Start the filter in Testing state. An active filter is permanent: excluded data is never processed and will never be available in Analytics or BigQuery [7]. Confirm the test results before switching it to Active.

Troubleshoot your Google Analytics setup

When a Google Analytics setup shows no data, work through the system in order. Check the website, tag, consent and network request, then the receiving property. Changing several settings at once makes the cause harder to find.

SymptomLikely causeWhat to check
No tag in Tag AssistantMissing code, wrong template, cache, content security policy or unpublished changeInspect the rendered page and test several templates
Tag fires but Realtime is emptyWrong G- ID, wrong property, consent blocking collection or a browser extensionCompare the tag ID character by character and test a consented session in a clean browser profile
Realtime shows events but 0 active usersThe user card has not refreshed yetWait a minute and read the event count card
Page views appear twiceA direct tag and a CMS or GTM installation are both activeList every installation route and keep one
Homepage works but articles do notThe tag sits in only one templateMove it to the global layout or a sitewide integration
GTM Preview works but the live site does notThe workspace was saved but not published, or a cache serves old HTMLPublish a named container version and clear caches
Key events stay at 0The outcome has not happened, or the marked event name is never sentCompare Key events with Recent events in Admin
Old data missing from explorationsData retention left at 2 monthsChange event data retention to 14 months
Reports include staff visitsInternal traffic is not defined or its filter is inactiveDefine internal traffic, test the filter, then activate it
GA4 no-data troubleshooting flow from website code to tag, consent, request, and property checks
Change one thing at a time. Fixing several at once hides which one was the cause.

Google's troubleshooting guide recommends checking the Measurement ID, network requests, browser extensions and consent configuration [8]. If nothing appears after the first 30 minutes, repeat the checks with only one installation method active and the correct property open.

Google Analytics setup checklist

  • The business owns the Analytics account and has backup administrator access.
  • The property uses the intended time zone and currency.
  • The web stream points to the canonical production site.
  • Enhanced measurement settings match the measurement and privacy plan.
  • One installation method sends data to the correct G- tag ID.
  • Realtime shows page_view and session_start for a test visit.
  • Tag Assistant detects the tag across important page templates.
  • No personally identifiable information appears in event data.
  • Event data retention is set to 14 months.
  • Search Console is linked.
  • Consent behaviour has been tested for the audiences that matter.
  • Key events are outcomes, verified in DebugView before being marked.
  • Internal-traffic filters were tested before activation.

Standard Google Analytics has no subscription charge. Analytics 360 is a separate paid enterprise product [9].

Keep a short setup record. Note the property ID, stream ID, installation method, consent behaviour, key events, retention setting and the date you last checked it. It makes future troubleshooting faster and a duplicate installation far less likely.

Once those checks pass, the next useful step is not adding every possible event. Connect one important business action to a verified event, then use the reports to answer a real question. If some rows show "(not set)", the guide to GA4 (not set) values explains where each one comes from. For a second view of on-page behaviour, the Microsoft Clarity guide adds heatmaps and session recordings. When the data is stable, the conversion rate optimization guide shows how to turn what you see into a disciplined testing process.

Frequently Asked Questions

Is Google Analytics 4 free?

Yes. Google provides the standard Google Analytics product free of charge. Google Analytics 360 is a separate paid enterprise product. You may still pay for consent management, implementation help or consulting.

How do I know if GA4 is installed correctly?

Visit your site in one tab and open Reports, then Realtime, in another. A page_view and session_start for your visit should appear. Then use Tag Assistant to confirm the correct G- tag ID fires once per page across several page types, and DebugView to check the event parameters.

How long does GA4 take to start showing data?

Google says data collection may take up to 30 minutes to begin. A correctly installed tag often shows in Realtime within seconds or minutes. If nothing appears after 30 minutes, check the tag ID, the consent state, browser blockers and the installation method.

Do I need Google Tag Manager to install GA4?

No. A supported CMS can take the GA4 tag ID, and a developer can add the Google tag directly. Anobee, for example, loads it from its Next.js layout without Tag Manager. Tag Manager is worth it when you need versioned control over several tags or custom events.

Where do I find my GA4 Measurement ID?

In Admin, under Data collection and modification, open Data streams and select your web stream. The Measurement ID appears in Stream details and begins with G-.

Why does my GA4 key events report show zero?

Either nothing important happened in the period, or the event you marked never fires. Open Admin, then Events, and compare the key event names with the Recent events list. A key event set on a success event will stay at zero until someone actually completes that action.

Sources and References

  1. Google Analytics Help: Set up Analytics for a website and/or app ↩
  2. Google Analytics Help: Install your Google tag with a website builder or CMS ↩
  3. Tag Manager Help: Set up Google Analytics in Tag Manager ↩
  4. Google Analytics Help: Monitor events in DebugView ↩
  5. Google Analytics Help: Verify and update consent settings ↩
  6. Google Analytics Help: Report on key events ↩
  7. Google Analytics Help: Filter out internal traffic ↩
  8. Google for Developers: Verify and troubleshoot Google Analytics ↩
  9. Google Marketing Platform: Google Analytics ↩
  10. Google Analytics Help: Data retention ↩
  11. Google Analytics Help: Connect Search Console to Google Analytics ↩
  12. Next.js Docs: Third Party Libraries ↩

Was this guide helpful?

Your answer helps Anobee improve future updates.

Bibek Thapa

Written by

Bibek Thapa

AI-Powered Digital Growth Strategist

Bibek Thapa works across AI workflows, SEO, AI search optimization, content strategy, website growth, and productivity systems at Anobee.

  • AI workflows
  • Digital growth
  • SEO
  • GEO
  • AEO
  • Content strategy
  • Website growth

Related Articles