How to Track Subdomains in Google Analytics

How to Track Subdomains in Google Analytics

Table of Contents

Tracking subdomains in Google Analytics is crucial for webmasters and digital marketers who manage a website with multiple subdivisions, such as a corporate site with separate sections for their blog, shop, or regional content. Proper configuration in Google Analytics allows you to view traffic data for each subdomain, enabling detailed analysis and informed decision-making. This article explains how to set up your Google Analytics to effectively track activity across your primary domain and any subdomains.

Why Track Subdomains?

Understanding how different sections of your website perform is essential in optimizing user experience and increasing conversions.

Tracking subdomains can help you:

  • Identify which parts of your website attract the most traffic.
  • Analyze user behavior on each subdomain.
  • Measure the effectiveness of targeted marketing campaigns.
  • Implement more precise SEO strategies for different sections of your site.

How to Set Up Subdomain Tracking in Google Analytics

To track subdomains effectively in Google Analytics, you need to set up your tracking code correctly and make slight modifications to your Google Analytics property settings. Here’s how:

1. Adjust Your Tracking Code

Ensure your Google Analytics tracking code includes the ‘_setDomainName’ variable set to your main domain.

2. Add Each Subdomain as a Property

In Google Analytics, add each subdomain as its own property under your main account. This will generate separate tracking codes for each subdomain, allowing for granular data collection.

3. Implement Cross-Domain Tracking

If users navigate between different subdomains during a session, set up cross-domain tracking to ensure their interactions are tracked as a single session. This helps in understanding the user journey across various parts of your website without data loss.

4. Configure Your View Settings

To view data from all subdomains in one place, create a new view in your Google Analytics property and adjust the filter to include traffic to the hostname.

5. Use Segments for Comparative Analysis

Apply segments in your reports to compare performance between your main domain and subdomains, or among different subdomains.


Tracking subdomains in Google Analytics enhances your ability to monitor and analyze the traffic and user behaviors across different parts of your website.

By following these steps, you can gain insights into which areas are performing well and which may require further optimization.

This data-driven approach can significantly improve your strategic initiatives across different segments of your business online.