Skip to content
G
GrowWebPro
Analytics & Data

How to Add Google Analytics to Your Website (Step-by-Step 2026)

Google Analytics 4 setup takes about 15 minutes. The exact process — from creating your account to confirming data is flowing, plus GA4's 2026 AI channel.

7 min read · Updated 2026-09-05

How to Add Google Analytics to Your Website (Step-by-Step 2026)

Short answer

Go to analytics.google.com, create an account and property for your website, copy the Measurement ID (starts with G-), add it to your website (via tag, plugin, or code), and wait 24 hours for data to appear. The hardest part is adding it to your site — the method depends on your platform.

New in GA4 for 2026: track your AI traffic

In mid-2026 Google added an AI Assistant channel to GA4's default channel grouping. Visits from people who reached your site through an AI assistant — ChatGPT, Gemini, Claude, Copilot and a few others — are now grouped on their own instead of being buried under "Referral." It works automatically, with no setup.

To see it: Reports → Acquisition → Traffic acquisition, then set the primary dimension to Session default channel group and look for AI Assistant.

Two things to keep in mind:

  • Not every tool is covered yet — traffic from some assistants (such as Perplexity) can still show up under Referral.
  • A large share of AI visits arrive with no referrer information and fall into Direct, so this channel undercounts your real AI traffic rather than overcounting it.
  • Title tag under 60 characters
  • Sitemap submitted to Search Console
  • Google Analytics set up correctly
  • + 24 more

Free checklist

The Small Business SEO Checklist

Covers Google Analytics setup, keyword basics, on-page SEO, and local SEO — free to use, no signup.

Open the checklist

Step 1: Create your GA4 account

  1. Go to analytics.google.com and sign in with your Google account
  2. Click "Start measuring"
  3. Enter an account name (your business name)
  4. Create a property — give it your website name and select your time zone and currency
  5. Choose "Web" as your platform
  6. Enter your website URL and stream name

You'll get a Measurement ID (format: G-XXXXXXXXXX). This is what you'll add to your site.

Step 2: How to add Google Analytics to your website

The method depends on your platform:

WordPress — install the free "Site Kit by Google" plugin. It connects GA4 with one click and no code.

Squarespace — go to Settings → Advanced → External API Keys → Google Analytics, paste your Measurement ID.

Wix — go to Settings → Tracking & Analytics → New Tool → Google Analytics, paste your Measurement ID.

Shopify — go to Online Store → Preferences → Google Analytics, paste your Measurement ID.

Custom site (HTML) — paste the GA4 tracking code snippet in the <head> section of every page. The snippet is in GA4 under Admin → Data Streams → your stream → "Google tag."

Google Tag Manager — if you're already using GTM, add a GA4 Configuration tag with your Measurement ID and trigger it on "All Pages."

Step 3: Confirm it's working

Open your website in a private/incognito window and check GA4 → Reports → Realtime. If your visit appears within a minute or two, the tag is firing. The private window matters — if you have already set up an internal traffic filter, your normal browser is deliberately excluded and you will wrongly conclude the tag is broken.

For anything more detailed, install the "Google Analytics Debugger" Chrome extension, which shows exactly which events are being sent.

An empty Acquisition report on day one is expected. Realtime works immediately; the standard reports take 24–48 hours to populate. Do not re-do a working installation because of this — it is the single most common false alarm.

What to set up after the basics

  1. Mark conversions — in GA4, go to Events and mark phone clicks, form submissions, or purchases as conversions
  2. Connect Search Console — links GA4 to your Google Search Console data
  3. Set up goals — helps GA4 measure what matters to your business
  4. Extend data retention to 14 months — GA4 keeps event-level data for only 2 months by default. Go to Admin → Data Settings → Data Retention and switch it to 14 months so year-over-year comparisons work. Do this on day one — the change isn't retroactive.
  5. Turn on Consent Mode v2 — required if you have EU or UK visitors. See the section below.

The setup mistakes that ruin the data

All four of these are common, all four are silent, and all four are much cheaper to prevent than to correct — GA4 does not retroactively clean historical data.

Two tags on the same page. Usually a plugin and a hand-pasted snippet, or Site Kit plus a theme setting. Every metric doubles and bounce rate collapses to near zero, which looks like good news. Check by viewing the page source and searching for your G- ID — it should appear once.

