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
-
Track buttons in Google Tag Manager
Hi! First question: I am wondering if it's possible to track two buttons with the same code in Google Tag Manager without changing the code? There are different page URL's.. Second one: My tags are displayed in Google Analytics as 'events'. When I put the events in 'goals', the number of times it fired differs from my events. Someone who can help me with this issue?
Reporting & Analytics | | conversal0 -
Techy - Google Analytics, Google & Code Expert
We are trying to find someone to join our company but are having a very difficult time. Does anyone have any suggestions about where to find someone like this?
Reporting & Analytics | | ColoradoMarketingTeam0 -
How to Configure & Tracking Images in Google Analytic?
Hello Experts, Can anyone tell me for my eCommerce site how to configure images tracking in google analytic? And where can I see the image traffic in google analytic? Not sure I am asking correct question but confuse about image traffic. Thanks! Wrights!
Reporting & Analytics | | wright3350 -
Do modal pop-ups impact the Google Analytics of the host page?
We have an instance of a page where visitors can click a button to start an interactive quiz. The quiz pops up in a modal window that references another domain (the interactive content provider). Will the person completing the quiz in the modal pop-up still be counted as an active visitor on the original host page during the time they are completing the quiz?
Reporting & Analytics | | MuhammadInc0 -
Are RSS fees tracked by Google Analytics?
In both the new GA and former version, how are RSS feeds handled by Google Analytics. If not, is there an easy means by which to account for this traffic, in order to have a better picture of traffic. Thanks. Alan
Reporting & Analytics | | ahw0 -
Google Analytics and Webmaster Tools Setup for Agencies
Hi, As agencies, what are people finding to be the best practices for allowing multiple members of the agency's team to access client WMT and GA data? Have a generic "analytics@myagency.com" account that's used for the shares, that anyone in the agency can use as needed (limited, of course, not admin). Have the individual person at the company use their company email for the share for each particular client? employee@agency.com. Yet what happens when we need someone else to check the GA or WMT data? Any advice is much appreciated.
Reporting & Analytics | | Titan552
Thank you!0 -
No option to connect to google analytics!
I figured it out had to click on the pencil icon. On GA looks like this http://orlandocouponsfree.com - http://orlandocouponsfree.comUA-9313894-1orlandocouponsfree.combut url is http://www.orlandocouponsfree.com/Is this an issue? When I tried to connect to google analytics yesterday. There was a connection issue with Moz & GA. I refreshed page hoping it would help. Now it won't let me choose domain. When I view campaign it says I should connect properties. [IMG]http://i.imgur.com/jkJ0ZdF.png[/IMG] I click link and get to this page which doesn't provide my an option. http://analytics.moz.com/settings/campaign/89561.117561 [IMG]http://i.imgur.com/jkJ0ZdF.png[/IMG]
Reporting & Analytics | | touristips0 -
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