Magento Forum

   
Page 5 of 5
Magento & Google Analytics eCommerce Tracking <<SOLVED>>
 
betterbatt
Member
 
Total Posts:  53
Joined:  2009-09-16
 

I just want to post here for anyone else using Magento 1.4.0.1 who hasn’t been able to get their Google Analytics eccomerce tracking to work that Dave B’s instructions earlier fixed the issue for us and we are now tracking ALL transactions:

For us we changed these four files:

/app/code/core/Mage/GoogleAnalytics/Block/Ga.php
/app/code/core/Mage/GoogleAnalytics/Model/Observer.php
/app/code/core/Mage/GoogleAnalytics/etc/system.xml
/app/design/frontend/base/default/layout/googleanalytics.xml

/Block/Ga.php adds the missing line:

var _gaq = _gaq || [];

/Model/Observer.php swaps line 59:

$analyticsBlock->setQuote($quote);

for:

if ($quoteId == $quote->getId()) {
$analyticsBlock->setQuote($quote);
} else {
$analyticsBlock->setQuote($quoteId);
}

/etc/system.xml just capitalises the ‘N’ in ‘Account number’ in the backend.

/app/design/frontend/base/default/layout/googleanalytics.xml changes the line:

name="after_body_start"

to:

name="before_body_end"

Liam

 
Magento Community Magento Community
Magento Community
Magento Community
 
easyteach
Member
 
Total Posts:  43
Joined:  2009-12-17
 

I’ve tried everything here so far.  Google Analytics is tracking all Paypal transactions but it’s not tracking Google Checkout transactions.

I’m not sure if perhaps checkout is mis configured or analytics.  My store does everything off a guest checkout only.

Running 1.4.1.1

 
Magento Community Magento Community
Magento Community
Magento Community
 
betterbatt
Member
 
Total Posts:  53
Joined:  2009-09-16
 
sayersteach - 10 September 2010 11:04 AM

I’ve tried everything here so far.  Google Analytics is tracking all Paypal transactions but it’s not tracking Google Checkout transactions.

I’m not sure if perhaps checkout is mis configured or analytics.  My store does everything off a guest checkout only.

Running 1.4.1.1

We don’t use Google Checkout so not sure on this

 
Magento Community Magento Community
Magento Community
Magento Community
 
haboo
Jr. Member
 
Total Posts:  4
Joined:  2010-09-12
 

That is a problem for sure. I have the same problem for a customer of mine.  GA is only tracking Paypal transactions confused

Webdesign Amsterdam

 
Magento Community Magento Community
Magento Community
Magento Community
 
Magento Knight
Member
 
Total Posts:  40
Joined:  2010-03-04
 

As is mentioned by the above poster, the current implementation of Google Checkout in Magento does not track Google Checkout purchases correctly. This is because the code for the Google Checkout button in link.phtml, which controls the onsubmit Javascript action, was not updated with the rest of the fix. Please check the following page, where I found my answer:

http://www.google.com/support/forum/p/checkout-merchants/thread?tid=59ca8c598fccc456&hl;=en

You will need to replace the code inside onSubmit with

_gaq.push(function() {var pageTracker = _gaq._getAsyncTracker();setUrchinInputCode(pageTracker);});

Let me know if this helps.

 
Magento Community Magento Community
Magento Community
Magento Community
 
haboo
Jr. Member
 
Total Posts:  4
Joined:  2010-09-12
 

Thank you very much for this information. I will go through it grin

 
Magento Community Magento Community
Magento Community
Magento Community
 
easyteach
Member
 
Total Posts:  43
Joined:  2009-12-17
 

Thank you for finding the link on the google checkout forum.

While trying to implement a fix in Ga.php I notice there is no On Submit area as implemented with Magento.

Thinking of adding the line

_gaq.push(function() {var pageTracker = _gaq._getAsyncTracker();setUrchinInputCode(pageTracker);});

Right under the the other 2 lines that have _gaq.push

Which would be line # 184 for the Ga.php that my site uses.

But thats just a guess…

Any other ideas are appreciated.

 
Magento Community Magento Community
Magento Community
Magento Community
 
easyteach
Member
 
Total Posts:  43
Joined:  2009-12-17
 

