Setting Up & Collecting Data

The Beginner's Guide to Google Analytics — Chapter 1

Get started with GA4

To collect, track, and measure traffic and engagement metrics across websites and apps with Google Analytics you have to place a Google tag on your site, either by installing it in the CMS or adding it directly to the code of your site. Before you can place the tag, you have to set up a Google Analytics 4 (GA4) property for your website or app so you can locate and integrate the tag.

This guide will cover setting up and configuring your GA4 property and locating your Google tag so you can integrate it with your website CMS to start collecting Google Analytics data. Placing this tag looks different depending on what CMS you’re using. For the sake of this guide, we’re going to focus on four of the major CMS players: WordPress, Shopify, Wix and Squarespace.

GA4 Setup Checklist:

  • Set up a GA4 property.

  • Create data streams for websites or apps.

  • Configure Enhanced Measurements.

  • Switch on Google signals (be aware that it may impact privacy compliance (GDPR) depending on where you’re located, and it may also lead to thresholding.)

  • Set up or import conversions.

  • Configure custom events (if needed.)

  • Define your audiences.

  • Import Google Ads links.

  • Migrate users with the Google Sheets add-on.

  • Configure Google tag settings.

  • Adjust user and event data retention from 2 to 14 months (if desired.)

  • Integrate your Google tag into your website CMS or directly in the code of your site, depending on your setup.

Please note: Universal Analytics and Universal Analytics 360 properties will stop processing new hits from July 1, 2023 and July 1, 2024, respectively.

Get started with Google Analytics 4 (GA4)

If you have been persistently using your Universal Analytics (UA) property right up to the deadline 1st July, you’ll be familiar with the rather robust popup informing you that your GA4 property is not connected. Well, you may be pleased to know that the decision has been taken out of your hands as a shiny new Google Analytics 4 property will have been automatically created for you. Additionally, any configurations not marked as "complete" in the interface will be copied over to the new GA4 property, unless you opt out.

Create a GA4 property

There are 4 stages to setting up your GA4 property, all you need is a functioning website and your sense of adventure!

screenshot showing 4 stages to setting up a GA4 property

To create a new GA4 property click: Admin > Create Property, and enter your property name, timezone, business details and business objectives. For business objectives, if you’re not sure, Dana DiTomaso recommends selecting Get baseline reports here. You can always adjust this later on. To create a new data stream for your website, select Web and enter your domain as it is displayed in the browser, for example, moz.com. If your site redirects to www, then include the www.

Don’t click Create Stream just yet! Before you finalize your new data stream, click the gear icon on the right of the Enhanced measurement panel. It is worthwhile familiarizing yourself with all the options available in the section. In many cases, these can be refined and adjusted later on.

GA4 data stream screenshot
GA4 enhance measurement screenshot

Consider switching off Form Interactions if your website has Google Pixel set up it may cause a considerable number of extra form submits.

Form interactions ga4

If you’re unsure, you can leave Form Interactions switched on and configure these settings later by navigating to Admin > Data streams > select the data stream > clicking on the gear icon under Enhanced measurement to configure these settings.

Click Create Stream. You have now set up your GA4 property, well done!

Start measuring data

As soon as you create your stream, you’ll be presented with two main integration options.

If you’re already using gtags.js or Google Tag Manager, you can use those tags for GA4 without having to reinstall tags on your site. From the setup assistant, select the tag you want to reuse. If you’re unsure or would like to start fresh with new tags, follow the instructions to install your Google tag. Google Analytics scans your site and identifies the best option based on your website setup, and provides steps for integration. In this case, it has detected the MonsterInsights WordPress plugin, which is explained below in more detail. We’ll cover adding your tag to WordPress, Shopify, Wix and Squarespace below.

Pro tip: Place the Measurement ID, not the Stream ID, on your site or CMS to collect data.
ga4 installation
ga4 web stream details screenshot

Migrate settings with the Setup Assistant

Once you create a new GA4 property and Data Stream, there are seven steps Google Analytics will guide you through to fully set up your GA4 property. As you work through them you can mark each item as completed in the interface. Some of these options will enable you to migrate configurations over from UA.

Conversion migration

Under Property settings, you can choose the setup assistant or manual options to migrate or set up your goals in GA4. During conversion migration, pay attention to and note the GA4 default syntax. GA automatically converts your goals to lowercase and underscore syntax upon migration. Newsletter sign up becomes newsletter_signup. Mark as complete in the setup assistant when you’re done.

Import Google Ads links

Under Google Ads in the setup assistant, you can check how many Google ads accounts your UA account was linked to. By default, they will all be selected. You can adjust these and personalize ad settings. You can deselect any Google Ads links you do not wish to import. Mark as complete in the setup assistant when you’re done.

Please note: You may need to configure your setting in Google Ads to activate conversions and audiences.

User migration

The user migration tool is supported by a Google Sheet add-on. Before you get started, you have to install a Google Sheets add-on. Google has a documented walkthrough of this process that is worth following to ensure you migrate users correctly.

