How to Add Google Analytics 4 to Your Website

To add Google Analytics 4, create a free account at analytics.google.com and set up a property with a web data stream. Then copy your Measurement ID (it starts with G-) into your website builder, or paste the Google tag into every page's head section. Open the Realtime report and visit your site to check that your own visit shows up.

Updated 26.11.2026 · 6 min read

Key points
  • The setup is free and usually takes 15 to 30 minutes.
  • Use your platform's built-in GA4 field or official plugin before you paste code by hand.
  • Turn on key events like form submissions and calls, or GA4 only counts visitors.
  • Install the tag only once, filter out your own visits, and handle cookie consent where the law requires it.

What you need before you start

You need a Google account and admin access to your website. If someone else built your site, ask them for a login or have them add the tag for you.

Use a business Google account, not a personal one that might leave with an employee. You can add other users later in Admin under Access Management.

Also decide on your reporting time zone and currency. You set both when you create the property, and they decide how daily numbers are grouped.

  • A Google account owned by the business
  • Admin access to your website builder, CMS, or hosting
  • About 30 minutes without interruptions
  • A list of the actions that matter to you, like calls, form fills, or bookings

Step 1: Create your GA4 account, property, and data stream

Go to analytics.google.com and click Start measuring. GA4 sets things up in three layers: account, property, and data stream.

The account is your business. The property is your website. The data stream is the connection that sends data from your site to Google.

When asked for a platform, choose Web. Enter your domain and a stream name, like "Main website." Leave Enhanced measurement switched on.

  • Account name: your business name
  • Property name: your domain, for example smithplumbing.com
  • Time zone and currency: where you actually do business
  • Business details: pick the closest match, as it only shapes the suggested reports

Step 2: Find your Measurement ID and Google tag

After you create the stream, Google shows its details. Your Measurement ID sits at the top right and looks like G-AB12CD34EF.

Click View tag instructions to see the full Google tag code. It is a short block of JavaScript that loads gtag.js and contains your Measurement ID.

If you lose this screen, go to Admin, then Data streams, then click your stream. Everything is there.

Step 3: Install the tag on your website platform

Most website builders have a field built for the Measurement ID. Use it when you can. It is faster, survives theme changes, and avoids typos in code.

Menu names change from time to time, so search your platform's help pages for "Google Analytics" if a label looks different.

  • WordPress: install Site Kit by Google, connect your Google account, and turn on Analytics. Other well-known GA plugins also work, but use only one.
  • Shopify: install the Google & YouTube app from the Shopify App Store and connect your GA4 property there.
  • Wix: open Marketing Integrations in your dashboard, choose Google Analytics, and paste your Measurement ID.
  • Squarespace: look for External API Keys in Developer Tools under Settings, then paste the Measurement ID.
  • Custom or hand-coded sites: paste the full Google tag right after the opening <head> tag on every page. A shared header template covers every page at once.
  • Google Tag Manager: if you already use GTM, add a Google tag with your Measurement ID, set it to fire on all pages, and publish the container.

Step 4: Confirm that GA4 is collecting data

Open your website in a new browser tab. In GA4, go to Reports, then Realtime. You should see at least one active user within a minute or two.

For a closer look, use Google Tag Assistant at tagassistant.google.com. Enter your URL and it shows which tags fire on each page.

Don't panic if standard reports look empty at first. Realtime updates right away, but regular reports can take 24 to 48 hours to fill in.

  • Nothing in Realtime? Check for a typo in the Measurement ID.
  • Turn off your ad blocker or privacy extension while you test.
  • Clear your site's cache or caching plugin so the new code actually loads.
  • Make sure the ID starts with G-. Old UA- IDs belong to Universal Analytics, which Google shut down in 2023.

Step 5: Configure the settings most small businesses skip

The default install counts visitors. A few extra settings make the numbers useful for decisions. Each one takes only a few minutes.

Data retention is the one people regret skipping. By default, GA4 keeps detailed event data for only two months. You can raise it to 14 months under Admin, then Data collection and modification, then Data retention.

Next, filter out your own visits. If you and your staff check the site every day, you inflate the traffic numbers. Define your office IP address as internal traffic in your data stream's tag settings, then switch the filter to Active under Data filters.

  • Set data retention to 14 months so you can compare this season with last year
  • Exclude internal traffic from your office and home IP addresses
  • Link Google Search Console to see which search terms bring visitors
  • Link Google Ads if you run ads, so conversions flow back into your campaigns
  • Add a second admin user so you never get locked out

