Tracking Multiple Domains or Subdomains Under the Same Google Analytics Web Property

Sometimes it is necessary to have multiple domains or subdomains under the same Google Analytics web property. Whether it is a separate cart installation for your web store, a blog hosted on another server, or an internal portal you may want to track usage of.

Google Analytics out of the box is only setup to serve a single domain under each web property. There are a few steps you will need to take in order to get the optimal setup for a multi-domain Google Analytics configuration.

Google by default only shows the page part of the URL users visited and leaves out the hostname. This can be problematic in multi-domain setups as it will group all visits to pages of the same name as one page. For instance, if you have a blog hosted at and also at your main domain, they both will most likely have a similar home page URL in Google Analytics that would show as a single forward slash (/).

If you want to see stats for each of the pages separately in the behavior reports, you will need to setup an advanced filter. If you are not familiar with Google Analytics filters, read the About View Filters provided by Google.

The specific advanced filter we want to create is one to append the hostname to the page URL used in Google Analytics. In our previous example, the desired effect would to be to have the home page of your main site show up as / and the blog show up as / in the behavior reports in Analytics.

To add this filter, you will want to click on the Admin link at the top of the Google Analytics Interface next to Customization. Under the view section of the admin area there will be a filters link. On the next screen click the red “+ New Filter” button at the top of the table.

Once in the create a filter screen, you will want to choose a name for the filter. Next you want to click the Custom filter radio button directly under the Filter Name field. After you click the radio button some new options will open up on the screen.

  1. Click on the “Advanced” radio button at the bottom of the list.
  2. In the “Field A -> Extract A” field we want to choose “Hostname” from the select dropdown, and type “(.*)” in the field to the right of that.
  3. In the “Field B -> Extract B” field below that, choose “Request URI” from the select dropdown, and type the same “(.*)” in the field to the right of that.
  4. In the “Output To -> Constructor” field we want to choose “Request URI” again, and type “/$A1$B1” in the field to the right of that.
  5. Choose “Yes” for Field A Required.
  6. Choose “No” for Field B Required.
  7. Choose “Yes” for Override Output Field”.
  8. Choose “No” for Case Sensitive.
  9. Click the “Save” button.

All data collected from this point forward will include the hostname with the page URL in the behavior reports.

Tracking Multiple Domains in Google Analytics Filter

Keep in mind when sending users back and forth between domains that depending on your version of Google Analytics, you will need to set specific parameters on your links to keep the session between the different domains. Google’s Universal version of Analytics now makes this much easier by eliminating the need for these parameters. If you need more information on linking between domains, Google has great documentation available.

See how Hall can help increase your demand.