Why does Google Analytics cross-domain tracking across an iframe require tracking snippets in both domains? - google-analytics

I'm creating a shareable widget, for anyone to copy onto their website. The shareable piece of code is an frame that points to the actual widget that lives on our hosted site (i.e. ourdomain.com). If we ever want to tweak the actual widget, we can do so in one place, with no effect on the iframes pointing to it from other sites we have no control over.
I tried the approach of cross domain tracking. While I was analyzing the results, I observed that the path of the shared widget code (not on our domain) appears within the content view in GA. This runs counter to a response from my previous post "if it is being inserted into many domains you are going to need to set up multiple GA accounts and use different account numbers per user."
Correct me if I am wrong: Any tracking code using our unique account id will appear in our GA by default, no matter where it's hosted, whether the code is implementing cross domain tracking or not.
http://www.google.com/support/forum/p/Google+Analytics/thread?tid=6af5b4c3e30c71be&hl=en
Since any page that hosts GA tracking code shows up in our content view, I could locate where the widget is being viewed by simply looking for all pages whose name did not include ourdomain.com. Of course this includes proxy servers as well, but I was going to also include a custom variable so I could implement a filter based on the custom variable.
So explain to me where this breaks down or what I'm missing here. Is there some amount of data I am losing here because the GA cookie is not in fact being utilized? Give me a good reason why I should put in the effort to fully implement cross domain tracking, including the necessary P3P implementation on our server for IE visitors.
As a sidenote, I am considering adding GA tracking code with an event tracker within the widget itself to track when people actually USE the widget (as distinct from the when the widget is loaded). I understand that by not implementing cross domain tracking I would not be able to obtain any data about the visitor, only whether the widget was acted upon or not.

As the referring site is the primary bit of information we need,
I'm going to pass the referrer in the URL that loads the iframe content
and then overide the referrer within the tracking code
_gaq.push(['_setReferrerOverride',ht_referrer]);
as documented here:
http://www.prusak.com/google-analytics-referrer-override/
This way, I don't need to inject tracking code into my widget, just some JavaScript that adds the referrer to the URL that loads the iframe.
Wish me luck.

Related

GA Cross Domain Tracking for subfolders with different UA-ID

Our site is broken down into 4 main subfolders lets say www.site.com/a/, www.site.com/b/, www.site.com/c/ and www.site.com/d/.
Each of those subfolders has a different Google Analytics tracking account because we treat those subfolders as different divisions.
We want to be able to track clicks from www.site.com/a/mypage.html to www.site.com/b/yourpage.html.
Because they have different tracking codes the clicks between divisions don't carry over between GA accounts. So when the page www.site.com/b/yourpage.html has stats the referrer is {not set} and the previous page path is set to {entrance}, even though they should be www.site.com/a/mypage.html.
It was suggested, during the creation of our GA accounts to put our domain site.com in the Referral Exclusion List to avoid new sessions being created but I'm wondering if this is what is causing the clicks to not detect the previous page or referrer page, because we are excluding it.
Can anyone help me figure out how I am going to track these stats?
Is using cross domain tracking an option, even though we're not changing domains?
Any help on this will be a big help. TIA
The exclusion from the referral is certainly what makes the direct traffic result, however it is correct that it is set like this. The main problem is that track the same site by dividing the sections into 4 different Analytics Properties is not a good practice.
Cross-domain tracking will not work because they are different Properties (unless you have GA360).
However you can get what you need by using the UTMs parameters on the links, for example for a link from site A to site B you will have to write the URL of the link like this:
www.site.com/b/yourpage.html?utm_source=fromA&utm_medium=referral
In reports you will see these values ​​in referral channel with the defined source instead of direct traffic.

I'm unable to run experiments accross subdomains using Universal Analytics

I'm currently running an experiment without redirect, using Google Analytics, but I'm running in some issues.
The case
I work for a company that has two websites, with two separate brands, selling the same product. Today, we are plaining a merge of the brands, one of the reasons being the low costs of maintanance.
To see how this would affect sales, we are doing an a/b test. The test consists of changing the logo of the sites, and displaying an information about the merge of brands in the variant. The original is the website without changes.
We have some requirements to do it:
We use a CMS that has no support to the Google Analytics Experiment tag (we get some errors when we install it to the , and are unable to run it)
We need to run it through all pages of our websites. We have also a subdomain in each site, that the user is redirected to place an order.
We doesn't have time to wait for the experiment to end for itself. So, we came up with the idea to track the rejection and sales using a duplicate pageview with "/variant" in the url and in the title.
To do that, I used the Content Experiments without redirects, with the Google Tag Manager.
Configuration of the Experiment
In Google Tag Manager, I load the Content Experiment Javascript API and define the choosenVariation variable in all pages of both websites and subdirectories.
I track the "gtm.load" event, to see when the page finished loading all elements and change the DOM in three ways: changing the logo, adding the content about the merge and add an item to the main menu. All of this, through Javascript.
Along with the changes of the DOM, I add a datalayer called VirtualPageView, and pass the corresponding url with "/variant" and the title with "Variant".
When the datalayer fires, I send a new Pageview with the variant information.
The problem
The experiment is running right, but when a user gets the B variant of the experiment and procceed to a subdomain of our websites to place an order, it seems that it's somehow running another test, and happens to the user get the A variation.
We are trying to persist the original session and the client Id through the domain and subdomain, in order to the user that saw the different logo, continue in his way to order.
I saw this page about Running Experiments across Subdomains, but its about the Classic Analytics and the classic experiment, and we are using the Universal Analytics with the Content Experiment without redirects.
I don't know if my explanation was clear enough, so if someone have doubts, please ask me. I don't have a profound knowledge of Google Analytics or the Content Experiments either. So, if you have a better way to do this, please, tell me.
I came up with a solution to our problem. We agreed to use the experiment only in the pages of the main domain, so I can change the content otherwise in the pages of the subdomain:
When a user visits our main domain, through Google Tag Manager, I created a cookie that says what the result of the variation chosen for the user (0 for the original and 1 for the variation).
When this user goes to our subdomain to place an order, still via GTM I check the cookie to see its value. If its equal to 1 (a variation), I change the logo and the menu, according to our previous configuration, and I send a virtual pageview to help us check the data.
Until now, this is working properly.

