How to Add Google Analytics to Your Website (Step-by-Step 2026)
Google Analytics 4 setup takes about 15 minutes. Here's the exact process — from creating your account to confirming data is flowing in, plus GA4's new 2026 AI traffic channel.
4 min read · Updated 2026-06-20

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 checklistStep 1: Create your GA4 account
- Go to analytics.google.com and sign in with your Google account
- Click "Start measuring"
- Enter an account name (your business name)
- Create a property — give it your website name and select your time zone and currency
- Choose "Web" as your platform
- 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: Add GA4 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
Install the "Google Analytics Debugger" Chrome extension, visit your website with it active, and check GA4 → Reports → Realtime. If you see your visit showing up, it's working.
Data takes 24–48 hours to start appearing in standard reports.
What to set up after the basics
- Mark conversions — in GA4, go to Events and mark phone clicks, form submissions, or purchases as conversions
- Connect Search Console — links GA4 to your Google Search Console data
- Set up goals — helps GA4 measure what matters to your business
- 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.
- Turn on Consent Mode — if you get visitors in the EU or UK, Consent Mode adjusts how GA4 collects data based on your cookie banner. Most consent-banner tools (and the Site Kit plugin) can set this up for you.
Related questions
Free SEO checklist
Grab our free Small Business SEO Checklist — a step-by-step guide to ranking your site higher.