← Back to Blog·Mar 16, 2026·10 min read
Tutorial

How to Set Up Google Analytics for Any Website (2026)

A complete, step-by-step walkthrough for setting up Google Analytics 4 on WordPress, Wix, Squarespace, Next.js, Drupal, and any other platform — plus when a simpler alternative might be the better choice.

Setup Google Analytics Website article hero illustration

What Is Google Analytics 4?

Google Analytics 4(GA4) is Google's current web analytics platform. It replaced Universal Analytics in July 2023 and introduced an event-based data model, cross-platform tracking, and machine-learning-powered insights.

If you want toset up Google Analytics for your websitein 2026, GA4 is the only option Google offers. The good news: setup is straightforward once you know the steps. The less-good news: GA4's interface is more complex than its predecessor, and the learning curve is real.

85%

Market share

~30 min

Avg setup time

45 KB

Script size

Free

Pricing

This guide walks you through every step — from creating your account to verifying data collection — on every major platform.

Step 1: Create a Google Analytics Account

Before you add tracking code to your site, you need a GA4 property. Here's how to create one:

  1. Go to <a href="https://analytics.google.com">analytics.google.com</a> and sign in with your Google account
  2. Click<strong>Start measuring</strong>(or<strong>Admin → Create Account</strong>if you already have GA)
  3. Enter an<strong>Account name</strong>(e.g., your business name)
  4. Enter a<strong>Property name</strong>(e.g., “My Website”) and set your time zone and currency
  5. Select your industry category and business size
  6. Choose<strong>Web</strong>as the platform
  7. Enter your website URL and give the stream a name
  8. Click<strong>Create stream</strong>

After creating the stream, Google will show you aMeasurement IDthat looks like G-XXXXXXXXXX. Copy it — you'll need it in the next step.

Google will also display theGoogle tag (gtag.js)snippet. This is the JavaScript code you paste into your website.

Important

GA4 sets cookies on your visitors' browsers. If your site serves users in the EU, you'll need a cookie consent banner to comply with GDPR. Visitors who decline cookies won't be tracked at all, which can result in 30–40% of your traffic going unrecorded.

Step 2: Add the Tracking Code to Your Website

The process forsetting up Google Analytics on your websitedepends on your platform. Find yours below.

WordPress (Plugin)

Install<strong>Site Kit by Google</strong>, activate, sign in, and select your GA4 property. The plugin inserts the tracking code automatically. Setup: ~5 minutes

WordPress (Manual)

Copy the gtag.js snippet, open<code>header.php</code>in Theme Editor, and paste before the closing<code></head></code>tag. Setup: ~10 minutes

Wix

Go to<strong>Marketing & SEO → Marketing Integrations</strong>, find Google Analytics, paste your Measurement ID, and save. Setup: ~3 minutes

Squarespace

Go to<strong>Settings → Advanced → Code Injection</strong>, paste the gtag.js snippet into the Header field, and save. Applied site-wide automatically. Setup: ~2 minutes

Next.js / React

Use the<code>next/script</code>component with<code>afterInteractive</code>strategy in your root layout. Setup: ~10 minutes

Drupal / Google Sites / Static HTML

<strong>Drupal:</strong>Install the Google Analytics module and enter your Measurement ID.<strong>Google Sites:</strong>Use the built-in Analytics setting.<strong>HTML:</strong>Paste the snippet in every page's<code><head></code>. Setup: ~5 minutes

Next.js / React Example

Pro Tip

After adding your tracking code, test it immediately using the<strong>Real-Time</strong>report in GA4. Open your website in a new tab, then check the Real-Time section in your GA4 dashboard — you should see yourself as an active user within 30 seconds.

Step 3: Verify Your Installation Works

A surprising number of GA4 installations have silent configuration errors. Here's how to make sure yours is working correctly:

Real-Time report

Go to<strong>Reports → Real-Time</strong>in GA4. Visit your site in another tab — an active user should appear within 30 seconds.

Google Tag Assistant

Install the<a href="https://tagassistant.google.com">Tag Assistant</a>Chrome extension. Visit your site and it confirms whether your tag fires correctly.

Browser DevTools

Open DevTools (F12), go to the<strong>Network</strong>tab, and filter for “collect”. You should see requests to<code>google-analytics.com/g/collect</code>.

DebugView

Go to<strong>Admin → DebugView</strong>in GA4. Add<code>?debug_mode=true</code>to your URL and watch events arrive in real time.

If nothing appears, double-check your Measurement ID and make sure the snippet is inside thetag, not duplicated or blocked by ad blockers.

Step 4: Essential First Configurations

Once data is flowing, configure these settings right away to avoid data quality issues later.

Set up conversions (key events)

Mark your most important events — form submissions, purchases, sign-ups, file downloads. Go to<strong>Admin → Events</strong>and toggle<strong>Mark as key event</strong>.

Filter internal traffic

Exclude your own visits via<strong>Data Streams → Configure tag settings → Define internal traffic</strong>. Add your IP address and activate the filter.

Enable Enhanced Measurement

GA4 can auto-track scrolls, outbound clicks, site search, video engagement, and file downloads. Verify it's turned on in your Data Stream settings.

Link Google Search Console

Connect Search Console for organic search query data inside GA4. Go to<strong>Admin → Product Links → Search Console Links</strong>and complete the wizard.

Bring External Site Data Into Copper

