Subdomain Tracking with Google Analytics 4

If you’re running a business with different parts on the internet, like blog.example.com, support.example.com, and www.example.com, it’s important to track how many people visit each part using Google Analytics 4.

So, what do you need to do to set it up right? The good news is, it’s not too hard. But there are a few important things to remember.

In today’s blog post, I’ll help you understand how to track these different parts of your website using Google Analytics 4.

What Is A Subdomain And What Are Its Benefits?

A subdomain is a part of your website, made by adding a word in front of your main website name. For example, blog.yoursite.com is a subdomain for only blog content, if your main site is ‘yoursite.com’. Organize your site better, deal with different parts separately, and get your site to pop up more in search results for particular words. GA4 lets you see how people use each part of your site for these reasons.

However, you need to set it up right, like sorting out data and make special reports to track the subdomain. Additionally, using a subdomain means you can also have a unique domain name for each particular section of your website, giving you more freedom for design and features.

How To Set Up GA4 For Subdomain Tracking (Short Version)

Here are some things to keep in mind when tracking a different part of your website with Google Analytics 4 and what you need to do as well. Let’s start with a short version (for those in a hurry) first. If you find some of these tips confusing, read the longer version.

  • First off, Google Analytics 4 automatically sorts out sections of your website if GA4 is set up on all of the different sections. By default, GA4 uses something called ‘cookie_domain,’ and it’s set to ‘auto’. This means that the GA cookies remain the same across the whole website.
  • Make sure you’re using the same Google Analytics 4 setup for all the sections of your website you want to track. This means using the same GA4 ID for all of them. This is explained in the GA4 documentation on tracking different parts of your site.
  • You might need to add your main website to a list in Google Analytics 4 to stop it from counting as a referral. Usually, GA4 handles this automatically, but if you see your different sections showing up as referring to each other in reports, you’ll need to add your main website to a list of places not to count as referrals. You can do this by going to Admin > Data Stream > Select web data stream > Configure Tag Settings > Show all > List unwanted referrals and entering your main website there.

How To Set Up GA4 For Subdomain Tracking (Long Version)

And if that was still confusing, you can read the longer explanation here:

1. When you browse a website, Google Analytics tells the website owner through cookies. The information that cookies store on your visit are when did you visit the site and what did you look at. Next time when you visit the site, Google analytics gets to know that it’s you and then they record what all did you do on their site. But if cookies aren’t there or if each part of the website has a different set of cookies, then they set up new cookies. They can also set cookies for just one part of the site. For example, blog.com has a subpart X and only this can access its cookies. So tracking becomes more efficient.

2. Google Analytics will, by default, set cookies on your site. And don’t use a different Google Analytics setup for each of your website’s parts. They must all share the same cookies. Keeping everything consistent helps Google Analytics understand your website better and gives you clearer data.

2.1. It doesn’t matter if you use one or more setups of Google Tag Manager for a different part of your website. What’s important is that all the data goes to the same place in Google Analytics.

2.2. Suppose you have two parts of your website and you are interested in looking at the traffic that came from one part considering it coming from other parts as well. In that case, you can set up that all parts share a setup of Google Analytics. Tracking subdomains together makes it easier to see the big picture of your website’s traffic and user behavior.

3. Google Analytics might misinterpret without setting cookies for all parts of the website, so once you set it up, make sure that it works. A quick way is to check whether cookies are set properly on part of the websites. Testing ensures that your tracking setup is functioning as expected and that you’re getting accurate data for analysis.

4.Sometimes Google Analytics can show some parts of your site as the source of traffic, which they aren’t supposed to be. If such happens ,then ask Google Analytics to ignore it. By excluding these misleading sources, you can focus on the true sources of traffic to your website.

5. If different parts of your site have similar pages, then you might need extra work to know which part is visited. If you want to check and see which people are landing on a particular page, you have to create a separate report for each part of your website. Adding extra dimensions or filters to your reports can help you identify which subdomain a visitor came from, providing clearer insights into user behavior.

6. If you want to see which pages visitors first land on, you might need to create separate reports for each part of your site. By segmenting landing page reports by subdomain, you can better understand the entry points for visitors to each part of your website.

