How to Set Up Google Analytics 4 (GA4)

On October 3, 2022

You might have stumbled on a little notice bar at the top of your Google Analytics account that looks like this:

And you might have clicked on the “Let’s go” button, only to realize that this might take more than five minutes to complete. If that was your assumption, you’re correct. And if you’d like some detailed directions to help along the way, we’ve got those for you here. So, if you want to migrate your old universal analytics account, here’s how to do it:

1. Is this a migration or a new Google Analytics account?

Determine if you are migrating an existing Universal Analytics (UA) account

If you already have a Google Analytics account, then it’s likely you already have a Universal Analytics account. There are a couple of ways to see if you’re using UA or GA4. As mentioned above, the easiest way is to check your admin panel. If you have three columns, it’s UA and if you have two columns, it’s GA4. The second way is to check your Google Analytics account number. If it starts with UA, then you’re using a Universal Analytics account. Since UA will be depreciated in 2023, you must migrate all of your information to retain your data. If you set up an account without migrating the historical data you already have, then it will be lost once the depreciation takes effect.

If you’re currently using UA, upgrading is easy if you’re already using the gtag.js version of the analytics tracking code; Google has created a wizard that will walk you through step-by-step how to start using GA4. If you have never used analytics before, Google also makes the process intuitive and quick to set up.

2. How to set up GA4 step-by-step

How to initiate the migration from UA to GA4

If you are creating a new Google Analytics account, please skip to the next section.

  1. Log into your Google Analytics account and click the “Admin” gear to go to the admin console.
  2. Under Property, click “GA4 Setup Assistant” and ensure you have selected the right account under the account column.
  3. Click “Get Started”.
  4. A pop-up will appear and you will need to click “Create property”. This pop-up will also alert you if you need to install new tags on your site to use GA4.
  5. On the next screen, you will be able to see the connected property message with the property ID. Click on “See your GA4 property”.
  6. On the Setup Assistant screen, click the arrow (>) to the right of Tag installation to go to the Data Streams screen.
  7. Once on the Data Streams screen, click the arrow (>) under Data Streams to go to the Web Stream Details page
  8. On the Web Stream Details page, you can find your Measurement ID for the property. If the Measurement ID is there, the property has been successfully migrated. Make note of this Measurement ID for later.

How to Create a New Google Analytics Account and GA4 Property

By default, new Google Analytics accounts use GA4. If you have migrated your property, this step is already complete.

  1. Log into your Google account and go to https://analytics.google.com/analytics/.
  2. Click on “Start Measuring”.
  3. Under Account Details, add your account or business name. Click “Next”.
  4. Under Property Setup, add your property name, reporting time zone, and currency. Click “Next”.
    • You can create a UA property along with the GA4 property in the advanced options, but this is not recommended since it will be depreciated as of July 2023.
  5. Provide information about your business to help Google provide you with the most relevant data. Click “Create”.
  6. Agree to the Google Analytics TOS and you will then be directed to the Web Stream Details screen.
  7. Your Measurement ID will be in the top right corner. If the Measurement ID is there, you have successfully made a GA4 property. Make note of this Measurement ID for later.

3. How to add your GA4 tracking code to your website

There are two main ways to add the GA4 tracking code to your website: by using Google Tag Manager, and by not using Google Tag Manager. Of the options available, utilizing Google Tag Manager is the most straightforward way to go and the way we recommend.

Google Tag Manager makes it easier to track conversions & other website events. If you need to track your data with scrutiny, you should certainly use Google Tag Manager. It is also much easier than having to manually add or edit code every time you’d like to collect user activities. Google tends to ensure its products are able to connect with one another seamlessly, and this is true for GA4 and Google Tag Manager.

To ensure you get accurate data, install the tracking code on every page of your site. If you built your webpage with Drupal, Duda, MinsterInsights, TYPO3, or WIX, you can select an option and connect your GA4 through Google’s expedited installation process. If you built your site using anything else, you will need to install the Google tag manually.

The options to add the tracking code without Google Tag Manager

  1. Connect the GA4 Measurement ID to the existing UA property in Universal Analytics
  2. Add a new ‘Config’ directive into the existing code on the website
  3. Copy and paste the GA4 tracking code script into the <head> section of the website coding

How to add the tracking code using Google Tag Manager

There are two GA4 tags one can use in the Google Tag Manager. These are “Google Analytics: GA4 Configuration” and “Google Analytics: GA4 Event.”

  1. Log into your Google account and go to tagmanager.google.com
  2. Under the New Tag heading, click “Add a new tag”.
  3. Click “Tag Configuration”.
  4. Under Choose Tag Type, select “Google Analytics: GA4 Configuration”
  5. Enter the Measurement ID you received earlier after creating or migrating your property to GA4
  6. Click the Triggering option and select “All Pages” from the Choose a Trigger window.
  7. Rename the tag to something like “GA4 Configuration” and click “Save” to save the tag.

You can test your new tag after saving by clicking the “Preview” button. Enter your URL in the prompt box and click “Start”. Under the Tags Fired heading, your configuration tag should be listed. Then, go back to the Google Tag Manager tab and click on “Submit.” You can edit the version name and add details if you’d like, and then click “Publish” to save them.

Adding tags to Shopify

If you’re using Shopify, the GA4 installation process will change depending on whether you’re using Shopify or Shopify Plus. With Shopify Plus, you can install GA4 tracking on every page of your store. With a regular Shopify plan, you’re limited to being able to track a few important pages.

To configure tags on a Shopify site, you have additional steps to take after establishing your GA4 account.

  • Log into your Shopify site
  • Navigate to Sales Channels > Online Store > Actions > Edit Code > Layout > theme.liquid
  • Copy & paste the following code. Be sure to change the “id=G-XXXXXX” to your Measurement ID.