Just noticed that in the Magento SVN the Alpha for Ga.php is different than the current 1.4.1 trunk
Alpha:
http://svn.magentocommerce.com/source/branches/1.4-trunk

Stable:
http://svn.magentocommerce.com/source/branches/1.4

http://www.magentocommerce.com/svn

The alpha Ga.php is at

http://svn.magentocommerce.com/source/branches/1.4-trunk/app/code/core/Mage/GoogleAnalytics/Block/Ga.php

And stable is at

http://svn.magentocommerce.com/source/branches/1.4/app/code/core/Mage/GoogleAnalytics/Block/Ga.php

Do not know if this address the issue of tracking checkout but I’m going to look into this also.  Hopefully all will be fixed with next release.

 
Magento Community Magento Community
Magento Community
Magento Community
 
tawtaw
Jr. Member
 
Total Posts:  3
Joined:  2010-09-21
 

Oh my god I found treasure, thank you for this informations

 
Magento Community Magento Community
Magento Community
Magento Community
 
billymarwadi
Jr. Member
 
Total Posts:  11
Joined:  2010-09-19
 

If this is not there in the source file means you have broken the Google analytics code. If this is there, means you have not correctly configured google analytics. If you have configured Google analytics correctly then you need a developer to sort this puzzle!

 
Magento Community Magento Community
Magento Community
Magento Community
 
jabbaw
Jr. Member
 
Total Posts:  1
Joined:  2010-09-24
 

What do you mean by broken the GA code? Do you mean broken the piece of Javascript code that needs to be insterted into a webpage?

________________________________________________________-

Jan Bun

 
Magento Community Magento Community
Magento Community
Magento Community
 
yulin236
Jr. Member
 
Total Posts:  11
Joined:  2009-10-25
 

I encountered maybe same issue that related to js, but not actually what you mentioned. The problem is when I put anything tracking code that including js to the footer of my site, it won\’t work. My Google Analytics won\’t work properly either, it only shows a few actual visitors a day, when I tracking from sitemeter, I actually get a few hundred visitors everyday . So I guess the reason is the js code is not recognized by the footer part, but I have no idea to figure it out and fix it. I installed live zilla, it can\’t even tracking visitors. The version I used is 1.4.0.1, I was known that there might be some bug with this version. Anyone encountered same issue before? Much appreciated if can share it with me.

 
Magento Community Magento Community
Magento Community
Magento Community
 
rossko
Jr. Member
 
Total Posts:  5
Joined:  2010-05-05
 

Ahhhh this is soo frustrating…

I have changed these files countless times and no eccomerce tracking..

I too have my code in the head because when i tried it in the footer it missed out information in the analytics.

 
Magento Community Magento Community
Magento Community
Magento Community
 
ShragiL
Jr. Member
 
Avatar
Total Posts:  25
Joined:  2009-02-10
Manchester, UK
 

]Hi all, Hello Sayersteach

Have you been successful in tracking Google Checkout transactions with these modifications?

sayersteach - 18 September 2010 04:35 PM

Thank you for finding the link on the google checkout forum.

While trying to implement a fix in Ga.php I notice there is no On Submit area as implemented with Magento.

Thinking of adding the line

_gaq.push(function() {var pageTracker = _gaq._getAsyncTracker();setUrchinInputCode(pageTracker);});

Right under the the other 2 lines that have _gaq.push

Which would be line # 184 for the Ga.php that my site uses.

But thats just a guess…

Any other ideas are appreciated.

sayersteach - 18 September 2010 04:44 PM

Just noticed that in the Magento SVN the Alpha for Ga.php is different than the current 1.4.1 trunk
Alpha:
http://svn.magentocommerce.com/source/branches/1.4-trunk

Stable:
http://svn.magentocommerce.com/source/branches/1.4

http://www.magentocommerce.com/svn

The alpha Ga.php is at

http://svn.magentocommerce.com/source/branches/1.4-trunk/app/code/core/Mage/GoogleAnalytics/Block/Ga.php

And stable is at

http://svn.magentocommerce.com/source/branches/1.4/app/code/core/Mage/GoogleAnalytics/Block/Ga.php

Do not know if this address the issue of tracking checkout but I’m going to look into this also. Hopefully all will be fixed with next release.

If yes would you kindly give a step-by-step guide to the novices how to implement these changes in Magento.

Thanks

Shragi

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top
Page 5 of 5