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
-
Google analytics
hello there, While Adding My website in Google Analytics,It is not Showing India Country in list. What i can do to add My account in it?? Have requested Google, But Got No response.any body can help please . Thanx in advance,
Reporting & Analytics | | iepl5
Falguni0 -
How to do Google Multivariate Testing via Google Tag Manager with Universal Analytic?
Hello All, How to do Google Multivariate Testing via Google Tag Manager with Universal Analytic? Thanks!
Reporting & Analytics | | dsouzac0 -
Google Analytics - Average Position
Hi Just trying to get some clarity on Google Analytics Average Positions in "Aquistions/Search Engine Optimisation". For a very competitive keyword Google Analytics is saying i am on average position of 6. Is this Page 6? I am assuming position six would be 1.6?
Reporting & Analytics | | Cocoonfxmedia0 -
Save a Google Analytics account
We recently started with a client who has Google Analytics already installed on their current site, but they have no idea the account login for it? Is there anyway to transfer ownership of this just based on the code?
Reporting & Analytics | | WillWatrous0 -
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 Internal Search Tracking Kaput :-(
Buongiorno from cloudy & overcast Wetherby UK... On this site http://www.dartexcoatings.com/ I configured Google to tracdk internal search & heres how - http://i216.photobucket.com/albums/cc53/zymurgy_bucket/internal-search-jinx_zpscf86b49d.jpg But internal search data is not pulling through 😞 How can i fix this please.
Reporting & Analytics | | Nightwing
Thanks,
David0 -
Why is Google Analytics showing index.php after every page URL?
Hi, My client's site has GA tracking code gathering correct data on the site, but the pages are listed in GA as having /index.php at the end of every URL, although this does not appear when you visit the site pages. Even if there is a redirect happening for site visitors, shouldn't GA be showing the pages as their redirect destination, i.e. the URL that visitors actually see? Could this discrepancy be adversely affecting my search performance? Example page: http://freshstarttax.com/innocent-spouse/ shows up in GA as http://freshstarttax.com/innocent-spouse/index.php thanks
Reporting & Analytics | | JMagary0 -
Need help setting up a Google analytics goal.
I'm just now getting my feet wet with the goals in GA. I'm trying to figure out how many visitors to a certain page, click on a certain link (which takes them no a certain page on my site.) What's the best way to go about this? Thanks.
Reporting & Analytics | | NoahsDad0