When you’re done, mark each item as complete so you can keep track of your progress! Hover over each step to compare your UA setup with your GA4 setup.

ga4 manage data streams screenshot

How to find your Google tag

First let’s get on the same page when it comes to naming conventions. Tracking ID refers to Universal Analytics and looks like this: UA-XXXXXXXXX-X. The replacement for this in GA4 is a Measurement ID, which looks like this: G-XXXXXXXXXX and is a mixture of letters and numbers. A Google tag (gtag.js) is a single tag you can add to your website in order to use a variety of Google products and services. Instead of managing multiple tags for different Google product accounts, you can use the Google tag across your entire website and connect the tag to multiple destinations.

Find your Google tag in GA4

Locate your GA4 Google tag or Measurement ID (which usually starts with "G-"), by heading to Admin > Property > Data stream > Click on your stream > Configure tag settings. From here you’ll see your Google tag and the destination. You'll also see all the Google products that share configuration and receive data from that Google tag.

Pro tip: Don’t confuse your Measurement ID with your Stream ID. You want to place the code starting with "G-" or "AW-" on your site, not the Stream ID, which is a string of numbers only.
GA4 how to access data streams screenshot

Click on Installation Instructions and scroll down to follow the pre-populated setup instructions, or choose another to view instructions for Shopify, Wix, Squarespace, and other CMS platforms.

GA4 installation instructions
ga4 webstream details screenshot

If you don't see a Data streams option in the Property column, it’s likely you are looking at a UA property instead of a GA4 property.

How to configure your Google tag settings

Head to the Admin section of your Google Analytics account. At the top of the Property column, select your property and click on the Data stream. In the Google tag section at the bottom of the Web stream details page, click Configure tag settings. From here you can select define internal traffic to filter out your office IP address.

Adjust data retention settings

You can set the amount of time data is retained in Google Analytics. GA4 has two data retention options: two months, which is the default, and 14 months which is configurable. This indicates the timeframe between interactions before user-level and event-level data stored by Google Analytics is automatically deleted.

To configure your data retention settings in GA4, click Admin > Data Settings > Data Retention.

Data limits vary between platforms and account types.

Data limits Data retention options
Universal Analytics (UA) No limit (until UA stops collecting data on 1 July 2023 except for 360 accounts) 14 months, 26 months (default,) 38 months, 50 months, “do not automatically expire”
Google Analytics 4 (GA4) up to 14 months 2 months (default,)14 months
GA4 properties using Analytics 360 up to 50 months 2 months (default,) 14 months, 26 months, 38 months, 50 months

Reset user retention data

During setup you’ll have the option to Reset user data on new activity, typically you’ll want this to be toggled on. “Reset” in this instance indicates continuing to retain data based on new activity.

In GA4 the retention period for user data is set to 2-14 months from the point of interaction. In this example, let's consider your Google Analytics is set to retain data for a 14-month retention period, which is the limit for GA4 properties (non-Analytics 360 properties.)

When a user interacts with the system (interaction 1), their data is stored for 14 months.

If after 10 months, the user returns to the site and engages again (interaction 2.) Interaction 1 will be stored for an additional 14 months, rather than expiring in 4 months' time.

It might help to think of it as a countdown mechanism where each user interaction resets the clock. If the user fails to interact before the countdown reaches zero, all their user data will be deleted. However, as long as they continue to interact, the clock will be continuously reset.

Install your Google Analytics tag

You can toggle between Install with a website builder or CMS or Install manually to access the instructions relevant to your website setup.

ga4 install google tag screenshot

WordPress GA4 integration

To install your Google Analytics tag on your WordPress site, we highly suggest using the MonsterInsights plugin. The free version of this plugin will get you everything you need to get started.

Once you’ve installed and activated the plugin, open it and select Launch the Wizard. This will prompt you to log in to your Google Account, select which account you want to connect and that’s it! Easy peasy.

If you’re adding a GA4 ID to an existing plugin, head to Plugins from the left panel in Wordpress admin and click Settings to relaunch the setup wizard.

Screenshot of Wordpress Plugins tab

MonsterInsight supports dual tracking so you can track your GA4 profile and UA (also referred to as GAv3.)

ga4 google authentication wordpress screenshot

Shopify GA4 integration

You will need the long bit of code (Global Site Tag) for this installation.

To get started, log in to your Shopify account and open your “Online Store” sales channel. A few options will become available. You will want to select Preferences.

On the new screen, scroll down to the section that says Google Analytics and click Manage pixel here.

If the Shopify app isn’t installed, review the list of permissions required, then press “Add sales channel” at the bottom to continue.

If the app isn’t connected to Google, click Connect, then choose the Google account that owns your Analytics property.

Choose your Google tag ID from the dropdown list, and click Connect your Google Analytics 4 property. Make sure that the Measurement ID matches the one you made a note of in Google Analytics.

