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
-
Unsolved Google Analytics (GA4) recommendations for SEO analysis?
Guides on Moz and elsewhere mostly refer to Google Analytics' Universal Analytics (UA). However, UA is being replaced with GA4, and the interface, options, and reporting are very different. Can you recommend a clear, thorough, and effective walkthrough of how to set up useful SEO reports in GA4? Is there a simple tool you recommend that will help connect historical data from UA to GA4 when GA4 is the only option available? If there's no simple tool, what values do you recommend retaining from UA for effective historical reporting? How would you use them? At minimum for reporting, I'd want to show month-to-month changes and year-to-year changes (in percentages and in real numbers) for the following: all site visits all organic visits organic visits as a percentage of all site visits organic visits that led to a specific goal completion organic visits that led to any goal completion Thanks in advance for your help!
Reporting & Analytics | | Kevin_P1 -
Google Analytics not Working on all pages despite many attempts
Hey gang, So this problem has been going on for months. None of our landing pages track, but all of our blog pages do. I've tried GA plugins, (we are on wordpress) and just now even put the code in the theme header script. Still to no avail. I just checked right now, and the blog pages have the global GA code, but now I noticed not even the home page has the code! Could it be something to do with my theme? I tried to pay a guy on upwork to fix but he couldn't fix it either. Thank you for you help!
Reporting & Analytics | | Meier0 -
How do I exclude fake direct load traffic from networks in Google Analytics?
Starting on Friday 1/20, we noticed a huge, unnatural spike in Direct Load traffic. While researching where it was coming from, the big flags were huge spikes in countries that normally only have <5 sessions a month like Russia, Singapore, Brazil, etc., each sending 1400 a week, with >99% bounce rate and <0:00:05 average session duration. While looking into networks, we saw an influx in Networks that had never sent traffic before, each with >1300 sessions a week, 100% bounce rate, and 0:00:00 session duration. The list of these Networks are: astute hosting usa incorporated
Reporting & Analytics | | ServiceMichael
nephoscale inc.
network transit holdings llc
serverbeach
coreix ltd
2ezhost llp
nforce entertainment b.v.
mir telematiki ltd
servers australia pty ltd wholesale services provider for abuse
reliablehosting
dimenoc servicos de informatica ltda
c0715718213 I have seen a lot of guides of filtering out Referral traffic, but these are all coming in as Direct Load and are skewing our Direct Load results. Any idea how to filter or remove this traffic from Google Analytics?0 -
Google Shopping tracking as organic traffic - help!
Hey guys, I have an eCommerce client who sometimes runs Google PLA and Google Shopping campaigns. However, we don't run his AdWords for him, just do his SEO. At the moment, the Shopping campaigns track as organic traffic within Analytics. And I can't see any way to change this! It's so infuriating. How do I change this? Thanks!
Reporting & Analytics | | jasarrow0 -
Google Analytics Content Experiments
Has anyone else found that Google Analytics Content Experiments seems to quite quickly favor the best performing variant in an experiment, and then show that variant many times more often than other/s - not split the traffic evenly? What is Google's thinking behind 'optimizing' during an experiment? It seems odd to me.
Reporting & Analytics | | David_ODonnell0 -
How can I verify if someone is Google Analytics certified?
I am looking to hire an IC to help with analytics. I need to know how I can verify if they are GA certified. They gave me a link to a http://www.starttest.com profile. Is that legit?
Reporting & Analytics | | inhouseseo0 -
Looking for a Google Analytics expert
Looking to hire a Google Analytics expert for a project. Dealing with trying to track traffic across multiple domains and then work with the Ecommerce options. Contact Jeff Logan @ Avelient with costs and time frame for work. [personal information removed by editors. please contact via private message system to exchange information]
Reporting & Analytics | | Avelient0