MENUMENU
  • Services
    • Services
      • Search Engine Optimization
      • International Search Marketing
      • Local Search Marketing
      • Pay Per Click Advertising
      • Social Media Marketing
      • Email Marketing
      • Conversion Rate Optimization
      • Public Relations
      • Website Design & Development
      • Reporting & Analytics
      • Amazon Marketing Services
      • Digital Marketing Strategy
      • Franchise Marketing
  • About Us
    • About Ignite Visibility
      • Our Story
      • Case Studies & Reviews
      • Clients
      • Our Values
      • Our Team
      • UCSD Extension Courses
      • Careers
  • Resources
    • Resources
      • Our Blog
      • Podcast
      • SEO: The Movie
      • Social Media Marketing: The Movie
      • Book: The Forecaster Method
      • Digital Marketing Webinars (2022 Webinars)
  • Diversity & Inclusion
  • Contact
  • 619.752.1955
  • Client Login
Home / Analytics / Tracking Domains and Subdomains in Google Analytics

Tracking Domains and Subdomains in Google Analytics

December 5, 2012 By John E Lincoln

There are many different steps that must be adhered to, to ensure that you are properly tracking subdomains in Google Analytics. This guide will help you to understand the steps that you need to take to increase your tracking ability with all of your websites.

Beginning with the basics, it is important to understand what a domain is. A domain is like an address. Instead of having to use a huge line of numbers that goes on and on, we use a domain name. This makes it easier to identify a website.

Step One: Tracking Across Domains

The art of tracking subdomains in Google Analytics works only with 1st party cookies. This means that the tracking reports can only track information through the 1st cookie. It will not track once a visitor goes to one of your subdomains. Often, you will have the need to track the activity of all of your domains and subdomains. Using Google Analytics alone will not work, simply because it will not have the ability to track activity once the visitor leaves your main domain. In order for the visitors activity to continue to be tracked, you will have to find a way to send cookie information to the other site.

Tracking Accross Domains - The Link Method

Tracking Accross Domains - The Link Method

Many people need this type of tracking because they may send a visitor to another domain to make a purchase. Google Analytics cannot track that visitor to see if they indeed did make a purchase because they are no longer being tracked by the main domain cookie. The only tracking information that you will get is the single visitor, visiting the single main domain. It is important that you have a way to share cookie information between your different domains or you will not have the ability for tracking subdomains in Google Analytics.

There are ways that allow for tracking subdomains in Google Analytics. This allows Google to have the ability to track users over multiple domains. The __links() method is the best way to ensure that Google has this tracking ability. This method works simply by sending cookies through URL parameters to allow the tracking of the user beyond the main domain.

It is quite simple to enable Tracking multiple domains in Google Analytics, but it is important for you to get the code precisely correct. You will need to place these two lines below your tracking code on both your main domain and your subdomains to ensure that it works properly.

__gaq.push{[ __setDomainName, none]};

__gaq.push{[ __setAllowLinker, true]};

The most important part of the coding here is to make sure that your setDomainName is set to none and that your setAllowLinker is set to true.

Step Two: Tracking Across Domains

Tracking multiple domains in Google Analytics is done by adding the__link() method to every single link that is between your domains. While this can be a lengthy process, it is not difficult. You will need to update each link to call the link method. Make sure that each link is done correctly to ensure proper tracking ability.

Step Three: Tracking Across Forms

If you use forms for your domain, such as third party shopping forms, you will need to use the Forms and __linkByPost() Method. This will only be used if you use a form to move your visitors from one domain to another. You will need to use __linkByPost() instead of just link().

By adding in this code, you can enable tracking subdomains in Google Analytics and this can be used to transfer cookie information over to other domains in both iFrames and pop ups. You will need to change each of your forms so that cookie information is able to be moved from each domain to the next.

In using this method, you will need to modify your form action by adding a different string of query parameters to the existing value in the action attribute when your visitor goes to submit the form.

Step Four: Tracking Multiple Domains in Google Analytics

A subdomain is a domain that is a part of a larger or main domain. Subdomains are normally used to separate departments on a website. This can also be used to separate pages and groups on a website. In Google Analytics, it is impossible to automatically track visitors across domains. If you do not have the ability to share your visitors cookie information through to the different domains, you will lose your session info once your visitor leaves your main domain. In this type of scenario, your report will read as if your main domain is the referring website because Google Analytics can only recognize that main domain.

To have the ability of Tracking multiple domains in Google Analytics, you will need to use __setDomainName(). You will need to add this line of code below your tracking code on each subdomain page that you have. You will also need to make sure that you reference your main domain or parent domain. This allows Google to track cookies across all of the subdomains that you own.

In this method, you may run into a slight side effect, in that your tracking reports may not distinguish between pages that have the same name. Your tracking report will only show single page visits and not multiple page visits. To correct this issue, you will need to set up an advanced filter.

Step Five: Best Practices for Tracking Subdomains Through Filters

To fix the problem of Google Analytics not differentiating between subdomain pages with identical names, you will need to create distinct, separate profiles for each and every one of your subdomains. This will allow you the full ability to track each of your subdomains and the traffic going into and out of each domain.

