GA4

How to Add a Subdomain to Google Analytics

alt-tag
Find out how to add a subdomain to Google Analytics for better tracking and reporting. This guide helps you set up tracking for multiple domains under a single Google Analytics property.

Introduction

Integrating subdomains into Google Analytics is essential for tracking user behavior across different sections of your website and ensuring accurate data collection. Whether you have a blog, a store, or any other separate section of your site that operates under a subdomain, adding it to Google Analytics helps you consolidate data and gain comprehensive insights into user interactions. This guide will provide a detailed, step-by-step approach to adding a subdomain to Google Analytics, ensuring that your tracking is set up correctly and your data remains accurate.

Step 1: Access Your Google Analytics Account

  1. Log In to Google Analytics:
    • Open your web browser and navigate to the Google Analytics website (analytics.google.com).
    • Enter your Google account credentials and log in to access your Analytics account.
  2. Select the Correct Account and Property:
    • If you manage multiple accounts or properties, select the one associated with the website where you want to add the subdomain. Click on the account name and then select the property linked to your main domain.

Step 2: Configure Tracking Code for Subdomain

  1. Find Your Tracking Code:
    • Navigate to the Admin panel by clicking on the "Admin" tab at the bottom left of the Google Analytics interface.
    • Under the "Property" column, click on "Tracking Info," and then select "Tracking Code." You will see your Google Analytics tracking code here.
  2. Modify Tracking Code for Subdomains:
    • Ensure that your tracking code is configured to track subdomains. You need to update the tracking code to include the cookieDomain property set to 'auto.' This ensures that sessions are tracked across subdomains.

Example modification for the Universal Analytics tracking code:
javascript
Copy code
ga('create', 'UA-XXXXXXXX-Y', 'auto');

Step 3: Set Up Cross-Domain Tracking

  1. Access Tracking Code Settings:
    • In the Admin panel, under the "Property" column, click on "Tracking Info," and then select "Referral Exclusion List."
  2. Add Your Subdomain:
    • Click on "Add Referral Exclusion" and enter your subdomain (e.g., subdomain.example.com). This step prevents Google Analytics from treating traffic between your main domain and subdomain as a referral, which would otherwise skew your data.

Step 4: Create a New View for Subdomain Tracking (Optional)

  1. Navigate to View Settings:
    • In the Admin panel, under the "View" column, click on "View Settings."
  2. Create a New View:
    • If you want to track the subdomain separately, create a new view for it. Click on "Create View" and set it up for your subdomain by entering the appropriate website name and URL.
  3. Set Up Filters:
    • Apply filters to this new view to include only traffic from the subdomain. Go to "Filters" under the "View" column, click on "Add Filter," and set up a filter to include only traffic from your subdomain.

Step 5: Verify Tracking Code Implementation

  1. Use Google Tag Assistant:
    • Install and use the Google Tag Assistant Chrome extension to verify that your Google Analytics tracking code is implemented correctly on both your main domain and subdomain.
  2. Check Real-Time Reports:
    • Go to the "Real-Time" reports in Google Analytics to see if activity from your subdomain is being tracked. This helps confirm that the tracking code is working as expected.

Step 6: Adjust Goals and Conversions (If Needed)

  1. Access Goals Settings:
    • In the Admin panel, under the "View" column, click on "Goals" to access your goal settings.
  2. Modify or Create Goals:
    • Adjust existing goals or create new ones to ensure they are tracking conversions correctly across both your main domain and subdomain. Update goal URLs to include the subdomain path if needed.

Step 7: Update Filters for Accurate Reporting

  1. Create or Update Filters:
    • If you have filters set up in your views, ensure they are updated to include or exclude traffic from your subdomain as required. This helps maintain accurate data in your reports.
  2. Check Filter Settings:
    • Go to "Filters" in the "View" column, and review or create filters to manage how subdomain traffic is treated in your reports.

Step 8: Monitor Data for Consistency

  1. Track Data Trends:
    • Regularly monitor your Google Analytics reports to ensure that data from your subdomain is being tracked and reported accurately. Look for consistency in traffic, conversions, and user behavior.
  2. Adjust Settings as Needed:
    • If you notice any discrepancies or issues, revisit your tracking code, settings, and filters to make necessary adjustments.

Step 9: Communicate Changes to Stakeholders

  1. Prepare Reports:
    • Create reports that include data from both your main domain and subdomain to provide a comprehensive view of website performance. Highlight any significant changes or insights gained from integrating the subdomain.
  2. Share Insights:
    • Share the updated reports with relevant stakeholders, including marketing teams, web developers, and decision-makers. Ensure they understand the impact of the subdomain on overall website performance.

Step 10: Stay Updated on Google Analytics Features

  1. Explore New Features:
    • Google Analytics frequently introduces new features and enhancements. Stay informed about updates that may affect how you track and report subdomain data.
  2. Participate in Training:
    • Consider participating in Google Analytics training or webinars to stay updated on best practices and advanced tracking techniques.

Summary

Adding a subdomain to Google Analytics is essential for tracking user behavior and gaining comprehensive insights into your website's performance. By following these ten steps accessing your account, configuring tracking code, setting up cross-domain tracking, creating a new view (if needed), verifying implementation, adjusting goals, updating filters, monitoring data, communicating changes, and staying updated on features you can ensure accurate and effective tracking of your subdomain. This will help you make informed decisions, optimize your marketing strategies, and improve overall website performance.

Future-proof your marketing measurements

green-tick

Forecast accurately with no-code ML & AI model setup that provides comprehensive predictive insights

green-tick

Stay in the know with always-on measurements providing real-time channel performance