问题
First of all let me quickly run-down my setup for you. We have multiple domains and for that reason I use tracking code which sends the traffic to 2 different profiles at the same time. One profile tracks that specific domain, and the other is a multi-domain profile which collects data from all the domains. This is what the tracking code looks like for the pages on my domain. The UA-XXXXX-11 is the multi-domain account:
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-1']);
_gaq.push(['_setDomainName', 'none']);
_gaq.push(['_trackPageview']);
_gaq.push(['t2._setAccount', 'UA-XXXXX-11']);
_gaq.push(['t2._setDomainName', 'none']);
_gaq.push(['t2._setAllowLinker', true]);
_gaq.push(['t2._setAllowHash', false]);
_gaq.push(['t2._trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
My problem is that I want to use the Content Experiments function in GA, but I'm not getting any data. First I tried setting the experiments up inside the multi-domain account. Everything validated perfectly, and the page-switch functionality works It also parses utm_expid and utm_referrer to the URL, so it seemed to be working. However no data showed up for 8 days.
So I read up on what the problem might be and found (here: https://productforums.google.com/forum/?fromgroups#!topic/analytics/9ogbbQPZFpk) that people were experiencing the same problem when using setAllowLinker and setAllowHash.
I removed those methods from the regular profile's tracking code (the UA-XXXXX-1 above. It used to have SetAllowLinker and SetAllowHash aswell) and set up a new content experiment. This time not in the multi-domain profile but in the regular one.
Again, everything validated perfectly, the page-switching is working, and it's parsing utm_expid and utm_referrer to the URL.
However, I've waited a bit more than 20 hours now and I'm still not seeing any visits in the experiments. It says "Collecting data", and says "20 hours of data", "0 visits".
What is causing this? My only thought now is that the t2.-methods for the multi-domain profile might be screwing this up. This seems unlikely though as these methods have totally different names than the methods called by the regular profile. That profile shouldn't even notice that those are being used for the multi-domain profile, right?
回答1:
So i managed to finally find some info regarding this.
If you're using setDomainName, setAllowHash false, and/or setCookiePath you'll need some extra code just before the Experiments code.
_setDomainName('example.com'); requires _udn="example.com";
_setAllowHash(false); requires _uhash="off";
_setCookiePath('/'); requires _utcp="/";
This should be added just before the Google Analytics Experiment code as such:
<script>
_udn = "example.com";
</script>
<!-- Google Analytics Experiment code -->
... Contents of the experiment code ...
<!-- End of Google Analytics Experiment code -->
Hope this helps someone else.
Source: http://support.google.com/analytics/bin/answer.py?hl=en&answer=2658141
来源:https://stackoverflow.com/questions/11537051/why-arent-results-from-google-analytics-content-experiments-showing