7. There are several reasons why you might want to segment your Google Analytics Subdomain data from your main domain, but one reason is because you want different teams to work on different things on different subdomains. For example, if your website had separate parts on separate subdomains, such as a blog, or a shop, you should track each separately, so that you could view the data for each falling due. Just by setting up a single GA4 property for multiple subdomains, it will be much easier for you to measure the performance of each subdomain.

How To Set Up A Single GA4 Property For Multiple Subdomains?

Here’s a step-by-step guide on how to add a subdomain to your GA4 property:

  • Firstly, you have to visit the Google Analytics website and login using your Google account details.
  • Click on the “Admin” tab at the bottom left of the page.
  • Choose the right GA4 property from the list. Each website you track with GA4 has its own property.
  • Click on ‘Data Streams’ and then click ‘+ New Data Stream’. Data streams help GA4 collect data from different parts of your website.
  • Choose ‘Web’ as you are adding a subdomain. This indicates to GA4 that you are tracking a website.
  • You should give the new stream a name that tells you what subdomain it is for, such as ‘Blog Subdomain’. This makes it easy for you to remember which part of your website this data is for.
  • Choose the right time zone. This makes sure that the data is exact according to the time zone that your guests are from.
  • Type in the full URL of the subdomain. Over here, make sure to include ‘http://’ or ‘https://’ at the start.
  • If you need to, alter some advanced settings.
  • Finally, create the stream.
  • Make a Copy of the Stream ID you just produced by creating a stream. The ID is unique to your subdomain and it is verified and GA4 will accept the traffic.
  • Go to Your Subdomain Files. Usually, there is a code snippet for tracking purposes. To be more specific head to the control tracking part of your website.
  • It is said that different websites have different systems but usually coding is installed on the header part of your HTML.
  • Then, you’ll put the special ID in this part of the code.
  • Make sure to replace any old IDs with the new one you got from GA4. This makes sure GA4 collects data from your subdomain correctly.
  • Once your new website is getting recognized with GA4, now go and check whether things are working or not.
  • Go back to GA4 and look for the new data stream you made.
  • Use tools like Tag Assistant to ensure that the tracking code is just working fine.
  • Once you’ve confirmed that everything’s good to go, you can look at the data collected from your subdomain in GA4. Go to the “Reports” section to see how your subdomain is performing compared to the rest of your website.

Configuring Data Streams For Subdomains

It is like arranging different channels into which you could check numerous things about your website in configuring data streams for different subdomains in Google Analytics. A data stream established for the particular subdomain is called domain tracking.

Data streams will help you concentrate your examination on more noteworthy adaptabilities to gather data for your particular needs and objectives. Some of the records’ importance accumulates data about traffic sources, information about referral traffic, and other such significant digital marketing measurements.

Referral exclusion lists are additionally appointed for your data stream once you arrange how the scopes of the areas and the deciding spaces are incorporated. These help revive your reports just with the data matter, which can help you in building and produce designs on your website to target huge traffic and make more benefits.

Step-By-Step Guide For Setup And Managing Data Streams For Each Subdomain

Step 1:

  • If you don’t have a GA4 property yet, follow the steps in the GA4 setup guide to make one.
  • Once you’ve got a GA4 property, move to the next step.

Step 2:

  • Log in to your GA4 account.
  • Click on the “Admin” tab.
  • Select the “Data Streams” section.
  • Tap the “Add Stream” button.

Choose the type of data stream you need:

  • Web Stream: For website data.
  • iOS App Stream: For iOS mobile app data.
  • Android App Stream: For Android mobile app data.

Step 3:

  • Enhanced Measurement:
    • GA4 automatically tracks page views. You can also turn on extra features like scroll tracking, link clicks, form fills, video plays, and file downloads.
  • Other Web Data Stream Settings:
    • Look at the parameters to control how data is collected and reported.
    • Adjust the settings based on what you need.

Step 4:

  • Set up iOS and Android app data streams, similar to web data streams.
  • Make sure your mobile apps are connected properly.
  • Keep an eye on events, user actions, and other important data.