The code:

<!-- Google tag (gtag.js) -->

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXX"></script>

<script>

window.dataLayer = window.dataLayer || [];

function gtag(){dataLayerPYS.push(arguments);}

gtag('js', new Date());

gtag('config', 'G-XXXXXXX');

</script>
  • Next, go to Settings > Checkout > Order Status Page > Additional Scripts and add the following code, once again changing the “G-XXXXXX” to your Measurement ID.

The code:

<!-- Google tag (gtag.js) for GA4 tracking------>

<script async src="https://www.googletagmanager.com/gtag/js?id=G-XXXXXXXXXX">

</script>

<script>

window.dataLayer = window.dataLayer || [];

function gtag(){dataLayerPYS.push(arguments);}

gtag('js', new Date());

gtag('config', 'G-XXXXXXXXX');

{% if first_time_accessed %}

gtag('event', 'purchase', {

"transaction_id": "{{order.order_number}}",

"value": {{total_price | times: 0.01}},

"currency": {{ order_currency }},

"tax": {{tax_price | times: 0.01}},

"shipping": {{shipping_price | times: 0.01}},

"items": [

{% for line_item in line_items %}{

"id": "{{line_item.product_id}}",

"name": "{{line_item.title}}",

"quantity": {{line_item.quantity}},

"price": {{line_item.line_price | times: 0.01}}

},{% endfor %}

]

});

{% endif %}

</script>
  • Go to your Google Analytics account and navigate to List Unwanted Referrals > Configuration
  • Select “Ignore referrals that match ANY of the following:”
  • Select “Referral domain contains”
  • Add “myshopify.com”

This is so that customers who view their confirmation page won’t be counted among your analytics as self-referrals.

It may take up to 48 hours for Google to confirm your tracking code is working. You can test it by visiting tagassistant.google.com and ensuring it’s working correctly.

4. Getting the most out of GA4

GA4 has many useful features implemented that can help you grow your brand recognition. Here are three of the best features for your website.

Data Retention

The default amount of time that GA4 retains user data is 2 months. For many brands, their user journey is much longer. GA4 gives you the option to extend data retention to up to 14 months. We recommend extending it to the full 14 months in order to collect the best data to paint a picture of your user journey. You’d be surprised how long it takes some people to convert and it’s very helpful to see the full flow. It is important to note, however, that Google will automatically delete data regarding visitor age, gender, and interest after 2 months, regardless of your settings.

How to set up data retention:

  1. Sign into Google Analytics
  2. Click Admin and go to the property
  3. In the Property column, click “Data Settings > Data Retention”
  4. Under “Event data retention” select the retention period you want.
  5. You can toggle “Reset user data on new activity” on or off. This option refreshes the data of users that visit often. For example, if someone visits once a month, then their data will never reach the 14-month limit. We suggest turning the option on to keep the data fresh.
  6. Click “Save”.

IP Filters

If you want your data to realistically reflect your actual users, you need to filter out website visitors that aren’t leads or customers. This includes site traffic from people such as employees and any vendors like an agency that work on your website, but aren’t actual users. Implementing an IP filter can help you keep your data from being accidentally influenced by internal traffic.

How to set up IP filters

  1. First, you must identify internal traffic in your web data stream so that you can create a filter to exclude it. This typically means knowing specific IP addresses or a block of IPs that are from internal site users.
  2. In the Admin panel, click “Data Streams” in the Property column
  3. Click “Web” and then click a web data stream.
  4. In the details, click “Configure tag settings” located near the bottom of the screen
  5. Click “Define internal traffic,” then click “Create” and name your filter.
    • Per Google:traffic_type is the only event parameter for which you can define a value. internal is the default value, but you can enter a new value (e.g., emea_headquarters) to represent a location for which internal traffic originates.”
  6. Under “IP Address > Match type”, choose one of the operators, such as “IP address equals” for specific IP addresses.
  7. Enter an address or range to identify local site traffic to filter. IPv4 or IPv6 addresses can be added. A block of IPs need to be expressed in CIDR notation as the IP field doesn’t support the use of regex.
  8. Click “Create”.

Connect To Google Ads

If you run ads of any kind on Google, you’ll want to know how well they’re working. It’s very important to link the ads data to your GA4 property so you can monitor their performance & see the full customer cycle. Before beginning, be sure you have the same Google account for Google Ads and GA4. When you link your Google Ads and GA4 accounts, the data will automatically flow into your GA4 reports and makes the data from GA4 available to use in Google Ads.

How to set up Google Ads:

  1. Go to Analytics and click “Admin”
  2. Select the property you want to link
  3. Under “Product Links” click “Google Ads Links”.
  4. Click “Link.”
  5. Click “Choose Google Ads accounts” and then select the account you want to link to GA4.
  6. Click “Confirm”.
  7. Click “Next.”
  8. The option to enable personalized advertising is on by default, but you can turn it off if you wish.
  9. Expand the “Enable Auto-Tagging” option to enable auto-tagging or leave your settings as they are. If you enable it, auto-tagging will be enabled on all Google Ads accounts directly linked to your account. We suggest enabling auto-tagging.
  10. Click “Next” and then “Submit”.

 

Frustrated by Google Analytics

Lisa Stone
Graziani Multimedia's resident wordsmith. Her relentless dedication to research, mad coffee mastery, and word-slinging skills mean that all the content that she creates is enjoyable, engaging, and effective.

Related Posts

Get our newsletter

We'll keep you posted on the latest news in marketing and and triple bottom line business. Great content, no SPAM. We're cool like that.