Skip to Content
Main Content

Fred Pike

Managing Partner & CFO

Fred is Google-certified in Google Analytics (GAIQ) and Google AdWords. He is also certified in Conversion Rate Optimization (CRO) through Conversion XL. Fred is passionate about finding the best ways to drive traffic to websites, making sure visitors find what they are looking for, and making sure Google Analytics and Google Tag Manager track everything correctly. 

Helping clients use data to make their website better? Man, that is a great gig!

GA 4 Set Up Tips

The (non-) Definitive Guide

October 30, 2020 | Fred Pike, Managing Partner & CFO

12 Minute Read

Updated: Oct. 30, 2020
Originally Published: Oct. 21, 2020

Google Analytics 4 came out of beta on October 14, 2020.  With its “less-is-more” approach and completely different interface, working with it will come as a shock to those of us who know (and maybe even love) the “old” version of GA. (GA 3? Universal Analytics? Urchin?)

The GA 4 team has been on fire since the official roll-out, with new changes coming out almost daily. It’s hard to keep up!

Like any tool, there are some things you should do to ensure you’re setting GA4 up properly. This very preliminary guide is what I’ve discovered so far. VERY preliminary and extremely non-definitive, but I’ll keep adding to this post as I find more must-have set-up tips.

And just remember – you’re an early adopter!

There's a lot of great information to digest in this piece! You can read the entire article or jump to the following sections:

Hostname Filter | Creating a New GA Property | Site Search Settings | Data Retention | Set Up Warnings | Internal Traffic Filters | Label Your Reports | BigQuery Integration | Keep Your Old GA

Hostname Filter

A hostname filter has been an essential part of a good GA set-up for years. 

(A hostname filter is used to verify that a user is on your website when their visit is recorded. It’s a way to block both bot traffic and traffic from dev or test environments.)

I was reminded of how important the hostname filter is when I was looking at my GA 4 page views (in “Engagement / Pages and screens”) and saw 232 “Page Not Found” views. 

Yikes – panic!!

Could that really be right? I went to my Universal Analytics property (i.e. the “old” version of GA), where I only saw six instances of a “404” page (i.e. the page was not found):

Six is not great, but it’s a heck of a lot better than 232.

What’s going on? Why is GA 4 reporting so many more “page not found” errors?

It took some digging, but I finally figured out – the hostname filter!

I know that GA 4 collects the hostname information, but it’s not a dimension that you can find easily (at least as of the time I’m writing this – but things change quickly with GA4).

Luckily the GA 4 search bar saved the day. When I started typing in “hostname”, I saw a suggested insight pop up – the “Top Hostname by Users” report:


