Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Magento & Google Analytics eCommerce Tracking <<SOLVED>>
 
Domiyeah
Member
 
Total Posts:  33
Joined:  2008-10-22
 

j,

thx a lot!

dom wink

 
Magento Community Magento Community
Magento Community
Magento Community
 
Domiyeah
Member
 
Total Posts:  33
Joined:  2008-10-22
 

Hi all, hey j,

I am sry to bother you again but I didn’t get the tracking run again.

My Lines 180 - 182:

var _gaq = _gaq || []; _gaq.push(["_setAccount", ”’ . $this->getAccount() . ‘“]);
_gaq.push(["_trackPageview", “‘.$this->getPageName().’"]);
//]]>

The account number has to be enter in the backend, cache cleaned and I waited 2 days but tracking (for google analytics) did not start ;(

Thanks for any help.

Dom

 
Magento Community Magento Community
Magento Community
Magento Community
 
Lesiu
Member
 
Total Posts:  51
Joined:  2008-10-31
Poland
 

http://www.magentocommerce.com/boards/viewthread/77774/#t215469 just take a look at this reply

 
Magento Community Magento Community
Magento Community
Magento Community
 
MageOxy
Jr. Member
 
Avatar
Total Posts:  26
Joined:  2010-02-28
 
Lesiu - 26 February 2010 12:56 PM

http://www.magentocommerce.com/boards/viewthread/77774/#t215469 just take a look at this reply

Thanks a lot!

 
Magento Community Magento Community
Magento Community
Magento Community
 
pdatoon
Sr. Member
 
Total Posts:  107
Joined:  2008-10-22
 
Cubix Web Solutions - 13 November 2009 03:48 PM

I just installed eCommerce tracking on my Magento site. It works absolutely fine. Let me answer all questions together:

1. All Google Analytics code is already installed in Magento. You simply need to get the Account number from your google analytics account and install it in Magento. You can activate it by going to Admin Panel > System > Configuration > Google API > Google Analytics

2. Ecommerce tracking code is already built in into Magento. You just simply need to activate it in your google analytics account. No coding is required in Magento

3. You can even configure your website for Goal conversion where you can define a funnel and Order Completion as the goal. No additional coding is required for this.

4. You can even configure each section in the one page checkout to be a step in the funnel for goal conversion feature. So ‘billing address’ will be one step, ‘shipping address’ will be another next, ‘shipping method’ will be next step, ‘payment method’ will be next step, ‘order review’ will be next step and finally ‘order complete’ will be the goal completed step. That requires some additional coding in your opcheckout.js javascript file and needs your google analytics to be setup correctly..

I’m trying to figure out that Google Analytics thing. What does the account number look like?

Is it something like : UA-xxxxxxx or UA-xxxxxxx-x

Thank you for your help

 
Magento Community Magento Community
Magento Community
Magento Community
 
DitesVERT
Sr. Member
 
Avatar
Total Posts:  100
Joined:  2009-03-03
 

Yes, mine is UA-xxxxxxx-x.

I have the same problem, GA not working after upgrading from 1.3.2.4 to 1.4.0.1.

I have modified the suggested file. How long should it takes to see my stats back on track?

 
Magento Community Magento Community
Magento Community
Magento Community
 
a1anm
Guru
 
Total Posts:  318
Joined:  2009-10-08
 

I also have the same problem even after modifying ga.php.  Everything working fine apart from the e-commerce tracking.  This is the code getting output before my closing body tag:

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<
script type="text/javascript">
//<![CDATA[
    
var _gaq _gaq || [];
    
_gaq.push(["_setAccount""UA-2795368-10"]);
    
_gaq.push(["_trackPageview""/checkout/onepage/success/"]);

    (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';
        (
document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(ga);
    
})();
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
        <
script type="text/javascript">
//<![CDATA[
_gaq.push(["_addTrans","100000029","","10.0000","0.0000","0.0000","asa","","GB"]);
_gaq.push(["_addItem","100000029","12","Test Item","","10.0000","1.0000"]);
_gaq.push(["_trackTrans"]);
//]]></script></div>

I have turned ecommerce on in analytics.

 
Magento Community Magento Community
Magento Community
Magento Community
 
fzolee11
Jr. Member
 
Total Posts:  12
Joined:  2008-03-01
Massachusetts
 

Thanks Lesiu, this helped: http://www.magentocommerce.com/boards/viewthread/77774/#t215469

 
Magento Community Magento Community
Magento Community
Magento Community
 
capple_
Jr. Member
 
Total Posts:  17
Joined:  2008-04-02
 

With the below fixes:
1) add the missing declaration for _gaq in Ga.php
2) switch the analytics code to appear from “after_body_start” to “before_body_end” in layout/googleanalytics.xml

I can confirm that ecommerce tracking is now tracking transactions. Before, google analytics was not showing any transactions for us.

However, now that transactions are coming into google analytics, we are seeing that it is not showing all our orders. Out of say 10 orders that were placed in a day, only a few of them are in google analytics. We waited a few days to be sure that this isn’t an issue of google having a delay on processing analytics data.

Does anyone else have this problem? Is google analytics fully working for you with the above fix and you are seeing every single one of your orders in google analytics’s ecommerce transaction report?

If it is working for you, did you also do this step below?
- corrected the order of the 3 _gaq lines in Ga.php from below to above the function() that loads the ga.js asynchronously

I can’t figure out why some orders got through to google and some don’t. We never had this issue before we upgraded to 1.4.0.1.
We were on 1.3.1 and had Foomen’s google analytics extension, which worked perfectly for us.
Now with 1.4.0.1 and no GA extension, google is not tracking all our ecommerce transactions.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rickahontas
Member
 
Total Posts:  64
Joined:  2009-09-11
oakland, ca
 

Fix working for me! Here’s how the Ga.php code should look, FYI

<!-- BEGIN GOOGLE ANALYTICS CODE -->
<
script type="text/javascript">
//<![CDATA[
    
(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\';
        (
document.getElementsByTagName(\'head\')[0] || document.getElementsByTagName(\'body\')[0]).appendChild(ga);
    
})();
    var 
_gaq _gaq || [];
    
_gaq.push(["_setAccount""' . $this->getAccount() . '"]);
    
_gaq.push(["_trackPageview""'.$this->getPageName().'"]);
//]]>
</script>
<!-- END GOOGLE ANALYTICS CODE -->
 
Magento Community Magento Community
Magento Community
Magento Community
 
capple_
Jr. Member
 
Total Posts:  17
Joined:  2008-04-02
 

To the above poster, that’s what I have in Ga.php too but it isn’t tracking all transactions.

We would have 10 orders in magento, but ecommerce transaction report in GA will only say we have 2 transactions.
Somehow, some orders are not being tracked.

I cross referenced with Top Content report for the pageview count of the success page (which is where the ecommerce transaction codes would appear in) and I do see 10 page views for the success page.

So it seems normal GA tracking is working, just not fully for the ecommerce transactions.

 
Magento Community Magento Community
Magento Community
Magento Community
 
watou
Jr. Member
 
Total Posts:  1
Joined:  2010-02-27
 

I looked at the 1.4-trunk in svn a few minutes ago, and it appears that the only change from 1.4.0.1 is the insertion of the line

var _gaq _gaq || [];

The other advice about reordering the function and the _gaq push lines, and changing “after_body_start” to “before_body_end” in the XML are not reflected in the trunk code in svn.

So does this mean that the only code change to make Google Analytics work in 1.4.0.1 was this one variable declaration line?  GA lags enough that it’s hard to see what changes result in the proper outcome.

Regards,
John

 
Magento Community Magento Community
Magento Community
Magento Community
 
Sc0rp0w
Jr. Member
 
Total Posts:  9
Joined:  2010-02-15
 

Hello,

I have problems with Magento tracking transactions aspects. Every transaction info is incomplete: either it has delivery cost+total value+tax or number of items. I’m totally confused, by what may be causing that problem. The items amount isn’t that improtant, but the rest is annoing.

Regards,

 
Magento Community Magento Community
Magento Community
Magento Community
 
Etasker
Member
 
Total Posts:  54
Joined:  2008-07-17
Denmark
 

I’m running 1.4 - All transactions is still not being tracked.

The tracking code is suppose to be in the end for the head section.
See: http://code.google.com/intl/da/apis/analytics/docs/tracking/asyncTracking.html

Now i tried changing the
public_html/app/design/frontend/base/default/layout/googleanalytics.xml

To:
<default>
<!-- Mage_GoogleAnalytics -->
<reference name="head">
<block type="googleanalytics/ga" name="google_analytics" as="google_analytics" />
</reference>
</default>
</layout>

Looking forward to see the result of this.

Is anybody getting all transaction’s tracked?

 
Magento Community Magento Community
Magento Community
Magento Community
 
fragilem17
Member
 
Total Posts:  56
Joined:  2009-02-15
 

same problem here, added the

var _gaq = _gaq || [];

fix

some transactions are beign tracked in analytics ecommerce, but not all.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top