All How-To Guides
Any Website10 min·5 steps

How to Set Up Google Analytics on Your Website (2026 Step-by-Step Guide)

The platform-agnostic version: every Google Analytics 4 install boils down to creating a property, copying a measurement ID, pasting a tag into your site's <head>, and verifying it fires. Whether you're on WordPress, Shopify, a static-site generator, or a custom-built app, the underlying procedure is the same - the only thing that changes is where you paste the tag.

What you'll need before you start

  • A live website you control (any platform)
  • Ability to edit either your site's <head> HTML or use a CMS-provided integration field
  • A Google account
  • Roughly 10 minutes

How to set up Google Analytics on Any Website: Step-by-step

  1. 1

    Create a GA4 property

    Go to analytics.google.com and sign in with your Google account. Click Start measuring (first-time users) or the Admin gear icon (existing users) → CreateProperty. Set a property name (your site name), pick your time zone and reporting currency, and click Next.

  2. 2

    Add a Web data stream

    After creating the property, GA4 prompts you to set up data collection. Choose Web. Paste your full website URL (with https://), give the stream a name (e.g., Main site), and click Create stream. Make sure Enhanced measurement is toggled on - it auto-tracks page views, scrolls, outbound clicks, file downloads, and video engagement without any extra code.

  3. 3

    Copy your Measurement ID or the global site tag

    The data stream summary screen shows a Measurement ID in the format G-XXXXXXXXXX in the upper-right. If your site platform has a Google Analytics integration field (WordPress with Site Kit, Shopify, Wix, Squarespace, Webflow, BigCommerce, Ghost), the Measurement ID is all you need. If you're installing manually, click View tag instructionsInstall manually and copy the entire <script> snippet.

  4. 4

    Paste the tag into your website

    For most platforms with a built-in integration: paste the Measurement ID into the platform's analytics field (in WordPress that's the Site Kit setup wizard; in Shopify it's the Google & YouTube channel; in Wix and Squarespace it's the Marketing Integrations or External API Keys panel; in Webflow it's Site Settings → Integrations; in BigCommerce it's Web Analytics).

    For platforms without a built-in field: paste the entire global site tag <script> snippet immediately after the opening <head> tag in your site's HTML template.

  5. 5

    Verify the tag is firing

    Open your live site in an incognito or private window so you don't count yourself as an existing user. Wait 30-60 seconds. Open GA4 → ReportsRealtime. You should see one active user. If yes, you're done. The free Google Tag Assistant Chrome extension is a faster check and shows your G-XXXXXXXXXX ID firing along with each event.

How to verify your setup is working

The Realtime report (ReportsRealtime) is the fastest sanity check - traffic from an incognito session should show up within 30-60 seconds. For a deeper validation, install the Google Tag Assistant Chrome extension. Open your site, click the extension icon, and confirm it shows your G-XXXXXXXXXX ID firing on every page navigation. Tag Assistant also flags duplicate tags (a common cause of inflated page-view counts).

Common issues and fixes

Realtime is empty even after waiting two minutes

Three common causes. (1) An ad-blocker, privacy extension, or browser like Brave is blocking the GA4 script - test in Chrome incognito with extensions disabled. (2) The script is in the page source but on the wrong site - check that the GA4 data stream URL matches your live URL exactly (https://www.example.com vs https://example.com). (3) The site has a cookie consent banner that requires opt-in before firing tags - accept the banner and refresh.

I see traffic, but no events other than page_view

The Enhanced measurement setting (in your Web data stream) needs to be on. Go to GA4 → AdminData streams → click your stream → confirm Enhanced measurement is toggled on. Once enabled, scroll, outbound click, file download, and video engagement events start firing immediately.

I'm seeing data but my own visits are inflating the numbers

Add a filter in GA4: AdminData Streams → click your stream → Configure tag settingsShow allDefine internal traffic. Enter your office or home IP address. Then enable the Internal Traffic data filter under AdminData Filters.

Frequently asked questions

Is Google Analytics free?

Yes - Google Analytics 4 is free for any website up to about 10 million events per month. Beyond that you'd need Google Analytics 360, which is enterprise-priced (six figures annually). For nearly every site that isn't a top-1000 publisher, the free version is more than enough.

What's the difference between Google Analytics and GA4?

GA4 is the current version of Google Analytics. The older version, called Universal Analytics or UA, was retired in July 2023 and stopped processing data in July 2024. If you see references to UA-XXXXXX tracking IDs anywhere in setup instructions, that's outdated - GA4 uses the G-XXXXXXXXXX format.

How do I know if Google Analytics is working on my website?

Open your site in an incognito or private browser window so you don't count as a returning user. Browse a few pages. Then open GA4 and go to ReportsRealtime. Within 30-60 seconds you should see one active user. The Google Tag Assistant Chrome extension is a faster check - it shows every analytics tag firing on the page along with its measurement ID.

How do I add Google Analytics to my website without a plugin?

Get the global site tag from GA4 → AdminData streams → click your stream → View tag instructionsInstall manually. Copy the full <script> snippet and paste it into your site's HTML template, immediately after the opening <head> tag. The exact location of that template depends on your platform - in static-site generators it's usually head.html or layout.html; in custom-built apps it's the <head> of your root layout component.

Do I need to add a cookie banner to use Google Analytics?

If your site serves visitors in the EU, UK, California, Brazil, or other privacy-regulated regions, yes - you need a consent management platform that asks for permission before GA4 fires. GA4 supports Consent Mode v2, which still collects anonymous, modeled data even from users who don't consent. Popular CMPs include Cookiebot, Termly, OneTrust, and the free open-source Klaro!.

How long does it take for Google Analytics data to show up?

Realtime data appears within 30-60 seconds of a page view. Full report data (Reports → Engagement, Acquisition, etc.) lags by 24-48 hours - that's GA4's standard processing window. If you don't see data in standard reports the day after install, wait another day before troubleshooting.

Once you're set up, MeasureBoard turns the data into action

MeasureBoard connects to your analytics, search, and SEO tooling and generates AI-powered weekly reports, GEO readiness scores, and a dedicated AI analyst that answers questions in plain English. Free to start, connects in 30 seconds.

Get Started Free