The Analytics Blog
Analytics Tools

How to Set Up Google Analytics 4: Complete Guide for Beginners

· 11 min read
How to Set Up Google Analytics 4: Complete Guide for Beginners

Google Analytics 4 powers 14.8 million websites and holds 65% of the web analytics market. Whether you are launching a new site or finally replacing an old Universal Analytics setup, GA4 is the default starting point for understanding how people use your website.

But a default GA4 installation misses critical settings. The default data retention is just 2 months. Consent Mode is not configured. Key events are not defined. BigQuery export is not enabled. Most businesses run GA4 for months before realizing they are missing data they can never recover.

This guide walks you through every step — from creating your account to advanced configuration — so your GA4 setup is complete, accurate, and future-proof from day one.

TL;DR — GA4 Setup Essentials

  • Create property: Set time zone, currency, and industry. Takes 2 minutes.
  • Install tracking: Use Google Tag Manager (recommended), gtag.js, or a CMS plugin. Never use two methods simultaneously.
  • Change data retention: Switch from 2 months to 14 months immediately — this is the most commonly missed setting.
  • Set up key events: Mark your most important conversions (form submissions, purchases, sign-ups). Maximum 30 per property.
  • Configure Consent Mode v2: Required if you serve EU/EEA visitors. Use Advanced Mode for better data coverage.
  • Link products: Connect Google Ads, Search Console, and BigQuery on day one — BigQuery does not backfill historical data.
GA4 setup process overview showing 7 steps: create account, configure data stream, install tracking code, verify installation, post-setup configuration, consent mode, and link Google products

What You Need Before You Start

Before creating your GA4 property, make sure you have:

The entire setup takes 30–60 minutes if you follow every step in this guide. The core installation takes under 10 minutes.

Step 1 — Create Your GA4 Account and Property

Go to analytics.google.com and sign in with your Google account.

For new users

Click “Start measuring” and enter your account name (typically your company name). Under account data sharing settings, review and confirm the options — the defaults are fine for most businesses.

For existing users

Click Admin (gear icon, bottom left) → CreateProperty.

Property settings

Enter your property name (e.g., “My Website — Production”), then configure:

On the next screen, select your business objectives. GA4 uses these to customize your default reports. You can select multiple, but “Get baseline reports” is a safe starting choice that includes all standard reports.

Pro Tip
In 2026, GA4 features an enhanced onboarding assistant that auto-suggests industry-relevant settings during property creation. It also enables Analytics Advisor — an AI tool that lets you ask questions about your data in natural language.

Step 2 — Configure Your Web Data Stream

After creating your property, GA4 asks you to set up a data stream. A data stream is the connection between your website (or app) and your GA4 property.

Select Web as your platform. Enter your website URL and a stream name (e.g., “Main Website”).

GA4 generates your Measurement ID — a code in the format G-XXXXXXX. This ID is what connects your website to your GA4 property. Copy it — you will need it in the next step.

Enhanced Measurement

Enhanced Measurement is enabled by default and automatically tracks these events without any extra code:

GA4 Enhanced Measurement showing 7 auto-tracked events: page views, scrolls, outbound clicks, site search, video events, file downloads, and form interactions — all enabled by default with no extra code

Review these settings in your data stream configuration. You can toggle individual events on or off, but keeping all of them enabled is recommended for most sites.

Step 3 — Install Your GA4 Tracking Code

There are three ways to add GA4 to your website. Choose one — never use two methods simultaneously, as this causes double-tracking and inflated data.

Method 1: Direct code (gtag.js)

Best for: developers, simple websites, landing pages.

In your GA4 property, go to Admin → Data Streams → [Your Stream] → View tag instructions → Install manually. Copy the code snippet and paste it immediately after the opening <head> tag on every page of your site.

The snippet looks like this:

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', 'G-XXXXXXX');
</script>

Replace G-XXXXXXX with your actual Measurement ID.

Pros: Simple, fast, no dependencies. Cons: Code changes required for updates, no version control, harder to manage multiple tags.

Method 2: Google Tag Manager (recommended)

Best for: most businesses, marketing teams, sites with multiple tracking tools.

  1. Create a Google Tag Manager account and container if you do not have one.
  2. In GTM, click New Tag → Tag Configuration → Google Analytics: GA4 Configuration.
  3. Enter your Measurement ID (G-XXXXXXX).
  4. Set the trigger to “All Pages”.
  5. Click Preview to test, then Submit to publish.

Pros: No-code tag management, version control, preview mode for testing, supports all tag types. Cons: Slightly steeper learning curve, container script adds a small amount of load time.

Method 3: CMS plugin

Best for: non-technical users on supported platforms.

Which method should you choose?

