Google Analytics 4 provides information on the city and state from which users are visiting your website.
Let’s say you run a hyperlocal news website in Santa Monica, Calif., that sells subscriptions. You’ll probably want to focus on readers who live in or near your coverage area. Even if you get visits from other parts of the country/world, they’re not as likely to pay for your news.
Or perhaps you’re an online store that also has a brick-and-mortar in Santa Monica. If sales tend to be higher in person than online, you’re going to want to reach users who are closest to your store.
But before doing a deep analysis, you need to know how many users are visiting your site from Santa Monica, and other relevant nearby areas. Then you can drill down even further to figure out how to draw them to your website and store to make purchases.
Google Analytics 4 Traffic by City, State: Detailed Explanation
Go to Reports > Users > Demographics overview.
By default, the first widget you will see on this dashboard sorts traffic by country. This can be useful if you’re an international publication or have clients all over the world. Otherwise, you’ll want a more detailed look at your readers’ locations.
Click on “View countries,” and you’ll be brought to a Demographic details report page.
Note:Google Analytics 4 provides user location data based on the location of the user’s IP address on their particular device. This does not necessarily show you where people live – GA4 doesn’t provide that data – but rather where they were when they accessed your site.
GA4 Traffic by State
1. Click Add comparison, which will initiate the Build comparison pop-out you see on the right in the screenshot above.
2. Under “Include,” select region, which is the equivalent of “State” in the United States, as well as most other countries.
3. Click the Dimension values dropdown, where you will see a list of all the states (regions) from which your site has received traffic in the specified time range. If there are a lot of options, you may be better off typing the state name and selecting it instead of scrolling through the entire list.
You can select multiple states if you wish.
4. Once you have selected the desired state, click OK, then the Apply button, which will now turn blue, at the bottom right.
You will now see a side-by-site comparison of All Users and California (or whatever state(s) you selected) users, side-by-side.
Again, if you don’t have a lot of international readers or customers, you may not be interested in analyzing traffic from “All Users.” Simply click the X next to the All Users comparison at the top, and you’ll be left with only the users in the states you selected.
GA4 Traffic by City
Now that you have filtered traffic by a single (or few) state(s), you’re ready to drill down by city.
If you’re interested in analyzing traffic from just one particular city, or a small number of cities, you could use the same process as above for states, except you would include “City” in the first dropdown instead of “Region.”
But perhaps you want to see a list of all the cities in a specific region from which users and sessions come to your website. In that case, we’re going to pick up where we left off, filtering traffic only by California users.
Scroll down to the table, and you’ll see that there’s only one row of data for United States users. Click the dropdown where it says “Country” and change to “Region.”
We’ll still only see readers from California, but now it’s more clear instead of saying “United States.”
If you’re only filtering traffic by one region, this step isn’t necessary and you can change the dropdown to “City” instead of “Region.” I’m including this step here in case you want to filter by multiple states, and therefore see which cities correspond to which states.
Click the + symbol next to Region in the dropdown menu you just changed, and you’ll see a similar dropdown. Select “City.” I also like to expand the visible rows to more than 10, which allows you to see a large list of data without having to click through the list 10 at a time.
Here’s what that would look like if you added a second state, as I have now with Arizona, to make it easier to know which city corresponds to which state:
Now you can see just how many users and sessions come to your website from a particular city and state.
Is there another way you would like to analyze your data geographically? Let me know in the comments.
A session ID, identified by the ga_session_id parameter, is generated each time a user comes to your site. If the same user comes to your site, leaves, and comes back to initiate a new session, two different session IDs are generated.
The same user can have multiple session IDs, because each new session generates a new ID, regardless of the user.
The session number, identified by the ga_session_number parameter, counts the different number of sessions generated by each user.
Here’s a simplified example of how the session_start event and its ga_session_id and ga_session_number parameters are structured:
When does the Google Analytics 4 session timer reset?
Google’s default timer ends sessions after 30 minutes of inactivity.
Other times, as is the case in this article, the term “landing page” simply refers to the page on which a user “landed” upon entering your site. That could be your homepage, an article, a product or anywhere else on your particular domain.
Understanding why users enter your site on a particular page – and their behavior thereafter – is important to optimizing your content.
How To Create a Google Analytics 4 Landing Page Report: Summary
In the Google Analytics 4 Explore tab, create a free form report with the following settings:
Segment Comparisons: Landing page
Rows: Page Title
How To Create a Google Analytics 4 Landing Page Report: Detailed Explanation
1. Click the Explore tab on the left sidebar.
2. Choose “Blank” from the template gallery.
3. Click the + symbol next to SEGMENTS.
4. Select the Session segment option.
5. Click the “Add new condition” dropdown and type “landing page.” Select the only option that pops up. (You can also find this by clicking on “Page / screen” and scrolling down to Landing page. It’s the same thing.)
6. Click the + symbol next to DIMENSIONS.
7. Type “page” in the search bar and select the following to import to your variables tab: Page Location; Page path + query string; Page title.
You might not necessarily use all of these in your report, but now that they’re added to your Variables column, you have the option to do so.
8. Now click the + symbol next to METRICS (just below DIMENSIONS) and import the following to your Variables tab: Engaged sessions; Sessions; Active users; New users; Total users.
You can select more, less, or different metrics if you prefer. These are simply ones that I believe to be the most common and useful. As you begin to tweak your base Google Analytics 4 landing pages report, you’ll get a better sense of which metrics (and dimensions) you want to include.
Your dashboard should now look like this (perhaps with a different date range):
9. Double-click the segment you added, or simply click and drag it under SEGMENT COMPARISONS in the Tab Settings column.
10. Next, add one or more of your dimensions to ROWS (I prefer Page title), and add one or more metrics to VALUES (Sessions).
11. Here’s how your completed landing page report should look barring and changes to my recommendations*:
*The only thing not visible in the Tab Settings column of this screenshot is the Session Scoped: Landing Page segment
Your report will autosave as you go, so once you finish, you can access (and edit) it at anytime by going to the main Explore page. Mine is titled “Landing Page Report” in the following screenshot:
Should I use Page Title, Page Location or Page Path + Query String Dimension?
By using Page title instead of Page location or Page path + query string for dimension, we avoid dividing data from traffic that actually went to the same page.
Because of the / after the URL that used to be in some of my pages, GA4 saw them as different pages:
But when I filter by Page title, all traffic to my “Meet Brad” and “Contact” pages, respectively, are consolidated into a single row.
Confusion can still arise, however, if you change your page title format, as I did when changing my website’s CMS:
In the long run, though, I believe Page title is the best option.
page_title: The web page’s title e.g. Your Site Name – Content
screen_resolution: The screen resolution of the user’s monitor. e.g. 1280×768
GA4 Event Parameter Limits
While parameters are very useful, there are some limits you should know about.
How many parameters can I have per event?
In addition to the five default parameters, you can create up to 25 custom parameters per event.
If you hit the 25 parameter limit (unlikely) for a particular event and need to create more, you can delete some to make space.
What is the character limit of a parameter value?
Each parameter value has a 100-character limit, with the exception of page_location, page_referrer, and page_title parameters, which have a 300-character limit.
Google Analytics 4 Event Parameter Examples
To make things simple, let’s think of an example. Imagine you run the Ford* website.
*Company chosen at random
In the top navigation menu of their site, they list various types of vehicles. You could, then, create a “vehicle” event for every time someone visits the product page of a particular vehicle.
By looking at one particular product page – the Ford Escape S – I can think of different Google Analytics 4 event parameters I would want to track.
Here are some of the parameters I would create, along with what the parameter’s value would be:
model: Escape S
If you really want to drill down, you could apply the same strategy to their “Build” page where users can choose a color and different add-ons.
The point of collecting this data would be to better understand which vehicles and features are most popular. And since you have to enter a zip code/your location to access the build page, this data could be broken down geographically if you add a parameter for that, too.
To only have a “vehicle” event that fires every time someone visits the product page of a particular car, truck, etc. wouldn’t shed a lot of light on user behavior. But by creating custom parameters for each particular vehicle, Ford would learn a lot about what potential buyers seek.
How To Find Google Analytics 4 Event Parameters
In your Google Analytics 4 dashboard, click on the reports menu on the left (highlighted with a blue circle below) then click on “Events” under “Engagement.” (There are other ways to see your parameters, but this is probably the most straightforward.)
Then scroll down and click on any of the events. For websites, page_view will probably have the most data, while in apps, screen_view will probably have the most data.
In the GA4 demo dashboard, I clicked the screen_view event. When you get to this page for any event, you should see a widget on the right side that says “EVENTS IN THE LAST 30 MINUTES.” Click the dropdown there, and you will be able to see all parameters associated with the particular event.
Parameters in Reports
If you want to analyze parameter data in more detail, there are two ways to do so.
In Reports Tab
You can do this in any report that has event data, but I’m going to go through one specific example so you can follow along:
1. Go to Events > Life cycle > Engagement > Engagement overview
2. Scroll down to the “Event Count by Event Name” widget
3. Click on any of the events (I clicked “page_view”)
4. Scroll down to the “Events in last 30 minutes” widget and select one of the parameters from the dropdown
You can now see how many times that parameter was triggered within the event you selected (reminder: I selected page_view) in the last 30 minutes.
But that’s not very useful, is it? To only have data within a single event for the last 30 minutes.
Let’s make sure we can see data for a particular parameter in the Explore section.
In Explore Tab
To analyze parameters in the Explore section of Google Analytics 4, you will first need to add a custom definition. Here’s how to do that:
1. Go to Configure > Custom Definitions
2. Click the blue “Create custom definitions” button
3. Name your dimension. (Unlike event and parameter names, I don’t recommend against using spaces and capital letters here.)
4. Give it a brief description that will make sense when you or a colleague reads the the tool tip in Explore later on.
5. Leave the Scope type as Event and choose your parameter from the dropdown. Then click “Save.”
It may take 24-48 hours, but you should soon see your new custom dimension in Explore under “Custom.”
You can now apply that parameter to eligible reports in Explore.
GA4 Parameters Summary
Google Analytics 4 events are the “big-bucket” actions that users take on your website, while parameters are the final details that provide more context to those actions.
The good news is, you can add practically any parameter you can think of to your events. You can do this either directly in the GA4 dashboard, or in Google Tag Manager.
Events are the foundation of Google Analytics 4 data. They are triggered by user interactions on your website and/or app. There are four types of events in Google Analytics 4: automatically collected events, enhanced measurement events, recommended events and custom events.
Each Google Analytics 4 event includes five parameters by default:
“Parameters are additional pieces of metadata that add context to event data.” In addition to the five default parameters listed above, each event can contain up to 25 additional custom parameters. This is different from Universal Analytics (GA3), where events only contained four parameters, none of which was customizable.
According to Google: “The value assigned to event parameters must be 100 characters or fewer; however, the page_location, page_referrer and page_title parameters must be 300 characters or fewer.”
In some cases, the five default parameters will be sufficient for your event. If not, 25 custom parameters is a very high number and it’s unlikely you’ll reach this limit with any given event before you include all your desired parameters.
Some automatically collected events and enhanced measurement events will include additional default parameters that do not count against your count of 25 custom parameters. Recommended events included recommended parameters, but since Google doesn’t create these events for you by default, you’ll have to add them yourself when creating recommended events.
What are the differences between events in UA and GA4?
In Universal Analytics, events are their own “hit type” and have up to four built-in parameters: Category, Action, Label, Value.
In GA4, however, every “hit” is an event and the platform doesn’t distinguish between hit types.
As mentioned in the previous section, Google Analytics 4 events come with five default parameters, plus up to 25 more custom ones per event. Outside of Category, Action, Label and Value, UA does not allow for custom parameter creation.
Google Analytics 4 Event Types
There is an order in which you should utilize Google Analytics 4 events, beginning with automatically created ones all the way up to custom. Here is a pyramid to help you visualize.
What this means is that, whenever you want to track something as an event, you should start at the bottom of the pyramid and see if it’s available. (This will make more sense after you read the descriptions below of each event type.) If not, move up to the next level of the pyramid.
In other words, you should only use recommended events if you can’t find the event you want to use in automatically collected nor enhanced measurement events. And if you can’t find what you’re looking for in any of those three bottom levels of the pyramid, then and only then should you create a custom event.
Automatically Collected Events
Automatically collected events and they’re determined by Google, and their function is self-evident by their names. Below is a list of the ACEs for web. (Click the link above to see ACEs for apps.)
Enhanced Measurement Events
Enhanced measurement events are all included in automatically-collected events, so why are they listed in a separate category? Because while all the rest of the automatically collected events will feed into Google Analytics 4 no matter what, you can “opt out” of collecting enhanced measurement events.
These are the enhanced measurement events in Google Analytics 4:
I recommend leaving EMEs turned on, but if for some reason you want to opt out of any in particular – or all of them – you can do so upon setup or at anytime once your dashboard is live.
To turn off enhanced measurement events in Google Analytics 4, go to Admin > Data Streams > select the data stream for which you want to turn off enhanced measurement events. You will then see a popup that looks more or less like this:
You can turn off all enhanced measurement events by clicking the on/off toggle I circled in the above screenshot.
Alternatively, you can click the settings cog symbol, which will open a window like the one here, where you can individually choose which EMEs to leave on and which to turn off.
Recommended events are not out-of-the-box ready such as with automatically collected events and enhanced measurement events. They are, however, “reserved” by Google for your use. What does that mean?
Let’s say you want to track every time someone signs up for a newsletter on your website. There is no automatically included nor enhanced measurement event that would logically be used for this. The next step, then, would be to review the list of Google-recommended events and see if one of them might fit the bill.
There is, in fact, a recommended event called “sign_up”. Now, just like any event that’s not included in the first two event categories, you can use “sign_up” to track anything you want on your website. But it would make the most sense, of course, to utilize it when someone signs up for something.
There are two possible complications, depending on what people can sign up for on your website. Fortunately, they both have simple solutions:
1) If you have more than one newsletter on your site. If you use the sign_up event to track multiple newsletter signups, this would be a great opportunity to add an event parameter that distinguishes between different newsletters. The parameter names could be as simple as “politics,” “sports” and “entertainment.”
That way, all your newsletter-signup data is housed within the same event, but you can also drill down to see, for example, who signed up for your politics, sports or entertainment newsletters, respectively.
2) If you have different types of unrelated signups on your website. Perhaps users can sign up for both newsletters as well as for a user account. In this case, you have two options:
A. Use the same solution in scenario 1: distinguish via event parameters. Use the sign_up event for all types of signups, but distinguish between signup types with parameters. e.g. For newsletters signups, use something like “politics_newsletter” and “sports_newsletter” as your parameters, and for account signups use “create_account”.
Pro: You will benefit from Google reporting features and integrations (see below) since both events utilize a recommended event.
Con: At the event level, all your data for two somewhat unrelated user actions will be mixed.
B. Your other option is to use the “sign_up” event for one of the events and use a custom event for the other. These could be “sign_up” and “new_account”, for example.
You should send recommended events with their prescribed parameters to get the most details in your reports and to benefit from future features and integrations as they become available.
Custom events are the only type of events in Google Analytics 4 that you would create from scratch without any pre-built settings. They also include the five aforementioned default parameters. Any other parameters you create would be considered custom.
When would you create a custom event in Google Analytics 4? You would only create custom events in Google Analytics 4 if the action you want to track is not included in any of the three previous levels of events (automatically included, enhanced and recommended).
For example, let’s say you want to track every time someone triggers both the “scroll” and “user_engagement” events on your product page. You could create an event called “engaged_product_visit” that is triggered whenever someone triggers both the “scroll” and “user_engagement” events while their page_location (essentially the URL) matches your product page.
We’ll explore this example more in-depth below when we talk about actually creating events, but the key factor here is that no event like this already exists in automatically collected nor enhanced measurement nor recommended events, which means that as a “last resort,” you must now create a custom event.
Naming Google Analytics 4 Custom Events
To keep things organized and aesthetically pleasing, I recommend following Google’s existing scheme for event creation. That is, all lowercase and with underscores instead of spaces. In fact, Google expressly tells you not to use spaces in its documentation.
Can I use spaces instead of underscores in Google Analytics 4 event names? Yes, but your dashboard will look much cleaner if you follow the existing schema.
Can I use uppercase letters in Google Analytics 4 event names?Yes, but for the same reasons, I would only do so if it’s part of a proper noun or perhaps an acronym.
Can I use numbers in Google Analytics 4 event names? Yes, though I would only do so if necessary.
Are Google Analytics 4 event names case-sensitive? Yes. e.g. “sourdough_bread” and “Sourdough_Bread” would be tracked as two separate events.
In Google Analytics 4, click “Configure” at the bottom of the left pop-out menu.
On the subsequent page, click the blue “Create Event” button. That will bring you to the following screen, where you should click the blue “Create” button.
That will bring you to the following page, which is where all the magic happens.
Using our aforementioned example – an engaged user triggering the scroll event on a product page – we would list each of those conditions in the Configuration:
As you can see, we have named our event engaged_product_scrolls, and in order for it to register, both the scroll and user_engagement events must fire with a URL that contains /product. In this imagined scenario, every product would have a URL that was something like xyzbusiness.com/product23483/basketball-shoes.
If we only wanted this event to fire for this one particular product, then the page_location would have to equal /product23483/basketball-shoes. Notice that page location is identified by everything after the top level domain (TLD), which is “com” in this case.
If you didn’t want to copy the exact same parameters from the source event, you would uncheck the box you see and add modification(s).
When you’re finished, click the blue create button at the top-right portion of the screen.
Create with Google Tag Manager
If you, like me, prefer to use Google Tag Manager to install Google Analytics events, you can do so by creating a new tag.
From the Overview page, click “Add a new tag.” (This can also be done by going to the Tags menu, below Overview, and clicking the “New” button once on that page.)
Click Tag Configuration and select the Google Analytics: GA4 Configuration tag.
Since Google Tag Manager gives us more event-creation capabilities, we’re going to use a different example here. In this case, I’m going to add a recommended event – sign_up – every time someone subscribes to receive email notifications about new posts on this website.
I’m going to do this by tracking clicks on the “FOLLOW” button in the footer of my website.
By running a test with Google Tag Manager preview mode, I can confirm what already seems obvious by looking at the button: The click text is “FOLLOW”. So I’m going to create a trigger in Google Analytics to fire every time someone clicks a “FOLLOW” button on my site. Since there is only one follow button on the whole site, I don’t have to worry much about this picking up unrelated clicks.
Here’s how I set up the Trigger in Google Tag Manager:
And here’s how I set up the Tag in Google Tag Manager, naming the event exactly as Google recommends:
Once the tag and trigger are properly set up, I can publish the latest version of my Google Tag Manager container, and the event will be live on the site.
You should see data begin to show up in your dashboard in around 24 hours or less.
If you want to test it beforehand, you can use the Debugger View, under Configure, in the GA4 dashboard. You can also test it simultaneously using the Google Tag Manager preview mode if you in fact set up the event using GTM.
Do you have any questions about creating events in GA4? Did you run into any problems I didn’t cover? Let me know in the comments.