Screenshot of the Sales Channels "Preferences" tab.

And voila, you did it!

Should you have any further questions about this setup, read Shopify’s Google Analytics setup article.

Wix GA4 integration

Getting started with Google Analytics on Wix is rather simple. When you log in to your Wix account and select your store, you will be presented with a screen that has a menu to the left. From this menu, select Marketing & SEO, then select Marketing Integrations.

Screenshot of the Marketing Integrations tab.

Select Connect under the Google Analytics option, then on the next screen, select Connect Google Analytics. Paste your Google tag ID in the window and click Save.

Finito! That’s that.

Screenshot of the "Add Your Google Analytics Code" entry screen Wix

Squarespace GA4 integration

After logging into your Squarespace account, select Settings > Advanced > External API Keys and paste your tag ID. Once they’re in there, be sure to save your changes! Then, you’re good to go.

Alternatively you can add the code manually. Select Install Manually from your Google Analytics installation instructions. In Squarespace head to Settings > Advanced > Code Injection. In the Header section, drop in your Global Site Tags. Once they’re there, be sure to save your changes. Then, you’re good to go.

Screenshot of the Code Injection entry screen.

Universal Analytics (UA)

Creating a Universal Analytics (UA) property

The option to create a UA property is currently hidden under Show advanced options when setting up a GA4 property. Open the advanced options and turn on the option to create a Universal Analytics property. Then you will be able to create both a GA4 and UA account or only a GA4.

With UA set to stop gathering data July 1 2023 (for non-360 Analytics accounts) you will want to skip the UA setup.

Navigate between UA and GA4

To move between your UA and GA4 properties click on the dropdown menu on the top left. Under Properties & Apps you can select your available properties. Note that the UA properties will display the UA tracking ID identifiable by the preceding UA-XXXXXXXXX-X

Please note: Universal Analytics and Universal Analytics 360 properties will stop processing new hits from July 1, 2023 and July 1, 2024, respectively. Non-360 Analytics accounts users of this guide will want to skip the UA setup.
GA4 UA navigation screenshot

To configure your US or GA4 property head to Admin > Property, click on the property dropdown menu to access your other properties available within your account. Your Universal Analytics property will display your UA-XXXXXXXXX-X Tracking ID. Your GA4 property will display a string of numbers, not to be confused with your Measurement ID. Click on the property name to access Property Settings, Data Streams, Events and more.

How to find your Tracking ID (UA)

If you still need to locate your Universal Analytics tracking ID you can navigate to that property to retrieve it.

Universal Analytics Property > Admin > Tracking Info >Tracking ID and Global Site Tag

Okay, you did it! Now you have all of the codes you could possibly need.

Setting goals (UA)

After getting your tags placed, Google Analytics will start collecting data from your site and users. To get the most out of this information, you’ll want to have goals set up.

Goals are specific events, determined by you, that Google Analytics listens for and reports.

Why track goals in UA?

Tracking goals in Google Analytics helps you track the effectiveness of both your site and your marketing efforts. By having goals defined, you’ll be able to segment your data by people who have converted, and find patterns within your audience.

Types of goals in Universal Analytics

There are five main goal types in Google Analytics. Each goal has a unique trigger for tracking completion:

  1. Destination goals are triggered when a user visits a certain page. The most common use for a destination goal is to track when people reach a “thank you” page.

  2. Duration goals are used mostly for tracking engagement. These goals are triggered once a user has been on the site for a certain amount of time.

  3. Pages/Session goals are much like duration goals, as they are often used to determine engagements. Pages/session goals are triggered once a user visits a certain number of pages during their session.

  4. Event goals are much more sophisticated and require more coding, but they track some of the most important goals. Event goals are triggered by specific events that may happen on a site, such as a click on a specific element, a video view, or even a download. The opportunities are endless.

  5. Smart Goals are set by Google after observing the behaviors of those who convert on your website. These goals are micro goals that indicate whether or not a user may be qualified.

How to set goals in Google Analytics (UA)

When you’re in your Google Analytics property, use the menu on the left to navigate to your Admin settings. In the column furthest to the right (the View column), select “Goals.”

Now select "New Goal" in this menu screen.

On the new screen, select “New Goal.”

This is where you’ll select the type of goal you want to track. We suggest starting with a destination goal and tracking “thank you” page visits, as this is one of the easiest and most qualified goals to track. “Thank you” pages can be used after a form is filled, after a purchase is made, after a document has been downloaded, or anything of the sort.

Now you’re tracking data, you’re tracking key performance indicators (KPIs), and all that’s left is to do is wait!

It will take some time for Google Analytics to generate data for you to look at (12 hours at the very least), but once it does, it’s time for reports.

Updated by Jo Cameron and Zach Edelstein on the 4 August, 2023.

Keep learning

Build Intelligent SEO Reports

Link up Google Analytics 4 with your Moz Pro Campaign for a dynamic duo: track traffic alongside rankings and smoothly slot traffic modules into your personalized reports.