Internet Marketing Tips, Suggestions, & Ramblings

How To Track Traffic Across Multiple Subdomains With Google Analytics

Google Analytics provides a default JavaScript code which will need to be implemented into the code of your web pages in order to start tracking the traffic to your website. However, you might have a site with sub domains and if you do not customize your script, your data won’t be as accurate as it could be. Depending on how you currently have Google Analytics (GA) setup, you might see your main site listed as a referring site.

Here are the 5 steps to follow in order to get the most accurate data from a website with multiple sub domains:


Create a profile for your main site in your GA account.

Step 1

Step 2:

To track traffic across sub domains, you will need to add an additional line of code to your script called _setDomainName(). For example, if contains sub domains, the code would look like the following:

Tracking Code

Step 3:

Create a duplicate profile for each sub domain and name the profile with the sub domain name. (Note: Your “UA-XXXXXX-X” will be the same). Look for “+Add New Profile” on the GA Overview page.

Step 2

Step 4:

Add a predefined filter to each duplicated profile. Look for “Edit” on the right side of the Overview page in the same line as the profile:

Step 4.1

Then look for “+Add Filter”:

Step 4.2

Now, add a filter to only include traffic to this particular subdomain:

Step 4.3

Step 5:

If your subdomains contain URLs with the same request URI, you will need to do one more step. The request URI is everything that comes after the domain name on a URL – for example: –  /page1 is the request URI. GA reports only show the request URI and if the main site and subdomains contain the same request URI, you will not be able to differenciate the traffic for these pages.

In order to fix this, you will need to add an advanced filter to have GA show the complete URL in the reports. Again, you will need to add a new filter:

Step 5

So this is how you can track your website traffic if you have a site with multiple sub domains – you only need one GA account and one GA profile with many duplicated profiles with predefined filters.

About Garry Grant

Garry Grant is a veteran expert in search engine optimization and the digital marketing industry. With nearly 20 years of experience, Garry has successfully built a multi-service operation at SEO, Inc., developing proprietary technologies through complex strategic solutions. He has extensive experience in key initiatives and operational responsibilities grounded in information technology and performance management.

Garry’s expertise and esteemed reputation, coupled with SEO Inc.’s impressive client success record has earned him such accolades as Entrepreneur Magazine's 2005 Hot List for the Hottest Internet Property, Inc. 500 2007 Honorary award for Fastest Growing Private Company in America, an Inc. 500 top 50 Company in San Diego, and interviews with The New York Times, The Wall Street Journal, WIRED, Entrepreneur and The Huffington Post.

Garry Grant began his online career in 1993 creating strategic Web and e-business solutions for, The Rush Limbaugh Show, Premiere Radio Networks, Clear Channel Communications, EarthLink and Artisan Motion Pictures. Today, Garry and SEO Inc.’s highly skilled digital strategists develop proprietary technology and strategic digital marketing direction for Fortune 500 companies including, SC Johnson, McAfee,, Inc Magazine, IGN, Tacorri, LPL Financial, National Kidney Foundation, G4 TV, Fuel TV and Sony, just to name a few.