To set up Google Analytics 4, you create a property at analytics.google.com, add a web data stream to get a Measurement ID, install the Google tag through your CMS, the gtag.js snippet or Tag Manager, and confirm your visit shows in the Realtime report. That's the ten minute half. The half that matters long-term: raising data retention from its 2 month default, filtering your own traffic, linking Search Console, and defining the key events your business actually cares about.
I run GA4 on this site and set it up for client sites regularly, and the pattern repeats: the tag is installed, the defaults are untouched, and a year later someone asks for a year-over-year comparison the property can't produce. So this walkthrough treats the install as step one of two, not the finish line.
Before You Start
Three things worth knowing up front:
- GA4 is the only Google Analytics. Standard Universal Analytics properties stopped processing hits on July 1, 2023, and access to UA data and the interface ended starting July 1, 2024. If a plugin or tutorial mentions "UA-" IDs, it's describing a product that no longer exists.
- GA4 measures events, not pageviews with extras. Everything is an event: a pageview, a scroll, a click, a form submit. This model is why the setup steps below spend so much time on which events count as meaningful.
- Your history starts at install. GA4 can't backfill anything. Every week you postpone the setup is a week of data that never existed, which is a real cost if you plan to do SEO work and want a before-and-after.
You need: a Google account, edit access to your site (or its CMS admin), and fifteen minutes. Google's own setup documentation is the canonical reference if the interface shifts after this guide is published.
Step 1: Create the Account and Property
- Go to analytics.google.com and sign in. First time: click "Start measuring". Existing account: Admin, then "Create", then "Property".
- Name the account after your business (an account can hold several properties).
- Name the property after the site, and set the reporting time zone and currency now. Google notes that changing the time zone only affects data going forward, so a wrong one permanently skews what "Tuesday" means in your reports.
- Answer the business questions (size, objectives). They shape which starter reports you see, nothing more.
Step 2: Add a Data Stream and Get Your Measurement ID
A data stream is the pipe between your site and the property. Choose Web, enter your site URL, name the stream (the site name is fine), and leave enhanced measurement switched on; you get scroll, click and form tracking for free, and a full breakdown below covers exactly what it collects.
The stream's details page shows your Measurement ID, the "G-" code (this site's is G-45HX440F49, visible to anyone who reads the page source; it's an address, not a secret). Every install method below needs it.
Step 3: Install the Google Tag
Three routes to the same result. Pick one, not two; a doubled tag means doubled pageviews and quietly broken data.
Route 1: CMS or platform integration. WordPress (Site Kit or an SEO plugin's integration field), Shopify, Squarespace, Wix and most builders accept the Measurement ID directly in a settings field. No code touched. If this exists for your platform, use it.
Route 2: The gtag.js snippet. For hand-built sites, paste the snippet into the <head> of every page, as high as possible:
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'G-XXXXXXXXXX');
</script>
Route 3: Google Tag Manager. Install the GTM container once, then add a "Google Analytics: GA4 Configuration" tag inside it with your Measurement ID. Worth it when you juggle several tracking tools or want marketing to add events without code deploys. Overkill for a five page site.
Which Install Method Fits Your Site?
Answer one question, get the route. Runs entirely in your browser.
Paste the Measurement ID into your platform's analytics field (WordPress: Site Kit or your SEO plugin; Shopify: Google & YouTube app; Wix/Squarespace: marketing integrations). Confirm no old plugin also injects a tag, or you'll double-count.
Paste the snippet from Step 3 into the head of every page, swap in your Measurement ID, deploy. On a templated site that's one edit in the shared header include.
Add "Google Analytics: GA4 Configuration" with your Measurement ID, trigger on All Pages, publish the container. Don't also install gtag.js on the site; one pipe is enough.
GTM is built for this: one container, every tool inside it, versioned changes, no code deploys for new events. Budget an extra hour for the initial container setup and put GA4 in as your first tag.
Step 4: Verify It Actually Works
- Open the Realtime report in GA4.
- Visit your site in another tab (your phone on mobile data works too) and click through a few pages.
- Watch yourself appear. Google notes collection may take up to 30 minutes to begin, so a few quiet minutes right after install mean nothing.
Then stop checking for a day or two. Per Google's data freshness documentation, reports and explorations "can take 24-48 hours to process data". An empty Engagement report six hours after setup is not a bug, it's the pipeline.
The Five Settings to Change on Day One
Here's the half that separates a real setup from a default one. All five live in Admin, all five take two minutes each, and the first one has a deadline you can't see yet.
- Raise data retention to 14 months. Admin, Data collection and modification, Data retention. New properties keep event data for 2 months by default, extendable to 14 on the free tier. The catch: retention governs explorations and funnel reports, and the change is not retroactive. Set it today or discover next summer that your custom analysis only reaches back eight weeks.
- Filter out your own traffic. Admin, Data streams, your stream, Configure tag settings, Define internal traffic: add your IP. Then, and this is the step everyone misses, go to Data filters and switch the internal traffic filter from "Testing" to "Active". It ships in testing mode and does nothing until you flip it.
- Link Search Console. Admin, Product links. This pulls query and landing page data into GA4, connecting "how they found me" to "what they did next". It requires a verified Search Console property; my GSC setup guide covers that end.
- Mark your key events. Decide which events mean business results (a lead form submit, a booking, a purchase) and toggle them as key events under Admin, Events. The section below covers doing this properly for a lead-gen site.
- Link Google Ads, if you run ads. Same Product links screen. Without it, your key events can't feed Ads bidding and your campaign clicks blur into generic traffic. No ads, skip it guilt-free.
What Enhanced Measurement Tracks for Free
With the toggle on, GA4 collects these automatically, per Google's enhanced measurement documentation:
| Event | Fires when |
|---|---|
| page_view | A page loads, or the browser history state changes (covers single page apps) |
| scroll | A visitor first reaches 90% depth on a page |
| click | A visitor clicks a link leading away from your domain |
| view_search_results | Your internal site search shows results (detected from the URL query parameter) |
| video_start / _progress / _complete | Embedded YouTube videos play, pass progress points, or finish |
| file_download | A visitor clicks a link to a PDF, document or other common file type |
| form_start / form_submit | A visitor first interacts with a form, and when a form is submitted |
This is genuinely useful coverage for zero work. One warning before you build reporting on it: the automatic form_submit fires on browser-level form activity, which can include search boxes, newsletter widgets and forms that failed server-side validation. Fine for spotting activity, too blunt for counting leads. Which brings us to key events.
Key Events: Make GA4 Count What Pays You
A key event is Google's term (formerly "conversions") for an event that "measures an action that's particularly important to the success of your business", per the key events documentation. Out of the box, GA4 counts nothing as important. Deciding is your job, and for a lead-gen site the decision is usually short: the contact form submit, the booking, maybe the phone number click.
The clean pattern: fire your own named event at the moment that actually means success, then mark it. On this site, the audit request form fires a generate_lead event only after the server accepts the submission, not when the button is clicked. That one detail removes failed submits, double clicks and bot noise from the number I make decisions with:
// in your form's success handler, after the server confirms:
gtag('event', 'generate_lead', {
form_id: 'audit-request'
});
Then: Admin, Events, find generate_lead once it has fired at least once, toggle "Mark as key event". From that point it gets its own reporting, and if you link Google Ads it becomes a bidding signal. Two or three key events beat ten; when everything is key, nothing is.
Consent Mode, Done Honestly
If your visitors include the EU or UK, a consent banner isn't optional, and GA4 has a mechanism built for it: consent mode. The tag loads with consent defaulted to denied, and upgrades only when the visitor accepts. This exact page runs that pattern; decline the banner and GA4 stores nothing about you:
gtag('consent', 'default', {
analytics_storage: 'denied',
ad_storage: 'denied'
});
// later, when the visitor clicks Accept:
gtag('consent', 'update', {
analytics_storage: 'granted',
ad_storage: 'granted'
});
Two honest costs to plan around. You will undercount: some visitors decline, and their sessions vanish from your reports, so treat GA4 numbers as a floor rather than a census. And don't "solve" this by skipping the banner; the fines are real, and an analytics number isn't worth the exposure. What you lose in completeness you keep in trust and legality.
The Mistakes I Keep Finding on Audits
- Retention left at 2 months. Found, without exception, the moment someone asks for a year-over-year exploration. The data is gone and nothing brings it back.
- The internal traffic filter stuck in "Testing". The IP rule exists, the filter was never activated, and the owner's daily visits pollute every report. Check Data filters right now if you're not sure.
- Two tags on one site. A forgotten plugin plus a manual snippet. Sessions look healthy, everything else doubles. If your pageviews-per-session look suspiciously even, count your tags.
- Counting
form_submitas leads. The enhanced measurement event fires on newsletter boxes and failed validations too. Fire your own event on confirmed success and mark that one instead. - No Search Console link. The single richest free join in the Google stack, sitting unconnected. Two clicks in Product links.
- Expecting UA numbers. GA4 sessions, users and engagement are computed differently; "bounce rate" as you knew it is gone. Comparing GA4 to old UA exports line-by-line burns hours and proves nothing.
- Waiting for perfect. Weeks spent designing the ideal measurement plan while zero data collects. Install today, refine forever; GA4 only records forward.
The GA4 Setup Checklist
Run this before you call the setup done
- Property created with the correct time zone and currency
- Web data stream added, enhanced measurement on
- Tag installed by exactly one method, on every page
- Your visit appears in Realtime
- Data retention raised to 14 months
- Internal traffic defined AND the filter set to Active
- Search Console linked (and Google Ads, if you run them)
- A real success event fires on your money action and is marked as a key event
- Consent mode wired to your cookie banner if EU/UK visitors apply
- Calendar note made to check reports in 48 hours, not 4
Want the Data Checked by a Human?
A GA4 property that measures the wrong things is worse than none, because it answers questions confidently and wrong. My free audit includes a look at your analytics setup alongside indexing, performance and Search Console, with a prioritized fix list.
Get My Free Audit