No internal traffic filter. Your own visits, and your developer's, are counted as customers. On a low-traffic site this is not a rounding error; it can be most of your reported sessions. Set it up in Admin → Data streams → Configure tag settings → Define internal traffic, then activate the filter in Admin → Data settings → Data filters. It starts as "testing", which does nothing until you switch it to active.

Data retention left at the default. GA4 keeps event-level data for two months unless you change it. Set it to 14 months on day one — Admin → Data settings → Data retention. It is not retroactive, so the months you leave it are simply gone.

No conversions marked. Without them GA4 reports traffic, not outcomes, and you cannot tell which channel actually produces enquiries. Mark phone clicks, form submissions, and purchases as key events as soon as data is flowing.

What to actually look at

The interface offers far more than a small business needs. Four reports cover almost everything:

  • Reports → Acquisition → Traffic acquisition — where visitors come from. The one report to check weekly.
  • Reports → Engagement → Pages and screens — which pages get visited and which hold attention. Tells you what to write more of.
  • Reports → Realtime — only useful for confirming a tag fires. Ignore it otherwise; watching live visitors is not analysis.
  • Advertising → Conversion paths — once conversions are marked, this shows what actually contributed rather than only the last click.

Set the comparison to the previous period or previous year on every one of them. A number on its own means nothing; the direction is the whole point.

Why your numbers won't match anything else

Expect GA4 to disagree with your host's stats, your ad platforms, and Search Console. This is normal and not a broken setup:

  • Ad blockers and privacy browsers block the GA4 tag entirely, so real visits are never recorded. The undercount is real and varies with audience.
  • Search Console counts clicks from Google; GA4 counts sessions that loaded the tag. Different things, measured at different points.
  • Ad platforms attribute their own clicks generously, so their conversion counts run above GA4's.
  • Consent choices remove some visitors from reporting entirely.

Use GA4 for trends and comparisons, not for absolute truth. If you need to know how you appear in search specifically, that question belongs to Search Console — see how to read Google Analytics as a beginner for the practical division of labour.

Consent Mode v2: required if you have EU or UK visitors

If any of your traffic comes from the EEA or UK, Google requires Consent Mode v2 before GA4 data can feed Google's advertising products. It has been mandatory for EEA and UK advertisers since March 2024.

Consent Mode v2 added two signals on top of the original pair:

  • ad_user_data — may user data be sent to Google for advertising purposes?
  • ad_personalization — may it be used for personalised advertising?

You don't hand-code these. The practical steps are:

  1. Install a Google-certified consent management platform (CMP) — Google keeps a published list. A hand-built cookie banner does not qualify.
  2. Confirm the CMP is set to pass Consent Mode v2 signals. Most certified CMPs do this by default, and the Site Kit plugin can wire it up on WordPress.
  3. Check it in GA4 under Admin → Data collection and modification → Consent settings, which reports whether the signals are arriving.

Skip this and GA4 keeps collecting, but visitors from the EEA and UK who decline are dropped from your ads reporting entirely — and if you run AdSense or Google Ads, you serve non-personalised ads to that traffic.

Related questions

Frequently asked questions

How do I add Google Analytics to my website?
Create a GA4 property at analytics.google.com, copy the Measurement ID (it starts with G-), and add it to your site. On WordPress use the free Site Kit by Google plugin; on Squarespace, Wix or Shopify paste the Measurement ID into the built-in Google Analytics field in settings; on a custom HTML site paste the Google tag snippet into the head of every page. Data appears in the standard reports within 24 to 48 hours.
How long does Google Analytics take to show data?
Realtime reports show your own visit within a minute or two, which is the fastest way to confirm the tag is firing. The standard reports take 24 to 48 hours to populate, so an empty Acquisition report on day one is normal rather than a sign the setup failed.
Is Google Analytics 4 free?
Yes. GA4 is free for the traffic volumes a small business site will ever reach. The paid tier, Google Analytics 360, exists for enterprises collecting billions of events a month and is not something a small business needs to consider.
Do I need Consent Mode v2 for Google Analytics?
Only if some of your visitors are in the EEA or UK — and then it is required, and has been since March 2024. It needs a Google-certified consent management platform, not a hand-built cookie banner. Without it, visitors who decline consent drop out of your Google advertising reporting entirely.