How to Set Up Google Analytics 4

Cody Schneider8 min read

Setting up Google Analytics 4 is one of the most important first steps for understanding who is visiting your website and how they behave. This guide will walk you through creating a GA4 property from scratch, adding the tracking code to your site, and making sure your data is flowing correctly.

First, What Is Google Analytics 4?

Google Analytics 4 is the latest version of Google's web analytics platform, replacing the old Universal Analytics (UA). The big difference is its data model. While UA was built around "sessions" and "pageviews," GA4 is built around "events." Every action a user takes - from a page view to a purchase to a button click - is now considered an event.

This event-based model is more flexible and provides a more complete picture of the user journey, especially since it can unify tracking across both websites and mobile apps. It also has better privacy controls and uses machine learning to offer predictive insights about user behavior.

Step 1: Create a Google Analytics 4 Account and Property

If you’re starting fresh, you’ll need to create both an account and a property. An account is the top-level container that can hold one or more properties. A property represents your website or app.

Go to the Google Analytics Homepage

First, navigate to the Google Analytics homepage. You’ll need a Google account to get started. Click “Start measuring” to begin.

Create an Account

You’ll be prompted to create your account first. Think of this as the parent folder for your business.

  • Account Name: Give your account a recognizable name, like your company name. This helps if you manage multiple businesses under one login.
  • Account Data Sharing Settings: These settings give you control over how you share your anonymous data with Google. Review the options and check the ones you’re comfortable with. For most users, the default settings are fine.

Click “Next” to move on to property setup.

Create a Property

The property is where your website's data lives. You can have multiple properties within one account (e.g., one for your website, one for your mobile app, one for a different brand).

  • Property Name: Enter a clear name for your property, such as your website’s URL or brand name.
  • Reporting Time Zone and Currency: Select the correct time zone and currency for your business. This is crucial for accurate timing on your reports and for e-commerce tracking.

On the next screen, you’ll provide business details. This information helps Google tailor your experience by providing industry-specific benchmarks and reports. Choose your industry category and business size. Then, select the business objectives that align with your goals, like "Generate leads" or "Drive online sales."

Step 2: Set Up Your First Data Stream

After creating your property, you need to set up a "data stream." A data stream is simply the source of your data. It tells Analytics where the information is coming from, whether it's a website or an app.

Since you're setting this up for a website, choose "Web."

  • Website URL: Enter your website’s primary URL. Make sure you have the correct https:// or http:// prefix.
  • Stream Name: Give your stream a name you'll remember, like “[Your Brand] Website.”

Enhanced Measurement

By default, GA4 enables “Enhanced measurement.” This is one of GA4's best features for new users because it automatically tracks common interactions without any extra coding. These include:

  • Page views
  • Scrolls (when a user reaches the bottom 90% of a page)
  • Outbound clicks
  • Site search
  • Video engagement
  • File downloads

For almost all situations, you should leave enhanced measurement enabled. Click “Create stream” to finalize it.

Step 3: Add the GA4 Tracking Tag to Your Website

Now comes the most important part: adding the GA4 tracking code to your website. After you create a data stream, GA4 will provide you with your “Measurement ID” (which looks like G-XXXXXXXXXX) and the necessary tracking code, also known as the Global Site Tag (gtag.js).

There are a few ways to add this tag to your site, depending on your platform and comfort level with code.

Method 1: Using the Global Site Tag (gtag.js) Directly

This method involves copying a JavaScript snippet and pasting it directly into your website’s code. It's best for custom-built websites or those where you have direct access to the HTML files.

Find the code snippet under Install manually. It will look something like this:

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

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

You need to copy this entire block of code and paste it into the <head> section of every page on your website. If you're using a template or header file, you can often add it there just once.

Method 2: Using Google Tag Manager (Recommended)

Google Tag Manager (GTM) is the most flexible and scalable way to manage your GA4 tag, along with any other marketing or analytics tags. It allows you to add and update your tags without ever touching your website's code directly.

If you're already using GTM, follow these steps:

  1. In GTM, go to Tags and click “New.”
  2. Name your tag something clear, like “GA4 - Configuration Tag.”
  3. Click “Tag Configuration” and choose Google Analytics: GA4 Configuration from the list.
  4. In the Measurement ID box, paste your GA4 Measurement ID (G-XXXXXXXXXX).
  5. Next, click “Triggering” and select All Pages as the trigger. This ensures your GA4 tag loads first on every page view.
  6. Save your tag. Don’t forget to click “Submit” in the top-right corner of your GTM dashboard and then “Publish” your changes to make them live.

