How To Set Up Google Analytics On My Website

How To Set Up Google Analytics On My Website

The Short Answer First

Setting up Google Analytics on your website takes about 15 minutes for the basic installation. You create a Google Analytics 4 (GA4) property, grab the tracking code, and add it to every page of your site, usually through Google Tag Manager or a direct code snippet. But here’s what most guides won’t tell you: the installation is the easy part. The difference between a Google Analytics setup that actually helps you make decisions and one that just collects noise comes down to what you configure after the tracking code is live.

In our projects at NexusBond, we’ve inherited dozens of Google Analytics setups where the code was correctly installed but virtually nothing useful was being tracked. Page views were flowing in, but nobody could answer basic questions like “which pages actually lead to enquiries” or “where do visitors drop off before converting.” This article covers the full setup process, from account creation through to the configuration steps that make your data genuinely useful.

Before You Start: What You’ll Need

Gather these before you begin, so you’re not switching between tabs and losing your place:

  • A Google account (a standard Gmail address works, but use one that belongs to your organisation, not a personal account you might lose access to)
  • Admin access to your website, either to the HTML source code, your CMS (WordPress, Shopify, Squarespace, etc.), or your hosting provider’s settings
  • A clear idea of your website’s primary goal, whether that’s form submissions, phone calls, product purchases, or content engagement
  • Access to Google Tag Manager (optional but strongly recommended, and we’ll explain why below)

One important note on the Google account: use a company-owned email address, not a developer’s personal Gmail. We see this go wrong regularly. An agency or freelancer sets up Analytics under their own account, the relationship ends, and the business loses years of historical data. Create a shared company Google account (something like [email protected]) and use that as the property owner. You can always add individual users with appropriate permission levels later.

Step 1: Create Your Google Analytics 4 Property

Google Analytics 4 (GA4) is the current and only version of Google Analytics. The older Universal Analytics was sunset in July 2023, so if you’re starting fresh, you’ll be working exclusively with GA4. Here’s the process:

Go to analytics.google.com and sign in with your chosen Google account. If this is your first time, you’ll see a setup wizard. If you already have an account from a previous project, click Admin (the gear icon in the bottom left) and then Create > Property.

You’ll be asked for a property name. Use something descriptive like “YourCompany.com – Production” rather than just your company name. This matters because you may eventually have separate properties for staging environments, subdomains, or different business units. Being specific now saves confusion later.

Next, set your reporting time zone and currency. Choose the time zone where your primary audience is located, not where your server sits. If you’re a UK-based B2B company, set it to GMT/BST and GBP. This affects how daily reports are segmented and how revenue data is displayed.

Google will then ask about your business details: industry category, business size, and how you intend to use Analytics. Answer these honestly. They influence which default reports Google surfaces for you, though you can always customise later.

Finally, you’ll be asked to choose a platform. Select “Web” (unless you’re also tracking a mobile app, in which case you’ll add that as a separate data stream). Enter your website URL and give the stream a name. Google will generate your Measurement ID, which looks like G-XXXXXXXXXX. This is the identifier you’ll use to connect your website to this specific GA4 property.

Step 1: Create Your Google Analytics 4 Property Step 2: Install the Tracking Code

Step 2: Install the Tracking Code

You have two options here, and the right choice depends on how much control you want over your tracking long term.

Option A: Direct Code Installation (Quick but Limited)

GA4 provides a Global Site Tag (gtag.js) snippet that you can paste directly into your website’s HTML. You’ll find this in Admin > Data Streams > select your stream > View tag instructions. The snippet looks like a small block of JavaScript that references your Measurement ID.

Paste this code into the <head> section of every page on your site. If you’re using a CMS like WordPress, most themes have a “Header Scripts” field in their settings where you can paste this once and it applies site-wide. Shopify has a similar field under Online Store > Themes > Edit Code > theme.liquid. Squarespace has a dedicated code injection panel under Settings > Advanced.

This approach works and it’s fast. But it has a significant limitation: every time you want to track something new, like a button click, a form submission, or a scroll depth threshold, you’ll need to edit code on the site itself. For a simple brochure site that rarely changes, this might be fine. For anything more complex, you’ll want Option B.

Option B: Google Tag Manager (Recommended)

Google Tag Manager (GTM) is a free tool that acts as a container for all your tracking codes. Instead of pasting the GA4 snippet directly onto your site, you paste the GTM container code once, and then manage all your tracking, including GA4, Facebook Pixel, LinkedIn Insight Tag, and custom event tracking, from the GTM interface without touching your website’s source code again.

To set this up, go to tagmanager.google.com, create an account and container for your website, and paste the two GTM code snippets onto your site (one in the <head>, one immediately after the opening <body> tag). Then, inside GTM, create a new tag:

  • Tag type: Google Analytics: GA4 Configuration
  • Measurement ID: your G-XXXXXXXXXX code
  • Trigger: All Pages

Click Submit to publish the container, and your GA4 tracking is live. What makes this approach superior is that every future tracking requirement, from event tracking to conversion goals, can be configured in GTM without a developer touching your website. In our experience at NexusBond, teams that use GTM from the start spend roughly 60-70% less time on tracking changes over the life of a site compared to those managing code directly.