Pull roadmaps, blog metadata, and operational signals into one dashboard without asking every team to learn a new workflow.

Common Setup Mistakes (and How to Avoid Them)

These are the errors that cause the most data headaches down the road:

  • <strong>Duplicate tracking code:</strong>If you add the snippet manually<em>and</em>via a plugin, every pageview gets counted twice. Pick one method and stick with it.
  • <strong>Wrong Measurement ID:</strong>Double-check that the ID in your code matches the one in GA4 → Admin → Data Streams. A single wrong character means zero data.
  • <strong>Not filtering internal traffic:</strong>Your own visits will skew bounce rates, session duration, and pageview counts — especially on low-traffic sites.
  • <strong>Ignoring consent requirements:</strong>Deploying GA4 without a cookie consent mechanism in the EU can result in GDPR fines. Use Google Consent Mode or a consent management platform.
  • <strong>Forgetting to publish:</strong>On Wix, Squarespace, and other hosted platforms, saving code in the editor isn't enough — you must click<strong>Publish</strong>for changes to go live.

Did You Know?

Studies estimate that roughly 30% of Google Analytics installations have at least one configuration error — from duplicate tags to missing filters. Taking 10 minutes to verify your setup now can save months of unreliable data.

Google Analytics Privacy Considerations

If you serve visitors in the EU, California, or other privacy-regulated regions, be aware of these requirements before deploying GA4.

GDPR compliance

GA4 sets cookies and transfers data to US-based Google servers. Several EU DPAs have flagged standard GA as non-compliant. You'll need a consent banner that blocks GA until the visitor opts in.

Consent Mode v2

Google's recommended approach. It loads gtag.js but restricts data collection until consent is granted, then uses modeling to fill in gaps from non-consenting users.

Data retention

GA4 lets you set retention to 2 or 14 months. Shorter retention limits historical analysis but aligns better with data minimization principles.

Ad blockers & IP anonymization

GA4 anonymizes IPs by default, but 30–40% of visitors use ad blockers that block GA entirely. This traffic goes unrecorded regardless of consent settings.

For many site owners, these requirements add real overhead: consent banner setup, cookie policy updates, legal review, and ongoing compliance monitoring.

GA4 Setup vs Simpler Alternatives

Not every site needs the full GA4 setup process. Here's how the setup experience compares between Google Analytics and a privacy-first alternative likeCopper Analytics.

Google Analytics 4

Create account, create property, create data stream, copy snippet, paste into platform, verify installation, configure consent banner, filter internal traffic, set up conversions.

Setup: ~30 minutes · Learning curve: weeks

Copper Analytics

Sign up, paste one script tag into your site's<code><head></code>. Data appears instantly. No consent banner, no configuration, no learning curve.

Setup: ~2 minutes · Learning curve: minutes

When Google Analytics Is Overkill

GA4 is a powerful platform designed for complex marketing operations, multi-channel attribution, and enterprise-scale data analysis. But most websites don't need that level of complexity.

If any of these describe your situation, asimpler analytics toolmight be a better fit:

  • You mainly want to know<strong>how many visitors</strong>you get,<strong>where they come from</strong>, and<strong>which pages they view</strong>
  • You don't want to deal with cookie consent banners
  • You find GA4's interface confusing or overwhelming
  • Your site is a blog, portfolio, documentation site, or small business website
  • You care about page load speed and want the lightest possible tracking script
  • You want GDPR compliance without extra work

No cookies, ever

Privacy compliance baked in from the start. No consent banners needed in any jurisdiction — GDPR, CCPA, or PECR.

AI crawler tracking

See which AI bots (GPTBot, ClaudeBot, Perplexity) crawl your site, how often, and which pages they target.

Core Web Vitals

Track LCP, CLS, INP, FCP, and TTFB directly in your dashboard. GA4 doesn't offer this built-in.

Genuinely free tier

Copper Analyticsoffers a permanent free plan for smaller sites — no credit card, no trial expiration.

You can read our full comparison of Google Analytics alternatives for a deeper look at your options, or check out our 5-minute analytics setup guide if you want to get started right away.

Final Verdict

The right analytics tool depends on what you actually need from your data — and how much setup complexity you're willing to take on.

Choose Google Analytics 4

If you need multi-channel attribution, advanced e-commerce tracking, audience segmentation, or integration with Google Ads. GA4 is the most powerful free analytics tool available — but the learning curve, consent requirements, and setup time are real costs.

ChooseCopper Analytics

If you want pageviews, visitors, referrers, top pages, and geographic data without cookies, consent banners, or a 30-minute setup. Add AI crawler tracking and Core Web Vitals monitoring that GA4 doesn't offer. Two minutes to set up, free tier available.

For most blogs, portfolios, documentation sites, and small business websites, GA4's complexity is overhead you don't need. For enterprise marketing teams running paid campaigns across multiple channels, it's indispensable. Know your needs, pick accordingly.

Want Simpler Analytics?

Copper Analyticsgives you the traffic insights you need without cookies, consent banners, or a 30-minute setup. One script tag, two minutes, done.

What to Do Next

The right stack depends on how much visibility, workflow control, and reporting depth you need. If you want a simpler way to centralize site reporting and operational data, compare plans on the pricing page and start with a free Copper Analytics account.

You can also keep exploring related guides from the Copper Analytics blog to compare tools, setup patterns, and reporting workflows before making a decision.