Displaying subdomains in your Google Analytics Reports
Goal: Implementing a hostname filter in Google Analytics to incorporate subdomain information into reports.
Desired Outcome: Ensuring effortless and accurate analysis of traffic reports, facilitating the clear identification of traffic originating from different subdomains.
Prerequisites or requirements:
- Google Analytics must be operational on the website and all associated subdomains.
- The steps outlined in this blog post are applicable only to Universal Google Analytics, not Google Analytics 4.
- If Google Analytics was set up before October 2020 or through a different blog post, it’s likely a Universal Analytics property.
Importance: With multiple subdomains, Google Analytics tends to aggregate data based on page path similarity, necessitating additional steps to distinguish sessions belonging to specific subdomains. This filter directly integrates subdomain information into reports, streamlining analysis.
Location: Within your Google Analytics account.
Timing: Implementation occurs once per view.
Responsible Parties: The individual accountable for Analytics.
Blog post Update: Google Analytics 4
💡 Note: Google introduced Google Analytics 4 in October 2020. While both versions can coexist as properties, this guide exclusively covers Universal Analytics. Ensure you select the correct property type when setting up Google Analytics.
Adding a Hostname Filter:
- Access the Google Analytics Admin panel by clicking here.
- If multiple Google Analytics accounts exist, ensure the correct account, property, and view are selected.
- Proceed with caution as filters permanently modify incoming hits. Avoid making changes in the main view; use the “Staging View” as demonstrated in this blog post.
- Select the “Google Analytics – Universal Analytics” property (Property ID starts with UA-).
- Navigate to “Filters.”
- Click “Add Filter.”
- Name the filter and select “Filter Type: Custom.”
- Choose “Hostname” in the first dropdown, “Request URL” for the second, and again “Request URL” for the last.
- Select “Advanced” and input these settings:
- Field A -> Extract A: (.*)
- Field B -> Extract B: (.*)
- Output To -> Constructor: $A1$B1
- Confirm that settings match the provided image below and click “Save.”
Impact Assessment:
If historical data exists within Google Analytics, consider potential impacts:
- “Destination” Goals utilizing “Equals to” or “Begins with” match types may be affected.
- Review any RegEx destination goals and make necessary adjustments.
- Update Goals to include subdomains in the “Destination” field.
- Evaluate impacts on dashboards, custom reports, or custom alerts utilizing the “Page” dimension.
- Analyzing periods encompassing the change date may become challenging.
- Consider implementing changes in a new view to preserve existing data.
Verification Process:
- Open your website using Chrome.
- Utilize the Google Tag Assistant Chrome extension to record activity.
- Refresh the page and stop recording.
- Review the full report to ensure proper integration of the filter.
- Check the “Flow” section and examine “Page Load 1” and “Hit 1” to confirm the filter’s application.
Remember: This change affects future data only; past data remains unaltered.