Comparison of 3 GA4 installation methods: gtag.js for developers, Google Tag Manager recommended for most businesses, and CMS plugins for beginners. Warning: never use two methods at once.
Factorgtag.jsGoogle Tag ManagerCMS Plugin
Setup difficultyEasyMediumEasiest
FlexibilityLowHighLow
Multiple tagsManual code for eachOne container for allPlugin-dependent
Version controlNoYesNo
Custom eventsCode requiredNo-code via GTM UILimited
Best forDevelopers, simple sitesMarketing teams, growing businessesBeginners, small blogs
Important
Never install GA4 using both gtag.js and GTM, or a CMS plugin and GTM simultaneously. Double-tagging inflates your pageviews, sessions, and events — making all your data unreliable. Pick one method and stick with it.

Step 4 — Verify Your Installation

After installing the tracking code, verify it is working before moving on.

Realtime reports

In GA4, go to Reports → Realtime. Open your website in another browser tab and navigate a few pages. You should see your activity appear within 30 seconds.

DebugView

For more detailed verification, go to Admin → DebugView. This shows every event firing in real time, including event parameters. To enable debug mode:

If you see events appearing in DebugView (page_view, session_start, first_visit), your installation is working correctly.

Key Insight
Realtime data appears within seconds. Standard reports take 24–48 hours to populate. Do not panic if your main reports are empty on day one — check Realtime and DebugView first.

Step 5 — Essential Post-Setup Configuration

A default GA4 installation misses several critical settings. Configure these immediately after verifying your tracking code.

Change data retention to 14 months

This is the most commonly missed setting in GA4. By default, GA4 retains your event-level data for only 2 months. After that, Exploration reports and funnel analyses lose their data.

GA4 data retention comparison: default 2-month setting means exploration data is deleted after 60 days, while recommended 14-month setting enables full year-over-year analysis. Must be changed on day one — does not apply retroactively.

Go to Admin → Data Settings → Data Retention. Change “Event data retention” from 2 months to 14 months. Enable “Reset user data on new activity.” Click Save.

This affects Exploration reports only — standard aggregate reports are not limited. But if you ever need to build custom funnels, segments, or path analyses on historical data, you need this setting changed on day one. It does not apply retroactively.

Filter internal traffic

Your own visits pollute your data. Set up an internal traffic filter:

  1. Go to Admin → Data Streams → [Your Stream] → Configure tag settings → Define internal traffic.
  2. Click Create, name the rule (e.g., “Office IP”), and enter your IP address.
  3. Go to Admin → Data Settings → Data Filters. Set the internal traffic filter from “Testing” to “Active.”

Set up key events

Key events (renamed from “conversions” in 2024) are the actions that matter most to your business. GA4 allows up to 30 key events per property.

Go to Admin → Events. You will see a list of events already being collected (page_view, scroll, click, etc.). Click the star icon next to any event to mark it as a key event.

Common key events to set up:

Pro Tip
Only mark events that represent true business outcomes. Marking too many key events dilutes your attribution data. Start with 3–5 key events and add more as your measurement matures.

If your website serves visitors in the EU, EEA, UK, or Switzerland, Consent Mode v2 is mandatory. Even if you are outside the EU, implementing it now future-proofs your setup as privacy regulations expand globally.

What Consent Mode does

Consent Mode adjusts how Google tags behave based on user consent choices. When a visitor rejects cookies, GA4 still collects limited, anonymous data — which Google uses for behavioral modeling to fill gaps in your reports.

Basic vs Advanced Mode

Consent Mode v2 comparison: Basic Mode blocks all data before consent and collects zero data on rejection, while Advanced Mode recommended fires cookieless pings and uses behavioral modeling for higher data accuracy
FeatureBasic ModeAdvanced Mode
Before consentNo tags fire, no dataTags fire with cookieless pings
If user rejectsZero data collectedAnonymous pings continue
Behavioral modelingNot availableEnabled — fills data gaps
Data accuracyLower (data loss from rejections)Higher (modeled + observed)
Recommended forStrictest compliance needsMost businesses

Advanced Mode is recommended for most businesses. It provides better data coverage while remaining fully compliant.

Implementation

  1. Choose a Google-certified CMP (Consent Management Platform): Cookiebot, OneTrust, Usercentrics, or similar.
  2. Install the CMP on your website — it handles the consent banner and user choices.
  3. Configure the CMP to communicate consent signals to Google tags via gtag('consent', 'update', {...}).
  4. Verify in GA4 DebugView that consent parameters (analytics_storage, ad_storage, ad_user_data, ad_personalization) are firing correctly.

Connecting GA4 to other Google tools unlocks additional data and capabilities. Do this on day one — some integrations do not backfill historical data.

Link Google Ads

Go to Admin → Product Links → Google Ads Links → Link. Select your Google Ads account and confirm.

This enables: GA4 audiences in Google Ads for remarketing, conversion data sharing for Smart Bidding, and cross-channel performance reporting in GA4.

Link Google Search Console

Go to Admin → Product Links → Search Console Links → Link. Select your Search Console property.

Requirements: you must be an Editor in GA4 AND a verified site owner in Search Console, using the same Google account. Only one Search Console property can be linked per GA4 web stream. Data appears in GA4 reports within 48 hours.

Enable BigQuery export

Go to Admin → Product Links → BigQuery Links → Link.

BigQuery stores your raw event-level data permanently. The free tier covers up to 1 million events per day and 10 GB of storage — sufficient for most small to mid-sized websites.

Important
BigQuery export does NOT backfill historical data. It only captures events from the moment you enable it. If you wait 6 months to set this up, those 6 months of raw data are lost forever. Enable it on day one, even if you do not plan to use it immediately.

10 Common GA4 Setup Mistakes

Industry data shows that 81% of GA4 migrations experience misconfigured events and tracking gaps. Here are the mistakes to avoid.

Top 5 GA4 setup mistakes: double-tagging inflates all metrics, default 2-month retention loses data, skipping Consent Mode v2 shrinks EU data, no internal traffic filter pollutes analytics, and not linking BigQuery loses raw event data forever
  1. Double-tagging. Installing gtag.js and GTM simultaneously, or adding a CMS plugin alongside manual code. This inflates all metrics. Use one method only.
  2. Keeping the default 2-month data retention. You lose Exploration report data after 60 days. Change to 14 months immediately.
  3. Skipping Consent Mode v2. Without it, EU visitor data shrinks significantly, and Google Ads audience building is impacted.
  4. Not filtering internal traffic. Your team’s visits skew bounce rates, session durations, and conversion rates.
  5. Marking too many key events. When everything is a conversion, attribution becomes noise. Stick to 3–5 true business outcomes.
  6. Not linking BigQuery on day one. No backfill means lost raw data forever.
  7. Inconsistent event naming. FormSubmit, form_submit, and form-submit are three different events in GA4. Use lowercase with underscores consistently.
  8. Not verifying installation. Always check Realtime reports and DebugView after setup. A surprising number of sites run broken tracking for weeks.
  9. Missing referral exclusions. Payment processors (PayPal, Stripe) get falsely credited as traffic sources. Exclude them in Admin → Data Streams → Configure tag settings.
  10. No ongoing QA process. GA4 settings can break silently. Review your configuration quarterly — check data retention, key events, filters, and consent signals.

GA4 Setup Checklist

Use this checklist to confirm you have completed every critical step.

GA4 setup checklist covering 4 sections: Account and Property setup, Installation verification, Configuration including 14-month retention and key events, and Privacy and Integrations including Consent Mode v2 and BigQuery export

Account & Property

Installation

Configuration

Privacy & Consent

Integrations

Ongoing

Frequently Asked Questions

How long does it take for GA4 to show data?

Realtime reports show activity within seconds of installation. Standard reports take 24–48 hours to fully populate. If you see data in Realtime but not in standard reports, wait a day — this is normal behavior.

Do I need Google Tag Manager for GA4?

No. GA4 works with direct code (gtag.js) or CMS plugins. However, GTM is recommended for most businesses because it allows no-code tag management, version control, and easier maintenance as your tracking needs grow.

Is GA4 free?

Yes. GA4 standard is completely free with no traffic limits. The paid version (GA360) starts at approximately $50,000/year and removes sampling in exploration reports, extends data retention, and provides dedicated support. Most businesses never need GA360.

What data retention should I set?

14 months — the maximum available in the free tier. The default 2 months is insufficient for seasonal analysis, year-over-year comparisons, or any custom exploration reports that look back more than 60 days.

Do I need Consent Mode v2?

If you serve visitors in the EU, EEA, UK, or Switzerland — yes, it is mandatory. If your audience is entirely outside these regions, it is not required but still recommended as a future-proofing measure.

What are key events in GA4?

Key events (renamed from “conversions” in 2024) are the user actions most important to your business — purchases, form submissions, sign-ups, downloads. You can mark up to 30 events as key events per property. They receive special treatment in GA4 reports and can be shared with Google Ads for optimization.

Why are my GA4 numbers different from Universal Analytics?

GA4 uses an event-based data model (every interaction is an event), while Universal Analytics used a session-based model. GA4 also has different session timeout logic, different user counting methods, and different attribution models. The numbers will never match exactly — this is expected and documented by Google’s comparison guide.

Should I use server-side tagging?

Server-side tagging routes tracking data through your own server before sending it to GA4. It improves data accuracy by bypassing ad blockers, gives you more control over what data leaves your site, and reduces client-side JavaScript. It is not required for a basic setup, but increasingly valuable for businesses that need high data accuracy or stricter privacy controls. We cover this in detail in our web analytics tools guide.

For a broader comparison of analytics platforms — including privacy-first alternatives like Matomo and tools like Plausible, Fathom, and PostHog — see our complete web analytics tools guide. If GDPR compliance is your primary concern, our GDPR-compliant analytics guide covers the full privacy-first setup process.

L
Leonhard Baumann

Web Analytics Consultant

Web analytics consultant with 10+ years of experience helping businesses make data-driven marketing decisions. Former Senior Analytics Lead at a Fortune 500 company, now focused on privacy-first analytics solutions and helping companies move beyond Google Analytics.

View all articles →