AttriModel
GuidesGA4
GA416 min read·Updated July 2026

How to Set Up GA4: A Complete Step-by-Step Guide (2026)

Most GA4 problems trace back to a rushed setup. This guide walks through a clean, correct GA4 installation using Google Tag Manager — the way an analytics practitioner would do it — so your data is trustworthy from day one.

What is Google Analytics 4?

Google Analytics 4 (GA4) is Google's current analytics platform, and it works fundamentally differently from the old Universal Analytics (UA) it replaced in July 2023. Understanding that difference is the key to setting it up correctly — most mistakes come from treating GA4 like UA.

The core shift is the data model. Universal Analytics was built around sessions and pageviews, with a rigid category/action/label structure for events. GA4 is built around a single, flexible primitive: the event. In GA4, everything is an event — a page view is a page_view event, a purchase is a purchase event, a scroll is a scroll event. Each event carries parameters (key–value pairs) that describe it. This event-based model is what lets GA4 track across web and app, model cross-device journeys, and feed machine-learning predictions.

ConceptUniversal Analytics (old)GA4 (current)
Core unitSession / pageviewEvent
Event structureCategory / Action / LabelEvent name + parameters
ConversionsGoals (destination, duration…)Key events (flagged events)
Cross-platformWeb onlyWeb + app in one property
Data modelAggregated tablesRaw event stream (BigQuery-ready)
IdentityClient ID (cookie)Cross-device: User-ID, Google signals, device

Because GA4 collects a raw event stream, a clean setup means being deliberate about which events you send and what parameters ride along with them — that's what the rest of this guide is about.

What you'll need before starting

Before touching GA4, make sure you have:

  • Admin access to a Google Analytics account
  • Google Tag Manager installed on your site (this guide uses GTM, not the hardcoded gtag.js snippet)
  • Edit access to your website, or a developer who can add the GTM container

Installing GA4 through GTM instead of pasting gtag.js directly is the single most important decision here. It keeps all your tracking in one place, makes future changes possible without code deploys, and is how nearly every serious analytics setup is run.

Step 1: Create your GA4 property

In Google Analytics, go to Admin → Create Property. Enter your business name, reporting time zone, and currency. Getting the time zone right matters — it defines when your "day" starts in every report, and changing it later does not retroactively fix historical data.

