How to Add Google Analytics 4

Cody Schneider8 min read

Getting Google Analytics 4 set up on your website is one of the most important first steps in understanding your audience and measuring your marketing efforts. With Google's older Universal Analytics now phased out, GA4 is the new standard. This guide provides a straightforward walkthrough for setting up GA4, whether you’re starting from scratch with a new site or upgrading from an old setup.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

What is Google Analytics 4 (and Why You Need It)?

Google Analytics 4 is the latest version of Google's flagship analytics platform. It represents a significant shift from its predecessor, Universal Analytics (UA). Instead of being centered around "sessions" and "page views," GA4 is built around an "event-based" model. This means it tracks specific actions users take - like a button click, a video view, or a form submission - giving you a more granular and user-centric view of how people interact with your site.

Here’s why that matters for you:

  • A More Accurate Customer Journey: GA4 is designed to track users across different devices and platforms (like your website and your app) more effectively, painting a clearer picture of the entire customer journey.
  • Predictive Insights: It uses Google's machine learning capabilities to offer predictive metrics, such as the probability a user will make a purchase or churn, helping you be more proactive with your marketing.
  • Bye-Bye, Bounces: The notoriously tricky "bounce rate" metric has been replaced with more meaningful "engagement" metrics, focusing on users who actually interact with your site rather than those who just show up and leave.

In short, GA4 is better equipped for the modern web. Setting it up is no longer optional, it’s essential for making smart, data-driven decisions.

Setting Up Google Analytics 4: Two Scenarios

Your setup process will depend on where you're starting from. There are two primary paths:

  1. For a brand new website: You’ll be creating a new Google Analytics account and a new GA4 property from the ground up.
  2. For an existing website with Universal Analytics: You’ll create a new GA4 property alongside your old UA property using the "GA4 Setup Assistant." While UA no longer collects data, you might be revisiting a site with the old code still installed.

We'll walk through both scenarios step by step.

Method 1: Setting Up GA4 on a New Website

If you're starting fresh, the process is clean and simple. Follow these steps to create your account and get your tracking ID.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Step 1: Create Your Google Analytics Account

An "account" is the highest level in the GA hierarchy. This is where your company or organization lives. One account can contain multiple "properties" (your different websites or apps).

  • Go to the Google Analytics homepage and sign in with your Google account.
  • Once you're in, click "Start measuring."
  • Enter an Account name. This is usually your business name (e.g., "My Awesome Company").
  • Review the data-sharing settings and click "Next."

Step 2: Create a GA4 Property

A "property" is your website or application. This is where the data from your users is collected and processed.

  • On the next screen, enter a Property name. This should be the name of your website (e.g., "myawesomewebsite.com").
  • Select your reporting time zone and currency. This is important for accurate reporting, especially for e-commerce sites.
  • Click "Next."
  • Provide some basic business information (your industry and business size) so Google can tailor your reports, then click "Create."

Step 3: Create a Data Stream

A "data stream" is the source of your data. For a website, it's the stream of information flowing from your site into your GA4 property.

  • After creating the property, you'll be prompted to set up a data stream. Choose "Web."
  • Next, enter your website's URL (e.g., www.myawesomewebsite.com) and give the stream a name (the URL usually works great).
  • Ensure that "Enhanced measurement" is turned on. This automatically tracks common user actions like page views, scrolls, outbound clicks, and site searches without any extra setup.
  • Click "Create stream."

At this point, you'll see a screen with your stream details. The most important piece of information here is your Measurement ID, an ID that starts with "G-" (e.g., G-XXXXXXXXXX). This is the key you'll use to connect your website to this GA4 property. Keep this ID handy!

Method 2: Upgrading from Universal Analytics (UA) to GA4

If you're managing a site that previously used Universal Analytics, Google created a simple tool to help you get GA4 running. Universal Analytics properties stopped processing new data in July 2023, but the GA4 Setup Assistant still makes the transition painless.

  1. Log into your existing Google Analytics account and navigate to the Universal Analytics property you want to upgrade.
  2. Go to the Admin section (the gear icon at the bottom left).
  3. In the "Property" column, the first option should be GA4 Setup Assistant. Click it.
  4. Under "I want to create a new Google Analytics 4 property," click the Get Started button.

