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
-
Was Google Analytics and Adsense Down Today?
For the last 4 hours of so we were registering zero users and Adsense reporting has not changed. We checked the site, and there were no problems. It seems for some reason there was no reporting. Just now it came back up and we are showing live traffic. Trying to figure out if this was a problem specific to us or if it is on Google's end. Thanks,
Reporting & Analytics | | akin670 -
I have conflicting user flow and bounce rates Google Analytics
Has anyone come across this or know how to read this data. In my site content landing page report I have 141 sessions at 0.71% bounce rate = 1 session But then in user flow I have the same page with 123 sessions with a drop off of 117 sessions???
Reporting & Analytics | | Lucas_SOS0 -
How to FILTER in Google Analytics an ad campaign from linkedin?
Hi mozzers We are setting up an a linkedin ad campaign for our agency and want to track its traffic and conversions. The linkedin ad will carry UTMs for each link. For tracking this campaign accurately I thought about creating a new GA View with a specific filter. So my question is about the filtering, should i use the INCLUDE, REFERRAL with pattern LINKEDIN.COM (see image)? if not what would be the best way to track this campaign? My other concern is that we are also running other a job ad on linkedin and I feel these hits will be tracked as well. Is there a way to separate those 2 campaigns? Thanks guys! MzE5hqE.png
Reporting & Analytics | | Ideas-Money-Art0 -
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 -
Google Analytics-Unique visitors?
Does organic search data show unique visitors or all visits? For example, if someone ( a single person) visits my site multiple times after searching the same keyword phrase, does that show in my analytics data as 1 hit from that keyword, or all hits? Thanks!
Reporting & Analytics | | RickyShockley0 -
What's the final word on Image Search tracking in Google Analytics?
Sorry if this has been answered but I can't seem to get a straight answer to my questions by searching around. How is traffic referred by Google Images counted in Google Analytics? I know it used to be referral traffic from google.com/imgres. A lot of things I have read say that it should all be under google/organic now, but my site still gets referral traffic from google.com/imgres, so that can't be. However I also get traffic as google/organic that I am pretty sure is from image search, because we don't rank for the keyword normally, but we do for image search. What's the deal? How is traffic from an embedded image in a regular result page counted? How can I segment my image search traffic better? It would be great to see image search traffic as it's own medium. I found a script here -- http://jrom.net/google-images-in-google-analytics -- that looks promising, has anyone used it or can recommend another way? I haven't used the GA API very much so I want to make sure the script is kosher and won't screw up my numbers.
Reporting & Analytics | | tact0 -
Alternatives for google analytics multi account dashboard overview
Hi there, I like the new Google Analytics layout don't get me wrong but I really miss the old possibility to have a quick overview of all your accounts. Does anyone know an alternative for this? Please share your experiences and recommendations.
Reporting & Analytics | | Robbern0 -
Does using Google URL Builder override original source in Google Analytics?
During a free trial on Tatango, we send daily emails to customers to give them advice, resources, etc. We started using Google URL Builder http://www.google.com/support/analytics/bin/answer.py?answer=55578 to create individual links in each of these emails, but when the customer purchases a subscription now, the source in GA isn't Google, Facebook, Twitter, etc. they are all showing up as the source we created using the URL builder for each email. Does Google URL builder override the original source in Google Analytic?
Reporting & Analytics | | Tatango0