Step 3: Verify Your Installation

Never assume the tracking is working just because you followed the steps. Verify it immediately.

Open your website in a browser, then go to Google Analytics and click Reports > Realtime. You should see at least one active user (you). If the Realtime report shows activity, your basic setup is working.

For a more thorough check, install the Google Tag Assistant browser extension (now called Tag Assistant Companion). This tool lets you see exactly which tags are firing on each page, whether they’re sending data correctly, and if there are any errors. It’s particularly useful if you’re using GTM, because it shows you the tag firing sequence and any data layer variables being passed.

One common gotcha: ad blockers and privacy extensions will prevent the tracking code from firing. If you’re testing and seeing nothing in Realtime, try an incognito window with extensions disabled. Also check that you haven’t accidentally added the code twice, once directly and once via GTM. Duplicate tracking inflates your page view counts and corrupts your data from day one.

Step 4: Configure the Settings That Actually Matter

This is where most setups stall. The code is live, page views are collecting, and the person responsible assumes the job is done. It isn’t. GA4’s default configuration misses several critical settings that affect data quality and usefulness.

Enable Enhanced Measurement

GA4 has a feature called Enhanced Measurement that automatically tracks certain interactions without any additional code. Go to Admin > Data Streams > select your stream, and you’ll see a toggle for Enhanced Measurement. Make sure it’s on, then click the gear icon to review what’s being tracked:

  • Page views (on by default)
  • Scrolls (fires when a user reaches 90% of the page)
  • Outbound clicks (clicks to external domains)
  • Site search (captures search terms if your site has a search function)
  • Video engagement (tracks play, progress, and completion for embedded YouTube videos)
  • File downloads (tracks clicks on links to PDFs, spreadsheets, and other documents)

These are genuinely useful baseline events. The scroll tracking is a bit crude since it only fires at 90%, which means you can’t distinguish between someone who scrolled 20% and someone who scrolled 89%. For more granular scroll tracking, you’d set up custom events in GTM. But as a starting point, Enhanced Measurement gives you far more than raw page views.

Set Up Cross-Domain Tracking (If Needed)

If your website spans multiple domains, for example if your main site is on yourcompany.com but your booking system or e-commerce checkout lives on shop.yourcompany.com or a third-party platform, you need cross-domain tracking. Without it, GA4 treats a user who moves between domains as two separate sessions, which inflates your traffic counts and breaks your conversion attribution.

Configure this under Admin > Data Streams > select your stream > Configure tag settings > Configure your domains. Add each domain that’s part of your user journey. GA4 will then pass session information between domains seamlessly.

Exclude Internal Traffic

Your own team visiting the site multiple times a day will skew your data, especially if you’re a smaller company where internal visits might represent a noticeable percentage of total traffic. Define an internal traffic filter under Admin > Data Streams > Configure tag settings > Define internal traffic. You can filter by IP address or IP range.

GA4 handles this slightly differently from the old Universal Analytics. Internal traffic is tagged with a parameter but not automatically excluded. You need to go to Admin > Data Settings > Data Filters and activate the filter. Leave it in “Testing” mode for a few days first to make sure you’re not accidentally filtering out real visitors, then switch it to “Active.”

Adjust Data Retention

By default, GA4 retains detailed event data for two months. This is absurdly short for most businesses. Go to Admin > Data Settings > Data Retention and change it to 14 months, which is the maximum available in the free version. This affects your ability to use the Explorations reports for historical analysis. Standard reports use aggregated data that isn’t affected by this setting, but if you ever want to build custom reports looking back more than two months, you’ll need the extended retention.

Link Google Search Console

If you have Google Search Console set up for your site (and you should), link it to your GA4 property under Admin > Product Links > Search Console Links. This brings organic search query data directly into your Analytics reports, so you can see which search terms are driving traffic and how those visitors behave once they arrive. Without this link, you’re blind to the “what did they search for” half of the organic traffic equation.

Step 5: Define and Track Your Conversions

A Google Analytics setup without defined conversions is like a scoreboard without a score. You can see activity, but you have no way to measure whether that activity is producing results.

In GA4, conversions are simply events that you’ve marked as important. The first step is identifying which actions on your site represent meaningful business outcomes. For a B2B company, that’s typically:

  • Contact form submissions
  • Demo or consultation requests
  • Phone number clicks (on mobile)
  • Email link clicks
  • Downloadable resource requests (gated content)

If your forms redirect to a thank-you page after submission, you can create a conversion based on the page_view event where the page_location contains “/thank-you” (or whatever your confirmation page URL is). Do this in Admin > Events > Create event. Set the conditions to match the specific page, and then toggle the “Mark as conversion” switch.

For forms that don’t redirect, or for button clicks and other interactions, you’ll need to set up custom events in Google Tag Manager. This typically involves creating a trigger that fires when a specific form is submitted or a specific button is clicked, paired with a GA4 Event tag that sends the event name to your property. The event name should be descriptive and consistent: something like “form_submit_contact” or “click_phone_number” rather than vague labels like “event1.”