A popup will explain what the wizard does. It will essentially:

  • Create a brand new GA4 property for you.
  • Copy over basic settings like your property name and URL from your UA property.
  • Activate "Enhanced measurement."

After you run the wizard, you'll have a new GA4 property alongside your old UA property. You will still need to add the new GA4 measurement tag to your website. Find your new "G-" Measurement ID in the Data Stream settings of your new GA4 property.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

Adding the GA4 Tag to Your Website

Once you have your Measurement ID, the final step is to tell your website to start sending data to GA4. Here are the three most common ways to do this, from easiest to most advanced.

Using a Website Builder or Platform Plugin (The Easiest Way)

Most modern website platforms (WordPress, Shopify, Squarespace, Wix, etc.) have a built-in field to add your Google Analytics ID.

  • For WordPress: The easiest way is using a plugin like MonsterInsights or Site Kit by Google. During setup, these plugins will ask you to connect your Google account, and they handle the rest. Alternatively, some themes have a section in the Theme Options where you can paste your Measurement ID directly.
  • For Shopify: Go to your Shopify Admin > Online Store > Preferences. In the "Google Analytics" section, paste your Measurement ID.
  • For Squarespace or Wix: Look for "Marketing Integrations" or "External Tools" in your site's settings. There will be a dedicated field for your Google Analytics Measurement ID.

Using Google Tag Manager (The Best Practice)

If you plan on adding more tracking scripts in the future (like for Facebook Ads or other marketing tools), using Google Tag Manager (GTM) from the start is highly recommended. It acts as a central hub for all your tags so you don't have to keep editing your site's code.

  1. In GTM, create a new tag and select the type "Google Analytics: GA4 Configuration."
  2. In the "Measurement ID" field, paste your G-XXXXXXXXXX ID.
  3. Next, create a Trigger. The most common trigger is "All Pages," which will fire the tag every time any page on your site is loaded.
  4. Save your tag and - this is a critical step - click the Submit button in the top right corner of GTM to publish your changes live.

Manually Adding the GA4 Code (The Custom Way)

If you have a custom-built website and don't use a CMS or GTM, you can add the code directly to your site's files. In your GA4 Data Stream settings, you can find the global site tag (gtag.js) script.

It looks something like this:

<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX"></script>
<script>
  window.dataLayer = window.dataLayer || [],
  function gtag(){dataLayer.push(arguments),}
  gtag('js', new Date()),

  gtag('config', 'G-XXXXXXXXXX'),
</script>

You need to copy this entire code snippet and paste it immediately after the opening <head> tag on every single page of your website.

GraphedGraphed

Still Building Reports Manually?

Watch how growth teams are getting answers in seconds — not days.

Watch Graphed demo video

How to Check if GA4 Is Working Correctly

Give your site about 30 minutes after adding the tag, then it's time to verify that data is coming in properly.

The simplest way is with the Realtime report in GA4. Go to GA4 and navigate to Reports > Realtime. Then, open your website in a new browser tab or an incognito window. You should see yourself appear as a visitor in the Realtime report within a minute or two. If you see activity, congratulations - you've successfully installed Google Analytics 4!

Final Thoughts

Setting up Google Analytics 4 is a foundational step for any website owner, marketer, or business. The process is simple: create a property and data stream to get your Measurement ID, then add the GA4 tag to your website using a plugin, Google Tag Manager, or by editing your code. Taking a few minutes to verify an ongoing data connection ensures you’ll be ready when you go in for your first analysis.

Of course, once your data is flowing in, the next challenge is actually making sense of it all. Manually piecing together reports across several different platforms is where most people get stuck and spend hours that they should be dedicating elsewhere. At Graphed, we've automated this entire process so you don’t have to. With a few clicks, you can instantly connect your systems like Google Analytics, Shopify, and your ad platforms, and then get all of your important reporting done by writing in plain English. For example, instead of filtering through menus looking for insights on a campaign’s performance, asking something like, "build me a real-time report that focuses on my ad spend to revenue by campaign for the past two weeks” answers the same question in a tiny fraction of the time. If you’re ready to get straight to the insights with less work, check out Graphed. Our real-time data integration, easy to build dashboards, and chat features turn hours of frustration into just a few seconds' conversation.

Related Articles