Once the property is created, add a Web data stream for your site. Enter your full domain (including https://) and a stream name. GA4 will generate a Measurement ID that looks like G-XXXXXXXXXX. Copy it — you'll need it in the next step.

GA4 Web stream details panel showing the Measurement ID in the G-XXXXXXXXXX format
The Web stream details panel, where GA4 shows your G-XXXXXXXXXX Measurement ID

Step 2: Add the GA4 Configuration tag in GTM

In Google Tag Manager, create a new tag:

  • Choose Google Tag as the tag type
  • Paste your G-XXXXXXXXXX Measurement ID
  • Set the trigger to Initialization - All Pages

Using the Initialization trigger (rather than the standard All Pages trigger) ensures the Google tag loads before any event tags that depend on it. Save the tag with a clear name like GA4 - Configuration.

Google Tag Manager tag editor with a Google Tag configured with a Measurement ID and the Initialization - All Pages trigger
The GA4 configuration tag in GTM: Google Tag type, your Measurement ID, firing on Initialization - All Pages

Step 3: Turn on Enhanced Measurement

In your GA4 data stream settings, enable Enhanced Measurement. This automatically tracks page views, scrolls, outbound clicks, site search, and file downloads with zero extra configuration.

Enhanced Measurement is genuinely useful, but review each toggle. Site search tracking, for example, only works if your search results pages use a query parameter GA4 can read (q, s, search, etc.). Turn off anything that doesn't apply to your site to keep your event list clean.

Step 4: Plan and create your key events

GA4 automatically collects some events, but the ones that matter to your business — form submissions, signups, purchases — need to be defined deliberately. Sketch a short measurement plan first: list the 5–10 actions that actually indicate success on your site.

For each custom action, you'll push an event to the data layer and fire a GA4 Event tag in GTM. A standard data layer push looks like this:

window.dataLayer = window.dataLayer || [];
window.dataLayer.push({
  'event': 'generate_lead',
  'form_name': 'newsletter_signup',
  'value': 0
});

Wherever possible, use Google's recommended event names (sign_up, purchase, generate_lead) rather than inventing your own. Recommended events unlock GA4's built-in reports and predictive audiences automatically.

The three tiers of GA4 events

GA4 events fall into three categories, and knowing which is which prevents a lot of confusion:

TierWho defines itExamplesYou configure?
Automatically collectedGA4 itselffirst_visit, session_start, user_engagementNo — always on
Enhanced MeasurementGA4 (toggle)page_view, scroll, click, file_download, view_search_resultsToggle in data stream
RecommendedGoogle's schema, you sendsign_up, generate_lead, purchase, add_to_cartYes — you fire these
CustomYou invent the namequote_requested, demo_bookedYes — last resort

A useful rule: reach for a recommended event name before inventing a custom one. Custom events work, but they don't benefit from GA4's prebuilt reports, and once you send a custom event name you can't rename it later without losing continuity.

Event nameWhen to fire itKey parameters
generate_leadA form/lead submissionvalue, currency, lead_source
sign_upAccount creationmethod
loginUser signs inmethod
searchOn-site search performedsearch_term
view_itemProduct/detail page viewitems, value, currency
add_to_cartItem added to cartitems, value, currency
purchaseOrder completedtransaction_id, value, currency, items

Step 5: Mark conversions (key events)

In GA4, go to Admin → Events (called "Key events" in the current interface). Toggle the events that represent real business goals — purchase, sign_up, generate_lead — as key events. Only mark what genuinely matters; every key event dilutes the meaning of your conversion reports.

Step 6: Verify everything in DebugView

This is the step most people skip, and it's why so many GA4 setups are quietly broken. Enable GTM Preview mode, then open GA4 → Admin → DebugView. As you click through your site, you should see events stream in with the correct names and parameters.

Check specifically that:

  • Each event fires once, not multiple times
  • Required parameters are populated (no undefined values)
  • page_view fires on navigation

GA4 DebugView showing a live stream of events with their parameters as the user clicks through the site
GA4 DebugView: events streaming in real time so you can confirm each fires once with correct parameters

Only after DebugView looks clean should you publish your GTM container.

Step 7: Filter out your own internal traffic

Left unaddressed, your own visits — plus your team's and your developers' — pollute every report, and on a low-traffic site they can badly skew conversion rates. Set up an internal traffic filter:

  • In Admin → Data Streams → your stream → Configure tag settings → Show all → Define internal traffic, add a rule matching your office/VPN IP addresses. This stamps qualifying traffic with traffic_type = internal.
  • In Admin → Data Settings → Data Filters, GA4 creates an "Internal Traffic" filter. Leave it in Testing mode first to confirm it's catching the right traffic, then switch it to Active to exclude it.

Do this before you launch campaigns — filters are not retroactive, so any internal traffic collected while the filter is inactive stays in your historical data.

Step 8: Configure cross-domain tracking (if needed)

If a visitor moves between domains you own — say from yoursite.com to a hosted checkout.provider.com — GA4 will, by default, treat the second domain as a new session from a referral source, breaking the journey and inflating your session count.

Fix it in Admin → Data Streams → your stream → Configure tag settings → Configure your domains. Add every domain in the journey. GA4 then passes the client ID between them via a URL parameter (_gl) so the session stays intact. While you're there, add payment providers and any other legitimate cross-domain hops to the unwanted referrals list so they don't show up as traffic sources.

If you serve regions with consent requirements, wire GA4 into your consent banner using Google Consent Mode v2. It tells Google's tags whether the user granted analytics_storage and ad_storage. When consent is denied, tags send cookieless, aggregated pings instead of full events — you keep modeled conversions while respecting the user's choice. In GTM, set default consent states to denied and update them when the user interacts with your banner. Skipping this in a regulated region is both a compliance and a data-quality problem.

Common mistakes to avoid

  • Double-tracking: installing both gtag.js directly and GA4 via GTM. Pick one — GTM.
  • Skewed data from your own visits: set up an internal traffic filter or use a GTM trigger exception for your IP.
  • Marking too many conversions: if everything is a conversion, nothing is.
  • Not documenting your setup: keep a simple sheet of every event, its parameters, and where it fires.

Frequently asked questions