This is the stage where, in our experience at NexusBond, the gap between a functional setup and a genuinely useful one becomes most apparent. If you’d like to understand how we approach this holistically, our measurement systems guide covers the broader framework we use to make sure tracking connects to actual business questions from the start.

Step 5: Define and Track Your Conversions Step 6: Build a Reporting View That's Actually Usable

Step 6: Build a Reporting View That’s Actually Usable

GA4’s default interface can feel overwhelming. The reports are organised differently from what most people expect, and the sheer volume of data creates analysis paralysis. A few targeted adjustments make the platform far more practical for day-to-day use.

Start by customising your report navigation. Go to Library (bottom left of the Reports section) and you can rearrange, add, or remove report collections. Most B2B companies don’t need the Monetisation reports if they’re not running e-commerce. Removing clutter from the navigation makes it easier for your team to find what matters.

Next, create a custom dashboard using Explorations. The Explore section lets you build freeform reports that answer specific questions. A practical starting point is a funnel exploration that maps your user journey: landing page > key content pages > conversion page. This immediately shows you where visitors are dropping off and helps prioritise improvements.

Consider also connecting GA4 to Looker Studio (Google’s free dashboarding tool). Looker Studio lets you pull GA4 data into visual dashboards that you can share with stakeholders who should never have to log into Analytics directly. A well-designed Looker Studio dashboard with five or six key metrics, updated automatically, is worth more to most leadership teams than full GA4 access.

Common Mistakes That Corrupt Your Data

What we typically find on mid-market sites is not that Analytics is set up wrong, but that small configuration errors have been quietly degrading data quality for months. Here are the issues we encounter most frequently:

Tracking code on staging or development environments. If your staging site uses the same GA4 Measurement ID as your production site, every test visit, QA session, and developer page load gets mixed into your real data. Always use a separate property for non-production environments, or filter out staging traffic rigorously.

Not filtering bot traffic. GA4 does a reasonable job of excluding known bots automatically, but referral spam and low-quality traffic still slip through. Monitor your traffic sources regularly for suspicious referrals with 100% bounce rates and zero engagement time. These inflate your numbers and distort your channel performance data.

Duplicate tags firing on the same page. This happens when someone installs the GA4 snippet directly in the site header and also deploys it through Google Tag Manager. Every page view gets counted twice. Every event fires twice. Your data becomes useless. Always check for duplicate tracking before assuming your setup is complete.

Ignoring consent requirements. If your site serves visitors in the EU or UK, you need a cookie consent mechanism that blocks Analytics from firing until the user has given consent. GA4 supports a Consent Mode that allows you to model data for users who decline cookies, but it needs to be configured properly. Installing Analytics without addressing consent isn’t just a legal risk; it means your data may not reflect actual visitor behaviour since privacy-conscious users are systematically excluded from your reports.

GA4 vs. Universal Analytics: What’s Different

If you’ve used Google Analytics before July 2023, you were probably on Universal Analytics (UA). GA4 is fundamentally different in ways that affect how you think about data, not just where you click.

Everything is an event. In UA, you had distinct hit types: page views, events, transactions, social interactions. In GA4, every interaction is an event. A page view is an event called “page_view.” A purchase is an event called “purchase.” This simplification makes custom tracking more consistent but requires you to be more deliberate about naming and organising your events.

Sessions work differently. UA started a new session at midnight or when a campaign source changed. GA4 doesn’t restart sessions at midnight, and campaign source changes during a session don’t create a new one. This means your session counts in GA4 will typically be lower than what you saw in UA, which isn’t a data problem; it’s a more accurate reflection of actual user behaviour.

Engagement metrics replace bounce rate. GA4 introduced engaged sessions (sessions lasting longer than 10 seconds, with a conversion event, or with two or more page views) and engagement rate as the inverse of bounce rate. These are more useful metrics because they distinguish between someone who lands on a page, reads the entire thing for four minutes, and leaves satisfied, versus someone who lands and immediately hits the back button. Both were “bounces” in UA. Only the latter is truly disengaged.

What to Do After Setup

Your Google Analytics installation is a starting point, not a finished product. In the first two weeks after going live, check your Realtime report daily to confirm data is flowing. After two weeks, review your traffic sources, top pages, and conversion events to make sure everything looks plausible. If your site gets 500 visits a day but your form submission conversion shows zero events, something is misconfigured.

Build a habit of reviewing your data at a fixed cadence, weekly for tactical metrics like traffic and conversions, monthly for trends and channel performance. Analytics only creates value when someone actually looks at it and makes decisions based on what they see. The most sophisticated setup in the world is worthless if the reports sit unopened.

Finally, treat your tracking configuration as a living system. As your site evolves, with new pages, new forms, new CTAs, and new campaign landing pages, your tracking needs to evolve with it. Schedule a quarterly audit where you verify that all conversion events are still firing, no new pages have been added without proper tracking, and your filters are still working as intended. Fifteen minutes of maintenance every quarter prevents the slow data decay that makes most Analytics setups unreliable within a year of installation.

Related