GTM / GA: Cross-Domain Tracking (VIEWS & GOALS)

Situation: I have used Google Tag Manager to set up Google Analytics (GA - Universal) on a multisite network. There is one GTM container, and each website has its own GA property. I used a GTM variable to reference all of the GA properties. I am able to track cross-domain sessions. In testing, I am able to follow a user's session across multiple domains under the same session / client ID.
Problem: I'm stuck with what to do next. I'd like to create some Goals and Views that track a user's journey through my sites and measure the usual stats (bounce, drop-off points conversions, etc.). However, I'm not sure where to begin. I see plenty of information on the Internet for how to set up cross-domain GA tags in GTM. However, I don't see anything out there for how to create Views and Goals for cross-domain setups. A few questions that come to mind are:
Do I create Goals in the destination site's GA account (e.g. mycheckout.com), or the site where the session begins (e.g. myproductinfo.com)?
When creating Goals, do I only use the permalink slug, or the entire link? I thought I could only add the permalink.
How does this information roll up into one report?
I found this link, but I'm not sure if it's the 'best practice'. I would greatly appreciate it if someone who has previously implemented this could provide an outline of best practices, or a link to a good tutorial on the subject.
Thanks for your help!
Chris
You need to understand GA definition of Views and Properties. Views are like database table views: you can either show the whole table or a sample of it.
To have all data collected without sampling a "Raw Data" view (no filters) should always be used. Each view has its own conversion goal definitions. So in the "Raw Data" view you can create a goal for any page tracked. If you filter a view for one domain (e.g. "confirmation.com View with appropriate filters"), only goals for this domain should be created (otherwise they will never count a conversion).
When creating goals you can define filters for the "ga:pagePath" parameter. So it depends on your GA tracking setup, what part of the URL it tracks. Go into chrome web developer toolbar and hit the "network" tab. Open your page in this tab. Then search for requests ending with "collect", these are the data trackpoints send to GA. There you can debug what URL information is sent to GA (search for the "dl" parameter within the query string parameters list).

Preventing an iframe on the same domain from triggering a page exit in Google Analytics

I am working on a third party website that contains a web application embedded in an iframe on the home page. This iframe is hosted on the same same sub/domain.
Currently page views are being tracked with _trackPageview. Due to a requirement by marketing both pages use the same Google account Id.
Since the iFrame was implemented the marketing department has noticed that the bounce rate has dropped to almost nothing. I suspect that this is because Google is interpreting the pageView event on the iframe as the visitor hitting another page on the website.
Just for additional information, the domain of the _gaq object is being set to "none" for both the container page and iframe.
Does Google provide a mechanism by which you can trigger PageView in such a way that it isn't interpreted as subsequent pageview in this scenario? (I know that trackEvent has a noninteraction property to deal with this?)
Am I better off just disabling the PageView for the default iframe page?
Does Google provide a mechanism - apparently yes, but probably not for your use case.
The field documentation for Universal Analytics describes the non-interaction field thusly:
Specifies that a hit be considered non-interactive.
So in UA this does no seem limited to events but to apply to all hits (which would include pageviews). I want to point out that I have no tested it and that it seems counterintutive, so it might simply be that the documentation is incomplete/wrong here.
However as you are using "classical" Analytics this does not apply to you. Since upgrading the code is a good idea in any case you might want to push for an update to Universal Analytics (this piqued my curiosity so I will test this over the next few days and update this answer with the results - maybe you want to wait until then, or simply test it yourself).
It's possible, but not 100% clear to me that disabling the PageView event on the iframe will prevent your users from registering a page exit (the pageview may get recorded regardless). You can try removing that event and see if it works.
But a better way may be to implement a custom filter on a new View excluding traffic to that specific class of iframes. Make sure you keep your old View (or create a new one with further filters) to make sure you're capturing those iframe views, if you think that's necessary.

Google analytics showing hundreds of views for page that doesn't exist

I recently signed up for a google analytics account in anticipation of a new site I'm putting together. The site has not been published, and the tracking script has not been put in the code yet.
Somehow after logging back in to grab the tracking code, it's showing I've already had 275 views in the past month. How is this possible???
These are very likely ghost referrals sent by spammers targeting random GA property IDs (which explains why you see them even before your Web site is live). Since you are setting up a new site, probably the easiest way to get rid of them is to create a new Web property so that you get an ID not ending with -1. The reason is that this type of spam is only targeted at the first property in an account.
If you want to get more information about how referrer spam works and alternative solutions to eliminate it, here is an article I wrote some time ago:
http://veithen.github.io/2015/01/21/referrer-spam.html

Resources