简体   繁体   中英

Google Analytics - Track subdomain AND no subdomain? (xyz.domain.com & domain.com)

When I added the filters to Google Analytics ( https://support.google.com/analytics/answer/7476333 ) to show the full hostname with the subdomain, no traffic was showing up when testing it out on just the primary domain (without www).

What's the proper way to set up filters so that it tracks subdomains and domains without a subdomain?

There is only one filter listed on the linked page. It is a commonly used filter and does not exclude data. It simply prepends the hostname to the requestURI in the GA reports.

If you are trying to track a subdomain of the primary domain and the primary domain, having tracking for the same Property on both with the cookieDomain set to auto (which it is by default)and the filter applied should be all that is needed.

If you are trying to track a primary domain and subdomains of a different domain, then if you are are trying to preserve referral and session data across the two, then you will need tracking for the same Property on the primary and subdomains, configured for cross domain tracking setup as per the article and the filter applied.

One weird issue I have come across (and it happens really randomly without rhyme or reason), is a view not reporting data, until the Save button on the view settings page has been clicked.

Usually the three most common issues i see are:

1) Tracking for the same property as the primary domain not being installed on the subdomain(s)

2) Tracking for multiple Properties being installed, setup with incorrect configuration for multiple trackers.. which can cause all hits from all trackers to get sent to just one Property instead of all Properties

3) Incorrect filters applied or incorrect filter order. Filters run in the order they are applied/added to a view. The order of the filters, needs to be set in the Filter table for the particular view.
Example of incorrect filters -
a View with a hostname filter to include only the Primary domain hostname, that also has the above filter applied, will not show any data for the subdomain(s) only the primary domain.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM