Sub topic 1
Start with a GA4 property and a web data stream
Every Google Analytics 4 (GA4) installation begins in the Analytics admin area, not on your website. Before any tag can send data, GA4 needs a place to receive it. That place is a property that contains a web data stream. This chapter explains how those pieces fit together, how to create them, and which settings to decide on now because they are awkward to change later.
Prerequisites
This chapter assumes you already have the following:
- A basic idea of what web analytics measures: users, sessions, and events.
- A Google account that you can sign in with at analytics.google.com.
- Access to edit your website's HTML or your website platform's settings. You will need this in later chapters, but not to complete this one.
- Familiarity with what a script tag in a page's head is. You do not need to write one yet.
You do not need an existing Analytics account. If your organization already uses one, ask the account administrator for access before you create anything new (see "Permissions and ownership" below).
The structure: account, property, data stream
GA4 organizes your configuration in three levels. Knowing which level a setting lives on saves you from hunting through the wrong menu.
- An account is the top-level container. It represents a company, a team, or a person. Users and their roles can be granted at this level, and the permissions flow down to everything inside.
- A property is where your data is stored and reported. Reports, audiences, conversion settings, data retention, and most privacy settings belong to the property. A property is the thing you open when you look at a report.
- A data stream is a source of data feeding a property. A web data stream collects data from a website. App streams (iOS and Android) feed the same property from mobile apps.
The arrow from the tag back to the stream is the important one. The tag on your site does not know about your account or your property. It knows only a Measurement ID, which identifies one web data stream. GA4 uses that ID to route incoming events to the right property. The next chapter covers the Measurement ID in detail.
Why the property comes first
In the older Universal Analytics, you created a property and received a tracking ID of the form UA-XXXXX-Y. Universal Analytics stopped processing data in 2023, and GA4 replaced it. GA4 uses a different data model in which everything is an event, and it uses a different ID format. If you find an old tutorial or a plugin setting that asks for a "UA-" ID, it does not apply to GA4.
Because the property holds the reports and settings, creating it correctly matters more than creating the stream. You can add or remove streams later without much consequence. You cannot easily move historical data from one property to another.
Permissions and ownership
You need at least the Editor role on a property to create a data stream on it, and the Editor role on an account to create a property inside it. In practice, the person who creates the account becomes its Administrator, which covers everything.
Check these points before you start:
- Sign in with the Google account that should own the data. A personal Gmail account that belongs to a former employee is a common source of problems later, because nobody else can manage the property.
- If your company already has an Analytics account, create the new property inside it instead of making a separate account. This keeps user management in one place.
- Add at least one other Administrator. If the only Administrator leaves, recovering access is slow.
Create an account and a property
If you have no Analytics account, go to analytics.google.com and follow the setup flow. If you already have one, open Admin (the gear icon, bottom left) and use Create > Property. Either way you will make the same choices.
Account settings
Give the account a name that identifies the organization, such as "Example Co". You can also choose data-sharing settings here. They control whether Google may use your data for benchmarking, product improvement, and support. Review each option and keep the ones your organization's privacy policy permits.
Property settings
The property setup asks for four things that affect how data is reported.
| Setting | What it controls | Can it change later? |
|---|---|---|
| Property name | The label you see in the account picker | Yes, at any time |
| Reporting time zone | How events are assigned to days in reports | Yes, but see the warning below |
| Currency | The currency used for revenue and value reporting | Yes, but see the warning below |
| Industry category and business size | Used for benchmarking and suggestions | Yes |
Use a time zone that matches how your business thinks about a "day". If your team is in Berlin and your reports are based on Los Angeles time, the daily totals will not match your internal numbers.
Business objectives
Setup may ask you to pick business objectives, such as generating leads or driving online sales. This choice affects which reports appear in the left-hand navigation by default. It does not change what data is collected, and you can change it later in the property's report settings.
Create the web data stream
After you finish creating the property, GA4 prompts you to choose a platform. If it does not, or if you are adding a stream to an existing property, use Admin > Data collection and modification > Data streams > Add stream > Web.
You will fill in two fields:
- Website URL. Enter the main address of your site, for example
www.example.com, and choose the protocol (https:// or http://). Use the address visitors actually see. Do not enter a path such as/blog. - Stream name. A label for your reference, such as "Example Co Website". It appears in the Data streams list and in some reports.
Below these fields is the Enhanced measurement toggle. It is on by default. It makes the tag automatically record events such as scrolls, outbound clicks, site search, video engagement, and file downloads, without extra code. Later in this tutorial a chapter reviews each option. For now, leave it on unless you have a specific reason to turn it off.
Click Create stream. GA4 opens the Web stream details page. This page shows the stream name, the stream URL, a Stream ID, and the Measurement ID, which starts with G-. You will copy that Measurement ID into your installation in the next chapters.
How many streams should you create?
A common intermediate question is whether to create one stream per site, per subdomain, or per environment. The following guidance applies in most cases.
| Situation | Recommended setup |
|---|---|
| One website, one domain | One web data stream |
| A site with subdomains, such as `www.example.com` and `shop.example.com` | One web data stream, shared across the subdomains |
| Two separate sites that make up one customer journey | One property with one stream and cross-domain measurement, or a separate property for each, depending on whether you want combined reporting |
| A website and a mobile app | One property with a web stream and one or more app streams, if you want to see users across both |
| Staging and production versions of a site | Separate properties, or at least a separate stream, so test traffic does not mix with real traffic |
A single stream can receive data from any site that uses its Measurement ID. GA4 does not block a site because its URL differs from the one you entered. This is convenient and also a risk. If you copy a tag from the production site to a staging site, staging visits will appear in your production reports. Data filters and a separate test property are the usual fixes. A later chapter on avoiding duplicate tags covers related mistakes.
Settings to check right after creation
Two property-level settings are worth reviewing before you write any installation code, because their defaults are not what most teams want.
Data retention
By default, GA4 keeps event-level data for two months. This affects Explorations and some custom analysis, not the standard aggregated reports. Open Admin > Data collection and modification > Data retention and change Event data retention to 14 months, which is the maximum for standard properties.
Internal traffic and unwanted referrals
You do not need to configure these today, but note that they exist under Admin > Data collection and modification > Data streams > your stream > Configure tag settings. Defining your office IP addresses as internal traffic keeps your own visits out of the numbers. Doing this early is easier than cleaning up the data later.
A quick format check for a Measurement ID
You will often copy a Measurement ID between systems. A small check helps you catch a pasted Universal Analytics ID or a stray space. The following JavaScript function accepts only the G- format and can be run in any browser console or in Node.js.
function isValidMeasurementId(value) {
// GA4 web Measurement IDs start with "G-" followed by letters and digits.
return /^G-[A-Z0-9]+$/.test(value);
}
console.log(isValidMeasurementId("G-ABC123DEF4")); // true
console.log(isValidMeasurementId("UA-12345-1")); // false (Universal Analytics)
console.log(isValidMeasurementId(" G-ABC123DEF4")); // false (leading space)This check confirms only the format. It cannot tell you whether the ID belongs to your property. Only the Web stream details page, or live data arriving in the Realtime report, confirms that.
Common mistakes at this stage
- Creating a new account for each site. This fragments user management. Create one account per organization and one property per reporting need.
- Leaving the default time zone and currency. The defaults reflect the location of the person who created the property, not your business.
- Using a personal account as the only Administrator. Add a second Administrator.
- Entering a URL with a path. The stream URL identifies the site, not a page.
- Creating a stream and never opening it again. The Measurement ID lives on the Web stream details page. Bookmark it, because you will need it for every installation method in this tutorial.
What you should have now
At the end of this chapter you should have an account (or access to one), a property with the correct time zone and currency, 14-month event data retention, and a web data stream with enhanced measurement on. The stream has a Measurement ID that you can copy. Nothing is collecting data yet. The Google tag, covered in the chapters that follow, is what connects your site to that stream.
Exercise
A colleague creates a GA4 property while their laptop's region is set to the United States. Your business is based in Sydney and reports revenue in Australian dollars. Two weeks later, the revenue figures and daily totals do not match your internal systems. What went wrong, and what should you check first?
Show answer
The property was created with the default time zone and currency taken from the creator's environment, so days are cut at the wrong time and revenue is labeled in the wrong currency. Open Admin > Property settings and check the Reporting time zone and Currency. Correct them. Changing them does not reprocess earlier data, so the first two weeks stay inconsistent and you should note that date when comparing periods.
Exercise
You run www.example.com and shop.example.com as parts of one business, and you want a single view of visitors across both. How many web data streams should you create, and which ID goes into the tag on each site?
Show answer
Create one web data stream. Both subdomains use the same Measurement ID (G-XXXXXXXXXX) in their Google tag, so their events arrive in the same stream and property. You do not need a second stream for a subdomain.
Exercise
A teammate pastes UA-12345-1 into a plugin's Google Analytics field and says it will work with GA4. Is that correct? Where do you find the correct value?
Show answer
No. UA- IDs belong to Universal Analytics, which no longer processes data. GA4 needs a Measurement ID that starts with G-. Find it in Admin > Data collection and modification > Data streams, by opening your web stream and reading the Measurement ID on the Web stream details page.