To set this up correctly, you will need to set up a Master Profile for your main domain. This profile will have no filters. You will then need to set up one profile for each subdomain that you have, making sure to include all of the subdomains. All of your subdomain profiles will include filters. This prevents Google Analytics from tracking only the request you are on and allows it to track various subdomains, even when they are identically named.

With this filtering system, Google Analytics will now be able to distinguish between your subdomain pages and your tracking results will appear in your report with the subdomain attached. This makes tracking across multiple domains easier and more productive.

Step Six: Tracking Multiple Domains in Google Analytics with Subdomains

You will need to make sure that your Google Analytics cookies are each set with the proper domain and that the name is passed between the primary domains. You will use the Call__setAllowHash() to ensure that the configuration is correct and that the tracking is being passed between each subdomain correctly.

You will need to modify the tracking code that is on each subdomain and each primary domain. It is vital that your setAllowLinker has an argument of true and that your setAllowHash has an argument of false. You will need to include this same code to each domain that has subdomains.

You will also need to include the Call__link() or ___linkByPost() method in all links and your forms that run between domains. You do not need to use these methods for your links and forms that are between subdomains within the same domain. Again, you will need to set up profiles for each account, including one for each primary domain and one for each subdomain. You will use an inclusional term that is based on your host name field.

Hopefully, this guide will help you to better understand the methods of Tracking multiple domains in Google Analytics. The approach is in no way difficult, but you must be diligent in your coding and methods to ensure proper placement of each code so that tracking can take place across your different domains.

Taking the time to review each piece of code and ensuring that you have them placed in the proper areas will allow for all of your hard work to quickly begin paying off. Once you are able to read your tracking reports and see activity across all domains and subdomains, you will be glad that you took the time to understand how Google Analytics uses tracking and how you can work your codes to enhance all that Google Analytics does.

About John E Lincoln

John Lincoln (MBA) is CEO of Ignite Visibility (a 2017, 2018, 2019 and 2020 Inc. 5000 company) a highly sought-after digital marketing strategist, industry speaker and author of two books, "The Forecaster Method" and "Digital Influencer." Over the course of his career, Lincoln has worked with over 1,000 online businesses ranging from small startups to amazing clients such as Office Depot, Tony Robbins, Morgan Stanley, Fox, USA Today, COX and The Knot World Wide. John Lincoln is the editor of the Ignite Visibility blog. While he is a contributor, he does not write all of the articles and in many cases he is supported to ensure timely content.

You may also like:


  • How Does a Data Breach Affect Brand’s Reputation?
  • What is UTM Tracking & How Can You Use it to Improve Your Marketing?
    What is UTM Tracking & How Can You Use It…
  • Site Search Function & Report: Use Your Site's Search Bar to Understand Your Audience
    Site Search Function and Report: How to Use Your Site’s…
  • A Marketing Consultant's Advice on Data Visualization With Randy Jasinski
    A Marketing Consultant’s Advice on Data Visualization With Randy Jasinski

Search Here

NEWSLETTER // SIGN UP NOW

About The Editor

John E Lincoln, CEO

John Lincoln is CEO of Ignite Visibility, one of the top digital marketing agencies in the nation and a 2017, 2018, 2019 and 2020 Inc. 5000 company. Lincoln is consistently named one of the top marketing experts in the industry. He has been recipient of the Search Engine Land "Search Marketer of the Year" award, named the #1 SEO consultant in the USA by Clutch.co, most admired CEO and 40 under 40. Lincoln has written two books (The Forecaster Method and Digital Influencer) and made two movies (SEO: The Movie and Social Media Marketing: The Movie) on digital marketing. He is a digital marketing strategy adviser to some of the biggest names in business. John Lincoln is the editor of the Ignite Visibility blog. While he is a major contributor, he does not write all of the articles.

LEARN MORE ABOUT JOHN

Contact Us. Let’s Chat!

  • Hidden

Marketing Guides

SEO In 2020: How To Prepare For Major Disruption

"SEO: The Movie" - Have You Seen Our Film? Watch Now

"Social Media Marketing: The Movie" - Have You Seen Our Film? Watch Now

Amazon Seller Central vs Vendor Central

Listen To The Podcast Featuring The Best Minds In Marketing

John Lincoln Interviews Global Director of Digital Marketing & Strategy at Qualcomm, Jessica Jensen

Check Out 227 Free Online Marketing Classes

The 2020 Guide To Dominating SEO With Advanced Schema

Learn More About Our Digital Marketing Agency

Learn More About Our SEO Services

Learn More About Our Paid Media Services

SELECT CATEGORY

Become A Contributor

Interested in writing for Ignite Visibility?

APPLY NOW

Services

  • Search Engine Optimization
  • Pay Per Click Management
  • Conversion Rate Optimization
  • Website Design & Development
  • Social Media Company
  • Public Relations
  • Amazon Marketing Services
  • Franchise Marketing
  • International Services
  • Digital Marketing Agency Services

About

  • Our Team
  • Our Values
  • Clients
  • Reviews
  • UCSD Extension Courses
  • Careers
  • Tools & Resources
  • Sitemap

Contact

4250 Executive Square, Suite 100
La Jolla, California 92037

619.752.1955

Join The Newsletter

Sign up for our newsletter to get the latest from Ignite Visibility.

google parther logo

©2022 Ignite Visibility. All Rights Reserved. Privacy Policy