How To Track Subdomains In Google Analytics 4

Posted in: Analytics

Join thousands of marketers to get the best search news in under 5 minutes. Get resources, tips and more with The Splash newsletter:

Tracking subdomains in Google Analytics 4 is easier than you may think. In fact, GA4 does most of the work for you. 

Related Articles:

Setting Up Subdomain Tracking In Google Analytics 4

If you wanted to filter traffic by subdomain in UA, creating a View was the best way to do so. Google Analytics 4’s new way of tracking subdomains requires far fewer steps.

The essential step for collecting subdomain data in Google Analytics 4 is installing the tracking code of your GA4 property to all subdomains. There are a couple of ways to do this; either hardcoding it on your site or installing it with Google Tag Manager. Typically, you will use the same process you did to set it up on your primary domain.

For subdomain tracking to work properly, make sure you use the same GA4 property and data stream when connecting all your subdomains. 

If your subdomains have different Google Tag Manager (GTM) container codes, you can still track them in one GA4 account. You just have to ensure you connect all the GTM containers to the same GA4 Measurement ID

To verify that GA4 is tracking activity on your subdomains, you can use GA4’s debug view

Verification Steps: 

  1. Open the preview mode of your site in GTM
  2. Navigate to a subdomain while in preview mode 
  3. Look for a page_view event to appear in debug view 

Finding Subdomain Data in Google Analytics 4 

After connecting GA4 to your subdomains, you are ready to find your subdomain data.

The dimension to remember when tracking subdomains in GA4 is Hostname. Any domain or subdomain with a GA4 tracking code is considered a Hostname. There is no need to add the Hostname dimension to GA4, as it is already available in all reports. 

To see data from your different subdomains, pick a report category first. 

Useful report categories for tracking subdomain data include Pages and screens, Traffic acquisition, and Landing page. For this example, I choose the Landing page report. 

After choosing your desired report, the next step is to click on the + found in the first column of your report’s table.

Blue plus button on GA4 dashboard

A pop-up window will appear where you can search for and apply that all-important Hostname dimension. 

Pop-up window with Hostname dimension

I now see an updated dashboard showing me the different landing pages for both my primary domain and subdomains. 

Updated GA4 dashboard after Hostname applied

Creating Google Analytics 4 Subdomain Reports

If you have multiple subdomains, creating filtered reports will make it easier to analyze data for each specific subdomain. You can choose to filter any of the standard report types found in the Reports section. For my filtered subdomain report, I will continue using the Landing page report I created in the previous section. 

The first step for creating a subdomain-specific report is clicking on the Add filter button at the top of your chosen report type.

Add filter button on landing page report

Selecting the Add filter button brings you to the Build filter tool. In this tool, click the Select dimension drop-down menu and then search for Hostname. Next, click the Select match type drop-down menu and choose exactly matches. A Select dimension value drop-down menu should appear and you can select the specific subdomain you want to analyze (I choose the info. subdomain on my site). 

Set up to filter by a hostname


After clicking Apply, you will see an updated dashboard specific to your chosen subdomain. 

Landing page dashboard filtered by subdomain

For future reference, make sure to save your report. By using the library feature, you can save and publish your reports to make them readily available. 

You can follow the saving instructions in our GA4 custom dashboards blog post


Don’t let subdomain tracking become a daunting task. With the help of Google Analytics 4, you can efficiently set up subdomain tracking and create custom subdomain reports all in the same GA4 account. 


Search News Straight To Your Inbox

This field is for validation purposes and should be left unchanged.


Join thousands of marketers to get the best search news in under 5 minutes. Get resources, tips and more with The Splash newsletter: