Cross domain tracking setup in Google Analytics
-
I really need help on this, I can't figure it out.
I need to track a few subdomains and and couple of seperate domains in one profile in Google Analytics.
So I have:
So the code I have placed on all of these domains is as following:
I have then set up seperate profiles which filter out the data by domain. E.g. for sub1.maindomain.co.uk, I have user the fitler:
Custom filter > Include > Filter Field = Hostname > Filter Pattern = sub1.maindomain.co.uk
For the www.anotherdomain.co.uk, I have used the same filter.
Now this all seems to be tracking visits and unique visitors okay, but I always have a very low pageview count, less than visits and sometimes zero. Could anyone shed any light on what I am doing wrong?
Thanks in advance mozzers.
-
- ** look underneath your main script and compared to what you see below. If you don't have the subdomains listed as you do not have in your tracking code you will not get the results needed. Check out this video I have attached as well as this URL and I think you'll be fine. Let me know if I can be of more help and always use Asynchronous tracking code over traditional because Asynchronous it keeps your site from being slowed down.**
- ** sincerely,**
- ** Thomas von Zickell**
https://developers.google.com/analytics/devguides/collection/gajs/gaTrackingSite
-
Online Store Domain:
www.**example-petstore.com**
<a class="exw-control exw-expanded">▾</a>Asynchronous syntax
... <a< span="">href="http://www.my-example-blogsite.com/intro" onclick="_gaq.push(['_link', 'http://www.my-example-blogsite.com/intro.html']); return false;"> See my blog ... <form< span="">name="f" method="post" onsubmit="_gaq.push(['_linkByPost', this]);"></form<></a<> ```<a class="exw-control exw-collapsed">▸</a> **Traditional (ga.js) syntax** The only links or form data that you need to customize are those that point to `www.my-example-blogsite.com`. This is not required for links to the sub-domain of this site, since the `_setDomainName()` function defined `.example-petstore.com` as the domain to enable cookie access for any other subdomains.
-
Online Store Subdomain:
**dogs**.example-petstore.com
<a class="exw-control exw-expanded">▾</a>Asynchronous syntax
... <a< span="">href="http://www.my-example-blogsite.com/intro.html" onclick="_gaq.push(['_link', 'http://www.my-example-blogsite.com/intro.html']); return false;"> See my blog <form< span="">name="f" method="post" onsubmit="_gaq.push(['_linkByPost', this]);"></form<></a<> ```<a class="exw-control exw-collapsed">▸</a> **Traditional (ga.js) syntax** Links back to the primary domain do not need configuration because the sub-domain shares the same cookies with the primary domain.
-
Blog Domain:
www.**my-example-blogsite**.com
<a class="exw-control exw-expanded">▾</a>Asynchronous syntax
... <a< span="">href="http://dogs.example-petstore.com/intro.html" onclick="_gaq.push(['_link', 'http://dogs.example-petstore.com/intro.html']); return false;"> See my pet store ... <form< span="">name="f" method="post" onsubmit="_gaq.push(['_linkByPost', this]);"></form<></a<> ```<a class="exw-control exw-collapsed">▸</a> **Traditional (ga.js) syntax** This configuration sets the domain name to the top-level domain for the blog site. In this way, if you later add any sub-domains for the blog site, that sub-domain will be able to share cookies with its parent and you will not need to set up special linked calls between them. However, you still must use the `_link()` and `_linkByPost()`methods for any form or links to `www.example-petstore.com`.
Tracking Across a Domain and Its Subdomains
As mentioned above, a default setup of Google Analytics is designed to track content and visitor data for a single domain, such as www.example.com. This means that even if you manage both a domain and a sub-domain, you must make modifications to the tracking code in order to share visitor data across both domains.
Suppose you have the following URLs that you want to track as a single entity:
www.example-petstore.com
dogs.example-petstore.com
cats.example-petstore.com
For this setup, you would use the following key customizations for the tracking code on all three domains.
<a class="exw-control exw-collapsed">▸</a>
Asynchronous syntax
<a class="exw-control exw-collapsed">▸</a>
Traditional (ga.js) syntax
You will not have to make any adjustments to the links or forms between these three sites, since they can all share the same cookies due to the fact that you set the domain name to the top-level domain (e.g.,
example-petstore.com
).Tracking Between a Domain and a Sub-Directory on Another Domain
Another common tracking scenario is to track visitor and traffic data between a single domain and a sub-directory of a different domain. This might occur when you want to track traffic between your website and your online blog, where your blog is limited to a sub-directory of the blog service. The follow example URLs each contain recommended customizations for the tracking code on both pages.
Main Website Domain: www.example.com
<a class="exw-control exw-expanded">▾</a>
Asynchronous syntax
... <a< span="">href="www.blog-hosting-service.com/myBlog" onclick="_gaq.push(['_link', 'www.blog-hosting-service.com/myBlog']); return false;"> View My Blog ... <form< span="">name="f" method="post" onsubmit="_gaq.push(['_linkByPost', this]);"></form<></a<>
<a class="exw-control exw-collapsed">▸</a>
Traditional (ga.js) syntax
Blog URL: www.blog-hosting-service.com/myBlog
<a class="exw-control exw-expanded">▾</a>
Asynchronous syntax
... <a< span="">href="www.example.com" onclick="_gaq.push(['_link', 'www.example.com']); return false;"> View My Site ... <form< span="">name="f" method="post" onsubmit="_gaq.push(['_linkByPost', this]);"></form<></a<>
<a class="exw-control exw-collapsed">▸</a>
Traditional (ga.js) syntax
For any form submission from
www.example-petstore.com
to the shopping cart website, you would use the_linkByPost()
method to copy traffic and visitor cookie data via HTTP POST to the shopping cart site. The_setAllowLinker()
method directs the target site to read cookie data from the POST data rather than from the regular user session information. In this way, you can pass cookie data set on one domain to another and thereby retain the visitor session from your online store to your shopping cart.Similarly, use the
_link()
function to transfer visitor data on any links going from the online store to the shopping cart.Tracking Across iFrames
In a site where the transfer between domains is done by opening a new window or by including content in an iFrame, you will need to to use the
_getLinkerUrl()
method to transfer visitor and campaign cookies from one domain to another. For example, suppose you include a form in an iFrame that is hosted onwww.my-example-iframecontent.com
. In order to transfer visitor information from the parent page that hosts the iFrame onwww.example-parent.com
, you would use JavaScript to load the iFrame and pass in the cookie information using the_getLinkerURL()
method.The following example illustrates only the linking function and assumes that cross-domain tracking is configured in the tracking snippets for both domains.
<a class="exw-control exw-collapsed">▸</a>
Asynchronous syntax
<a class="exw-control exw-collapsed">▸</a>
Traditional (ga.js) syntax
Configuring iFrame Tracking for Internet Explorer
iFramed content that is hosted in a separate domain from the parent page is regarded as third-party content. The default privacy setting for Internet Explorer 6 and above does not allow third-party websites to store cookies on the first-party site.
This means that Analytics tracking for iFramed pages requires special configuration in order to work in Internet Explorer. For the web pages that reside in the iFrame, you will need to configure privacy preferences. You can set up privacy preferences on the hosted pages by using one of the following methods:
- include a special "Platform for Privacy Preferences" (P3P) HTTP header for the included site's pages
- provide a P3P XML manifest for the included site's pages
For more information, see the following resources:
- P3P guides for webmasters:
- Cookies in Google Analytics
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
How To Stop Google's "Fetch & Render" From Showing Up In Google Analytics
Hi all, Within Google's "Fetch & Render" (found in Google Search Console) is the ability to index certain pages from my website on-demand. Unfortunately, every time I ask Google to index a page, it registers as a bounce in Google Analytics. Also, if it means anything, my website (www.knowtro.com) is a single-page application, functioning similarly to Google. If you guys know of any solution to this problem, please help! I originally thought that Google would know to block its own Fetch & Render crawler from Google Analytics but that doesn't seem to be the case. Thanks, Austin
Reporting & Analytics | | A_Krauss0 -
Google Analytics global page empty
Hello, I don't know what happened with my Google Analytics initial page. For around a week I have there all my websites, but they show no results on global page. If I enter on any property I can see everything as normal, just not on the initial page. Screenshot: http://imgur.com/JKFVIh4 For sure I changed anything that I shouldn't. Perhaps you know what's wrong? Thank you in advance.
Reporting & Analytics | | prozis0 -
Google Analytics Data
What tools can one use to audit a site to ensure that Google Analytics is capturing all the visits that we are getting? TIA Asif
Reporting & Analytics | | prsntsnh0 -
Google analytics settings
Hi I have GA installed, whaen I try to use Inpage Analytics, I get this message: We've identified problems in your setup. These may cause problems loading In-Page Analytics. Error: The Website in your settings (http://www.tvorba-logo-firmy.sk) redirects into a different domain. (http://tvorba-logo-firmy.sk). In-Page Analytics currently works on only one domain. Note that www.example.com and example.com are NOT considered to be on the same domain. Also, make sure you're not redirecting from http:// to https:// or vice versa My website is running on wordpress. Thanks for help.
Reporting & Analytics | | info_tipovanie-stavkovanie.com0 -
How to Setup New Domain in Webmaster Tools? Can Anybody HELP?
I, I have a new domain, and a new account is now created in webmatser tools. Is there anythings I should know about using or setting up webmaster tools? For example, the geographic target, I'm in Canada our web site, a local Pilates studio, is a commercial web site to provides informations about our services. Should I select Canada? One thing about this, I have another domain, http://www.furnacefilterscanada.com/ and in the setiing, I have select geographic target to: Canada. When using google.ca result are better then when using google.com! I think must Canadian user are using google.com Does this ''Geographic Target'' setting has anythings to do with search results in Goolge.ca versus Google.com? Thank you for your help, BigBlaze
Reporting & Analytics | | BigBlaze2050 -
Cover my tracks / two websites on the same Analytics
Hi, I've got 2 websites and I like one of them to make some links to the other one. These two sites are on the same Google Analytics account. They have been set up 3 month ago and they have some articles on them. I've heard that Google can see that those websites are related in my Analytics and use this information to give less power to the link I could make between them. What do think about it and what do you recommend me ? Shoud I closed the Analytics account ? Or down one of the website and rebuilt it whith a different domain / host / analytics ? The thing is if I delete one of the website i'll be force to republish the articles, because there are links on it, and they're part of a deal I've already made. Thank you
Reporting & Analytics | | Spleen0 -
Subdomains and SEO - Analytics & Webmaster Tools Setup Help
Any advice on the following greatly appreciated: How to get multiple subdomain data into 1 Google Analytics profile? Can we get multiple subdomain data into Google Webmaster Tools (and if so how?) or do we need to set GWT up per subdomain?
Reporting & Analytics | | AndyMacLean0 -
Google Analytics' Goals and Cold Fusion
We are having an issue tracking goal completions in GA with a cold fusion site. I would like to know if anyone as had similar issues and found a solution.
Reporting & Analytics | | JamesBarry0