Step 5:

  • Check your data streams often to make sure they’re getting the right data.
  • Update settings when needed, like adding new events or changing tracking.
  • Get rid of any data streams you don’t need anymore.

Step 6:

  • Use the GA4 reporting area to study the data you’ve collected.
  • Learn about user actions, conversions, and how well your stuff is doing.
  • Use data streams to improve your website or app plans.

Implementing Tags For Subdomain Tracking

These are important because subdomain tracking tags are essential if you want to view the accurate and complete user behavior at every part of the site. The more visitor-interaction data you collect, the better you learn about the user habits. As a result, out of this data collected, trends can develop over time from it. With this kind of information, you can understand what is working and what areas need improvement to boost your website’s overall performance.

Detailed Guide For Implementing GA4 Tags For Accurate Subdomain Tracking

Before you start tracking subdomains, ensure both the main domain and subdomain share the same GTM container ID and Google Analytics ID.

Step 1:

  • Log in to Google Tag Manager and go to “Variables” in the left-hand panel.
  • Click on “User-defined variable” and then “Variable Configuration.”
  • Name your variable.

Step 2:

  • Choose “Google Analytics Settings” from the options.
  • Set Google Analytics Settings:
  • Fill in the Universal Analytics tracking ID.
  • Set Cookie Domain to “auto.”
  • Under “Fields to Set,” set “allowLinker” to true.
  • Under “Cross-domain Tracking,” add the URLs of both the main domain and subdomain.
  • Create a Tag and a Corresponding Trigger.

Step 3 :

  • In Google Analytics settings, go to “Tracking Info” under “Property Settings.”
  • Click on “Referral Exclusion List” and add the main domain URL.

Adding the main domain to the referral exclusion list ensures that traffic between subdomains and the main domain is not counted as referral traffic. This prevents misclassification of traffic as referral when it’s actually direct traffic and vice versa.

Examining Subdomain Data In Google Analytics 4 Subdomains

Google Analytics 4 tracks subdomains by following user behavior and experiences seen in Google Analytics reports. The steps to track subdomains using Google Analytics 4 Reports are:

  1. Firstly, you have to log in to your GA4 account.
  2. Then you have to click on the “Reports” tab which is present in the navigation menu.
  3. You have to choose the GA4 property in the top left corner, which is associated with the subdomain you are analyzing.
  4. If you have multiple properties, choose the one that is specific to your subdomain.
  5. Look for the “Events” section in the left sidebar.
  6. Click on “Events” to expand it.
  7. Choose “Top Events” or “Event Parameters” based on what you prefer.
  8. Now, you will see a list of all the events related to the subdomain.
  9. Click on an event to look into details such as the total occurrences, unique users, average value, etc.
  10. Pay close attention to the events that are specific to your subdomain (for example, page views, form submissions, clicks, etc ).You can also use the date range selector to focus on a specific period.
  11. You can use filters to narrow down the data to the subdomain (e.g., by hostname or page path). You can compare the metrics between different subdomains. These are the key metrics for any subdomain. You can define goals specific to your subdomain (for example, completing a form or signing up).
  12. Create custom conversions based on user interactions.
  13. Monitor the rate at which goals are completed.
  14. You can explore the Behavior Flow report to see how users move through your subdomain. You can Discover regular paths that users take and possible drop-off points.
  15. Segment users based on custom criteria (e.g., new vs. returning, geographic location) to understand the type of users that are part of your subdomain.
  16. Finally, you can export reports or build a custom dashboard. You can also talk with your team to share insights on new information.

How To Access And Interpret Subdomain Traffic And Performance Data In GA4?

GA4 will auto-generate a hostname dimension in every one of your GA4 reports. GA4 tracks all domains and subdomains of your site as hostnames and includes them in every report.

  • To view data about a subdomain, choose a report category. Examples: pages, traffic sources, Landing Pages, etc.
  • Choose a report you want to understand in the category and click on the + sign to add dimension.
  • Make sure you include the hostname’ dimension in it.
  • Check when measuring across domains, you can now see all the data from both your main domains and subdomains.
  • To get a detailed or clearer report on a subdomain, filter your report. Find and select ‘add filter’ in your report.
  • Make sure to create the filter and choose ‘hostname.’ When you visit a subdomain, apply and click on apply to view the report dedicated to that subdomain only.
  • And save your reports: Save your subdomain reports in the GA4 library.

