After upgrading from 1.4.2 to 1.5.1 my google analytics ecommerce tracking isnt working. Google tracks traffic, visitors, even goals… but the whole ecommerce section in google analytics isnt working…
I changed in googleanalytics.xml in my template, as Ive read on some threads here, it didnt change anything.
Then I created ga.php override according to this post: http://magentist.com/magento_help/magento-google-analytics-issues/
and yet, google analytics works, but the ecommerce tracking in analytics doesnt work.
When I make a purchase, source code of my success page gives this kind of code right before the body tag closing:
<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXXXX-X']);
_gaq.push(['_trackPageview']);
_gaq.push(["_setDomainName", "www.mydomain.comindex.php"]);
_gaq.push(["_setAllowHash", false]);
(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>
<!-- END GOOGLE ANALYTICS CODE --> </div>
If you notice it, the forward slash is missing before the index.php
_gaq.push(["_setDomainName", "www.mydomain.comindex.php"]);
I dont know maybe thats the problem, can anyone tell me please how to fix it?
I tried all the solutions I found in google without any success : ((
Here is how function looks like in my ga.php override:
<!-- BEGIN GOOGLE ANALYTICS CODE -->
<script type="text/javascript">
//<![CDATA[
var _gaq = _gaq || [];
' . $this->_getPageTrackingCode($accountId) . '
_gaq.push(["_setDomainName", "' . $this->getDomainName() . '"]);
_gaq.push(["_setAllowHash", false]);
' . $this->_getOrdersTrackingCode() . '
(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>
<!-- END GOOGLE ANALYTICS CODE -->
I hope there is a solution for this.
Thank you in advance : ))
Ok, just in case anyone else will have a problem like mine...
I tried all the solutions I found online without any luck... Today I just had to install another checkout extension ( I used "One Step Checkout" before and it had problems ) and now google tracks ecommerce transactions too...
so, if you'll have a problem like me, make sure the extension doesnt have any problems...
good luck! : ))