Clicking on that insight gave me what I was looking for:

  • the valid hostname (labeled 1 in the image –
  • invalid hostnames (labeled 2 – they’re all different test environments)

So far, there’s no way to create a valid hostname filter in GA 4. But you can create one in Google Tag Manager (GTM). In my case, I created a variable in GTM – a super-simple Lookup Table which checks the hostname (1). If it’s (2), then I output the GA4 Measurement ID (3). 

This Lookup Table variable is then used in my GA 4 configuration tag for the measurement ID:

gtag Set-Up

GA 4 can be configured either via gtag (the Global snippet) or GTM. I configure everything through GTM (and recommend it in almost every case). 

If you do use gtag, I don’t think you can set up a hostname filter, the way I just demonstrated in GTM. But if somebody knows differently, please let me know and I’ll add the info to this guide.

Do It!

In Universal Analytics, the hostname filter is set up in the “Filters” section in Admin and applied to a view. GA 4 doesn’t have the same construct, but with a fairly simple tweak to GTM, you can build your own hostname filter. Well worth doing. Just make sure to test your hostname filter!

When You Create a New GA Property, set up both GA4 AND Universal Analytics (the "old" GA)

If you’re creating a new GA property (which you do in the GA / Admin section), it may seem like you can only create a GA 4 property (1).

But no! Click on “Show advanced options” (2).

In the advanced options, you’ll see you can toggle the switch for “Create a Universal Analytics property” (1). I recommend doing this.

I would create both a GA 4 and UA property (2).

(As another tip, go ahead and set up the UA property using my 10 GA Admin pro tips.)

I think you're well served to have both GA4 and UA running at the same time.  You can compare what you're getting between the two versions, to make sure your GA4 set up is done correctly.  Also, many of the third-party tools which can read and integrate GA information rely on using "views" (old GA), not "streams" (new GA).  Examples include Moz and Screaming Frog, but there are many more.  The tool vendors will catch up - probably quickly - but in the meantime you don't want to lose that integration.

Check Your Site-Search Settings

GA 4 will track several user interactions by default: page views, outbound links, downloaded files, scroll, video plays, and site-search terms. Those site-search terms are a great insight into your website visitors – they’re typing, into your website’s search box, exactly what they’re looking for.  You definitely want to capture those.

Different websites use different conventions to indicate a search term. Some use the word “query” to show that; other common examples are “s” or “keyword”.

To see what your website uses, go to the search bar and type in something, then look at the URL. You’ll see something like this:

If the word or letter your website uses to designate a search term is “q,” “s,” “search,” “query,” or “keyword,” you’re in luck. Those are all covered by the default GA4 setting.

If you have something different, like we do on the Northwoods website, you have to make an adjustment.  The phrase that designates a search term on our website is “Search_Keywords”.

If you don’t have one of the default search terms, let’s walk through how to make sure your search terms are being tracked.

To do these steps, you will need “Edit” rights in your GA4 account.

1. Go into the GA 4 Admin screen and click on the “Data Streams” option.

2. Click on the right arrow on your Web property.

3. In the “Enhanced measurement” window that opens up, click on “Show advanced settings” under Site search.

4. You can see the default search term parameters that already exist (in box 1). In box 2, type in the term or letter that your website uses to designate a search term. In Northwoods’ case, that’s “Search_Keywords." Then “SAVE” your work.

5. That's it! From this point forward, any search terms entered onto the site by your users will be captured.

Data Retention

While you’re in the GA 4 admin, go to “Data Retention” under the Data Settings Option.

By default (I think), the data retention is set to "2 months."

You probably want to set that to the other option, 14 months.

Also: Note the toggle for “Reset user data on new activity." By default, that’s on, which makes sense. It just means that regardless of which limit you choose (2 months or 14 months), each time a user comes to your website, the clock resets on when their data will be deleted.

Make sure to "Save" your changes!

Set Up Warnings

Here’s the best tip so far – not only because some day it’ll warn you about something catastrophic happening on your website, but because it’s kind-of hidden.

GA4 relies on machine-learning (ML) insights to supplement the stripped-down UI. Got something weird happening on your site? Ideally, an insight will report on that anomaly. But there are also some custom insights you'll want to enable.

The insights are available in a couple of places, including on the home page (1). Go ahead and click on “View all insights” (2).

In the next page (home / insights), click on "Create."

You’ll see a list of four “custom insights," all four of which could be important (depending on your website). But one of them will be important for all websites – the “Anomaly in daily views” (1). Here’s where you can set up a notification, which could be e-mailed to you, letting you know about anomalies in page views – e.g. you had zero page views today. I bet something’s broken!

Go ahead and click on the “Review and create” link (2).

Now you have a choice of specifying exactly what you want to be notified about. I can’t tell you how happy this makes me. It’s a wonderful practice to set up notifications when things are going wrong on your website. Most people don’t do this (it’s done through custom alerts in the older version of GA), but GA 4 makes it very easy to set up. So easy, in fact, that I would accept the default of “Has anomaly." I think GA 4’s ML will be able to figure this out just fine. I would for sure create the “daily views” custom insight; you can decide if it makes sense for your website to also enable the other custom insights.

Even better – you can create your own custom insights from scratch.

As small as these custom insights may seem, this is one of my favorite little features of GA 4. I love proactively setting up alerts and it’s so frickin’ easy to do here. Nicely done, GA 4 team!

Specify the e-mails of the people you want notified:

When you’re all done, go ahead and press the “Create” button. And when, at some point in the future, that anomaly fires and you’re able to go in and resurrect your website tracking because something stupid broke – please send me an e-mail and thank me!

Filters for Internal Traffic

I know what you’re doing – you’re looking in the admin area to set up your filtered view, raw view, and test view.  Right? Right?

(How do I know? Because only well-trained GA nerds would be reading this far into this blog post.)

Well, stop looking – there are no views and there’s no way to set up those views. At least as of right now. (A Google webinar I  attended recently said they would be coming at some point - so don't lose hope.)

There are filters, though, which you can use for either internal traffic or dev/test environments. Let’s walk through setting up an “internal traffic” filter.

Start in the admin section of GA (1) and click on the “Data Streams” (2).

Click on the web stream for which you’ll create the filters:

Go to "Tagging Settings":

Click on "Define Internal Traffic":

Click on "Create":

You’ll now have your first opportunity to start adding an IP address (or multiple). You’ll put in the name of the configuration (1), the match type (2), and the IP address (3).

There are multiple match types, but no RegEx option (!!):

Here’s a sample configuration filled out for my home IP address:

IMPORTANT: Even though GA 4 uses “Anonymize IP” (dropping off the last octet in the IP address), for the “IP Address equals” option, you have to use the full IP address.

Save your changes. You’ll now see that configuration show up in your list of “internal traffic” rules.

Next, go back to “GA Admin / Data Settings / Data Filters”.

Make sure the Data Filter for Internal Traffic is set up. (I think this happens by default; I don’t think you have to do anything. But check to be sure.)

Now What?

Now you wait patiently. You won’t see any results of this filter until the next day.

The next day, you can use the dimension “Test data filter name” to look for traffic that is labeled “internal” or “not set” (i.e. external). Here is an example of the filter:

And here's where you can use it in a report in the UI:

You could also use it in the Analysis Hub, as a dimension for any of the reports you build.  As a simple example:

  1. Specify a date range which includes the internal-traffic being set up.
  2. If the dimension is not there, click the + button and add the…
  3. “Test data filter name” dimension. 
  4. Choose an Exploration report.
  5. Drag or choose the “Test data filter name” to the “Rows” section.
  6. You’ll now see the internal traffic and the not-set traffic.

Changes Are Coming...

I don't actually know that - but the IP filtering is so limited in GA4 compared to UA that I have to believe it'll be updated soon.  The lack of RegEx in the match type is perhaps the biggest limitation right now - hard to see how to create an "internal traffic" channel for a large multi-site organization without having RegEx.  Plus, of course, not having views available.  That is bound to change.

Make the Internal Traffic Filter Live?

You may have noticed, back a few screens, that the internal traffic filter was in “testing” mode. After you’ve tested that you set it up correctly, you can choose to make it live. From that point forward, you will permanently exclude internal traffic from your GA 4 reports.

Which I don’t recommend.

I think it’s great to set up the internal traffic filter – but leave it in test mode. You can always do your analysis and exclude that segment, either in the GA4 interface or in Big Query. But since there is only one “view” in GA 4, I’m reluctant to start excluding traffic that you’ll never get back. Mess up that IP filter and that data is gone forever – there’s no raw view on which to fall back.

Label Your Analysis Hubs Reports

Here’s a simple idea – make sure that every report you create in the Analysis Hub has a name.

Otherwise, once you start creating reports, you’ll be hard pressed to remember what’s in the myriad “Untitled Analysis” reports.

BigQuery Integration

Honestly one of the most impressive features of GA 4 is its built-in integration with BigQuery (part of the Google Cloud Platform). You can set up automatic export of GA 4 data directly into BigQuery and specify whether you want to do that once per day, or virtually instantaneous. The “once per day” option is, essentially, going to be free (depending on how much data you have). For the “instantaneous” exports, you’ll have to set up a billing account.

I won’t try to recreate the excellent blog post that Charles Farina wrote on setting up BQ – go ahead and follow his steps and in about a day you’ll start getting data like this, which clearly shows the event / parameters structure of GA 4:

Why should you care? Ultimately, I suspect much of the GA 4 analysis is going to be done based on the data that’s stored in Big Query. Once the data is in BigQuery, you have a whole new world of processing and analysis open to you – much more than you’ll have within GA 4 itself.

Leave Your Universal Analytics (the "Old" GA) in Place

The hostname and IP filters are two of many reasons why I think GA 4 should run alongside the older version of GA. 

The GA 4 UI (user interface) is totally different. It will take some time for all the analysts who worked with the older version – myself included - to truly “grok” the newer version. But by comparing the new to the old, you can understand and dig into the differences. 

When you compare GA 4 to Universal Analytics (UA), use the "raw" or unfiltered view in UA (assuming you’ve set that up). The raw view will be the closest to what you’ll see in GA 4, because the filtering capabilities are still so limited in GA 4.

Here are some more thoughts on why I think GA4 shouldn't be your only Analytics.

Looking for more GA 4 tips? Check out our GA 4 Resource Hub!