This is generally the best-practice method for deploying tracking tags.

Method 3: Using a Website Builder or CMS Plugin

Most popular platforms like WordPress, Shopify, and Squarespace have built-in integrations for GA4. This is usually the easiest method if your site is built on one of these platforms.

  • For WordPress: Many themes have a designated field in the theme customization settings to paste your Measurement ID. Alternatively, use plugins like "Site Kit by Google" or "GA Google Analytics."
  • For Shopify: Add your Google Analytics tag ID directly in your store's settings. Navigate to Online Store > Preferences. In the Google Analytics section, you'll see a field to paste your GA4 measurement ID.
  • For Squarespace: In your Squarespace admin, go to Settings > Advanced > External API Keys. There, you'll find a box to paste in your GA4 Measurement ID.

Step 4: Verify That Your GA4 Tag is Working

Once you’ve installed the tracking tag, it's essential to confirm that it's working properly. Don't just assume it’s collecting data!

Check the Realtime Report

This is the simplest way to see if data is flowing in.

  1. Open your website in a new browser tab or on your phone.
  2. In your Google Analytics account, navigate to Reports > Realtime.
  3. Within minutes, you should see yourself as an active user on the map and in the "Users in Last 30 Minutes" card.

If you see activity, congratulations! Your basic installation is working correctly.

Use GTM's Preview & Debug Mode

If you used Google Tag Manager, you can use its powerful Preview mode to verify the tag is firing correctly.

  1. In GTM, click the “Preview” button.
  2. Enter your website’s URL and click "Connect." Your site will open in a new tab with a debug panel.
  3. Check the "Tags Fired" section on the left. You should see your “GA4 - Configuration Tag” listed there. If you see it, you're good to go.

What's Next? Key Initial Configurations

Your GA4 property is now collecting data, but there are a few important settings you should configure right away.

1. Define Internal Traffic

You don't want your own team's activity skewing your website data. GA4 makes it easy to exclude this traffic.

  • Go to Admin > Data Streams and select your web stream.
  • Click on Configure tag settings, then Show all > Define internal traffic.
  • Create a rule using your office's IP address. This tells GA4 to treat visits from that IP as "internal" and exclude them from your reports.

2. Adjust Data Retention Settings

By default, GA4 only stores user-level data (used for custom explorations and funnels) for two months. For long-term analysis, you should change this.

  • Head to Admin > Data Settings > Data Retention.
  • Change the "Event data retention" setting from 2 months to the maximum of 14 months.

3. Link Other Google Products

One of the biggest strengths of GA4 is its ability to integrate with other Google platforms.

  • Go to Admin > Product links. From here, you should link your Google Ads and Google Search Console accounts.
  • Linking Google Ads helps you analyze your ad campaigns and import conversion data.
  • Linking Search Console lets you see your organic search query data directly inside GA4 reports.

Final Thoughts

This guide walked you through the entire process of getting a Google Analytics 4 property live, from creating your account to verifying that data is being recorded. Your GA4 property is now collecting valuable event-based data that will help you better understand user behavior and make informed decisions to grow your website or business.

Manually creating useful reports from the raw data in GA4's complex interface can be overwhelming at first. At Graphed, we handle all that complexity for you. Simply connect your Google Analytics account in seconds, and use conversational prompts like "Show me my top traffic sources for the last 30 days" to instantly build live dashboards and reports, skipping the steep learning curve entirely.

Related Articles

How to Connect Facebook to Google Data Studio: The Complete Guide for 2026

Connecting Facebook Ads to Google Data Studio (now called Looker Studio) has become essential for digital marketers who want to create comprehensive, visually appealing reports that go beyond the basic analytics provided by Facebook's native Ads Manager. If you're struggling with fragmented reporting across multiple platforms or spending too much time manually exporting data, this guide will show you exactly how to streamline your Facebook advertising analytics.

Appsflyer vs Mixpanel​: Complete 2026 Comparison Guide

The difference between AppsFlyer and Mixpanel isn't just about features—it's about understanding two fundamentally different approaches to data that can make or break your growth strategy. One tracks how users find you, the other reveals what they do once they arrive. Most companies need insights from both worlds, but knowing where to start can save you months of implementation headaches and thousands in wasted budget.