Step 6: Track the actions that bring you customers

Enhanced measurement already tracks page views, scrolls, outbound clicks, file downloads, and some form interactions. But GA4 doesn't know which of these matter to you.

In GA4, a valuable action is called a key event. Google renamed "conversions" to "key events" in 2024, so older tutorials may use the old term.

Think about what a good visit looks like for your business. A dentist wants booking requests. A contractor wants quote forms and phone calls. A restaurant wants clicks on the reservation or directions links.

  • Form submissions: send people to a thank-you page after the form, then mark visits to that page as a key event
  • Phone calls: track clicks on tel: links, which matters most on mobile
  • Email clicks: track mailto: links if customers often email you
  • Bookings: many booking tools have their own GA4 integration, so check their settings first
  • To mark an event as key: go to Admin, then Events, and click the star or toggle next to it

Common mistakes that break your data

Double tagging is the most common problem I see. Someone pastes the code by hand and also turns on a plugin. Every visit then counts twice, and bounce and engagement numbers stop making sense.

Another frequent issue is a tag that only sits on the homepage. That happens when code goes into one page's settings instead of the site-wide header. Visits to service pages and contact pages then go missing.

Also expect GA4 to undercount somewhat. Ad blockers, privacy browsers, and visitors who decline cookies won't show up. Use the numbers to spot trends, not as an exact headcount.

  • Installing the tag twice with a plugin plus manual code
  • Tagging only some pages
  • Never setting up key events, so you only see traffic
  • Leaving data retention at two months
  • Counting your own visits as customers
  • Setting up the property under a freelancer's or former employee's account

Do you need a cookie banner for Google Analytics?

It depends on where your visitors are. In the EU and UK, you generally need consent before setting analytics cookies. That means a consent banner that actually blocks GA4 until the visitor agrees.

In the US, rules vary by state. California and a growing number of other states require clear disclosure and opt-out options. Your privacy policy should say you use Google Analytics and what it collects.

If you serve EU or UK visitors, look into Google Consent Mode v2 with a certified consent management platform. This is general information, not legal advice, so check your situation with a qualified professional.

What to look at once the data comes in

Give it two to four weeks before you draw conclusions. Small sites need time to build enough visits for patterns to show.

Start with three reports. Traffic acquisition shows where visitors come from. Pages and screens shows which pages people actually read. Key events shows whether visits turn into inquiries.

If you'd rather not handle this yourself, some providers set it up for you. A Fittedsite website, for example, goes live in 48 hours, and you can request analytics as part of the build.

FAQ

Questions, answered.

Is Google Analytics 4 free?

Yes. GA4 is free for small and mid-sized businesses. Google offers a paid version called Analytics 360, but it is built for large companies with very high traffic.

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

The Realtime report shows visits within a minute or two of installing the tag. Standard reports can take 24 to 48 hours to fill in. You'll need a few weeks of data before trends mean much.

Can I add Google Analytics without touching any code?

Yes, on most platforms. WordPress, Shopify, Wix, and Squarespace all let you connect GA4 with a plugin, an app, or a Measurement ID field. You only need code for custom-built sites.

Should I use Google Tag Manager or install GA4 directly?

For a typical small business site, installing GA4 directly or through your platform's integration is enough. Tag Manager makes sense if you plan to add several tracking tools, like ad pixels or call tracking. It adds flexibility, but there's more to learn.

Live preview · free · 10 seconds

Your new website is ten seconds away.

Type your business name, pick a style, and see exactly what your customers will see.

Money back if you don't love itLive in 48 hoursDomain & hosting included
your-business.com
    ✎ Tip: click any text in the preview to change it
    This website is ready for .Live in 48 hours · $690 once or $49/month · money back if you don't approve

    Sample text, numbers and reviews are placeholders – your site uses your real details and reviews.

    Claim 's website

    Pay now and we start today – or reserve and pay after you approve your final website.

    Secure payment by Stripe · cards, Apple Pay, Google Pay · full refund if you don't approve your final website.

    Love it
    or your
    money back

    Your website is reserved.

    We have everything we need to start. Watch your inbox – your final preview arrives within 24 hours.