Custom Reports And Segmentations For Detailed Subdomain Analysis In Google Analytics

  • When you open Google Analytics 4 (GA4), you’ll see an “Explore” tab on the left side. Click on it, then select “Free Form.” This option lets you build your report from scratch.
  • Decide which time period you want to analyze. You can choose from options like the past 7 days, the past month, or a custom range.
  • (Optional): Segments help you group your data. For example, you can look at traffic from different countries or compare mobile users to desktop users.
  • Dimensions give your data context. They provide extra information about your metrics. For example, if you’re tracking page views, you might want to add dimensions like page title or URL.
  • Metrics are the actual numbers you want to see. They represent the data you’re analyzing. Common metrics include things like page views, sessions, or conversion rates.
  • One can rearrange your report’s layout, moving the elements to where they make the most sense for your analysis.
  • Decide ahead of time if you want to show your dimensions and metrics in rows or columns within your report. This can help you show the data exactly as you want to see it.
  • Values are the specific metrics you’re interested in. You can drag and drop them into your report to see the corresponding data.
  • Filter techniques help you further narrow down the data that you are looking for like geographic location, device type, etc. You can filter your data to only display information from one country. You can also filtrate on your data not to show any of the Ad’s traffic.
  • GA4 reports have interactive features that let you explore your data in different ways. For example, you can click on elements in your report to drill down into more detailed data or exclude certain elements from your analysis.

Best Practices For Subdomain Tracking In GA4

Here’s how to make sure you’re tracking subdomains accurately :

  • Use the same naming style for all your subdomains. This helps you easily spot and understand the data.
  • Set up targets and keep an eye on how well each subdomain is doing. This helps you see if your marketing is working.
  • Regularly check the numbers from each subdomain. This helps you see what’s going well and what needs improving.
  • Divide up your data by subdomains. This lets you see how each one is performing on its own.
  • Investigate any cases where it looks like your own site is sending traffic to itself. Fixing these makes your data more accurate.

Tips For Tracking Subdomains More Effectively

  • Use ‘auto’ for the cookie Domain. This simplifies cross-subdomain tracking.
  • Enter the hostname into request URIs.
  • Set your domain for ga.js or doubleclick.js and specify the cookie location for that old tracking code.
  • Have a consistent property and data stream by using the the same name for all subdomains.
  • Change unwanted referrals to stop GA4 from showing self-referrals for more accurate data.
  • You should use the AI’s predictions in GA4 correctly and get more out of the machine learning capability.
  • Track affiliate sales on your site that also offer you commissions with the Events feature, this lets you do more detailed tracking.
  • Make sure your tracking codes are verified by checking real-time reports frequently.
  • You don’t have to use cross-domain tracking in GA4 whenever you keep an eye look on your different subdomains on the same main domain
  • GA4 automatically manages and keeps a record of subdomains of the same domain.
  • Install GA4 on all your subdomains using the same measurement ID.
  • Make sure you use the same property and data stream with your other subdomains.
  • Regularly update the list of unwanted referrals to address self-referrals.

Fixing Common Issues with GA4 Subdomain Tracking

Make sure everything is set up right by fixing these issues:

  • If you have added the Google Tag containers on a single page more than once, remove the extra container to keep things organized.
  • When you switch to the new Google from the old Google, ensure that both have been set up right in the google tag manager. Correct your errors if they are not set up correctly, so that the data moves over properly.
  • After setting up your data management tags, keep out the visits from your team or the office workers. Go to the admin > data Streams in GA, and then use the rules to block your office or team’s IP address from visiting the site.
  • After setting up the GA4 and the Google Tag Manager, test to ensure that the program is collecting data as it should. If it is not, install the GA Debugger extension in your browser and turn it on for your site.

Summary

This article details setting up Google Analytics 4 to track subdomains, emphasizing its importance in understanding user behavior across your site. It covers installation, cookie management, testing methods, and data analysis. Additionally, it provides tips for optimizing tracking and troubleshooting any issues, helping improve overall website performance.