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.
In This Guide

What You Need Before You Start
Before creating your GA4 property, make sure you have:
- A Google account — any Gmail or Google Workspace account works.
- Admin access to your website — you will need to add a code snippet to the
<head>section or install a plugin. - Your business goals defined — what actions do you want visitors to take? (purchases, form submissions, sign-ups, downloads). These become your key events.
- A tracking method decision — Google Tag Manager (recommended for most), direct code (gtag.js), or a CMS plugin (WordPress, Shopify, etc.).
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) → Create → Property.
Property settings
Enter your property name (e.g., “My Website — Production”), then configure:
- Reporting time zone — select your business time zone. This affects how daily reports are calculated.
- Currency — used for revenue reporting. Choose your primary business currency.
- Industry category — helps GA4 generate relevant benchmarks and suggested reports.
- Business size — small, medium, large, or very large.
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.
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:
- Page views (
page_view) — every page load - Scrolls (
scroll) — fires when a user scrolls 90% of the page - Outbound clicks (
click) — clicks to external domains - Site search (
view_search_results) — search queries on your site - Video engagement — start, progress, and completion of embedded YouTube videos
- File downloads (
file_download) — clicks on PDF, DOCX, XLSX, etc. - Form interactions (
form_start,form_submit) — form engagement tracking

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.
- Create a Google Tag Manager account and container if you do not have one.
- In GTM, click New Tag → Tag Configuration → Google Analytics: GA4 Configuration.
- Enter your Measurement ID (
G-XXXXXXX). - Set the trigger to “All Pages”.
- 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.
- WordPress: Use Site Kit by Google (free) or add the gtag.js snippet to your theme’s
<head>section. - Shopify: Go to Online Store → Preferences → paste your Measurement ID in the Google Analytics field.
- Wix / Squarespace: Built-in Google Analytics integration in site settings.
Which method should you choose?

| Factor | gtag.js | Google Tag Manager | CMS Plugin |
|---|---|---|---|
| Setup difficulty | Easy | Medium | Easiest |
| Flexibility | Low | High | Low |
| Multiple tags | Manual code for each | One container for all | Plugin-dependent |
| Version control | No | Yes | No |
| Custom events | Code required | No-code via GTM UI | Limited |
| Best for | Developers, simple sites | Marketing teams, growing businesses | Beginners, small blogs |
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:
- GTM: Use Preview Mode — debug signals are sent automatically.
- gtag.js: Add
&dbg=1to your page URL, or install the GA Debugger Chrome extension.
If you see events appearing in DebugView (page_view, session_start, first_visit), your installation is working correctly.
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.

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:
- Go to Admin → Data Streams → [Your Stream] → Configure tag settings → Define internal traffic.
- Click Create, name the rule (e.g., “Office IP”), and enter your IP address.
- 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:
form_submit— contact form submissionsgenerate_lead— lead generation actionspurchase— e-commerce transactionssign_up— account registrationsfile_download— important document downloads
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.
Step 6 — Set Up Consent Mode v2
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

| Feature | Basic Mode | Advanced Mode |
|---|---|---|
| Before consent | No tags fire, no data | Tags fire with cookieless pings |
| If user rejects | Zero data collected | Anonymous pings continue |
| Behavioral modeling | Not available | Enabled — fills data gaps |
| Data accuracy | Lower (data loss from rejections) | Higher (modeled + observed) |
| Recommended for | Strictest compliance needs | Most businesses |
Advanced Mode is recommended for most businesses. It provides better data coverage while remaining fully compliant.
Implementation
- Choose a Google-certified CMP (Consent Management Platform): Cookiebot, OneTrust, Usercentrics, or similar.
- Install the CMP on your website — it handles the consent banner and user choices.
- Configure the CMP to communicate consent signals to Google tags via
gtag('consent', 'update', {...}). - Verify in GA4 DebugView that consent parameters (
analytics_storage,ad_storage,ad_user_data,ad_personalization) are firing correctly.
Step 7 — Link Google Products
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.
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.

- Double-tagging. Installing gtag.js and GTM simultaneously, or adding a CMS plugin alongside manual code. This inflates all metrics. Use one method only.
- Keeping the default 2-month data retention. You lose Exploration report data after 60 days. Change to 14 months immediately.
- Skipping Consent Mode v2. Without it, EU visitor data shrinks significantly, and Google Ads audience building is impacted.
- Not filtering internal traffic. Your team’s visits skew bounce rates, session durations, and conversion rates.
- Marking too many key events. When everything is a conversion, attribution becomes noise. Stick to 3–5 true business outcomes.
- Not linking BigQuery on day one. No backfill means lost raw data forever.
- Inconsistent event naming.
FormSubmit,form_submit, andform-submitare three different events in GA4. Use lowercase with underscores consistently. - Not verifying installation. Always check Realtime reports and DebugView after setup. A surprising number of sites run broken tracking for weeks.
- Missing referral exclusions. Payment processors (PayPal, Stripe) get falsely credited as traffic sources. Exclude them in Admin → Data Streams → Configure tag settings.
- 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.

Account & Property
- Google Analytics account created
- GA4 property created with correct time zone and currency
- Web data stream configured
- Measurement ID copied (G-XXXXXXX)
Installation
- Tracking code installed via ONE method (gtag.js, GTM, or CMS plugin)
- Verified in Realtime reports — seeing live activity
- Verified in DebugView — events firing correctly
Configuration
- Data retention changed to 14 months
- Internal traffic filter created and activated
- Key events marked (3–5 business outcomes)
- Enhanced Measurement reviewed and enabled
Privacy & Consent
- Consent Mode v2 implemented (if serving EU/EEA visitors)
- CMP installed and tested
- Consent signals verified in DebugView
Integrations
- Google Ads linked (if using Google Ads)
- Google Search Console linked
- BigQuery export enabled
Ongoing
- Referral exclusions configured (payment processors)
- Quarterly QA review scheduled
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.
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 →