Support » Plugins and Hacks » Cookie Domain Error with Google Analytics Experiments

Cookie Domain Error with Google Analytics Experiments

  • I have manually added Google Analytics Experiment code to my website, which is in addition to the Yoast-generated Google Analytics tracking code. When verifying the experiment code within Google Analytics, I get the following error:

    “Experiment code missing the cookie domain name declared in tracking code”

    However, I can’t seem to find any domain name declared in the tracking code, which I’ve copied below (with an anonymized GA ID):

    <script type="text/javascript">//<![CDATA[
    			// Google Analytics for WordPress by Yoast v4.2.7 | http://yoast.com/wordpress/google-analytics/
    			var _gaq = _gaq || [];
    			_gaq.push(['_setAccount', 'UA-XXXXXXXX-1']);
    			(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);

    Any idea how to resolve the experiment code error?



Viewing 2 replies - 1 through 2 (of 2 total)
  • Have you managed to resolve this issue? I am facing the same thing!

    Hey nikoza, I have managed to resolved this. Turns out the analytics code was being added to the site twice, once by Yoast and a second time by my Pagelines theme. One instance had the cookie domain declared and the other didn’t. This is what was confusing the experiment code. I hope this helps.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Cookie Domain Error with Google Analytics Experiments’ is closed to new replies.