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

Page 2 of 5
Magento & Google Analytics eCommerce Tracking <<SOLVED>>
 
Cubix WS
Guru
 
Avatar
Total Posts:  318
Joined:  2009-07-01
LondON, United Kingdom
 

@ pilare

Have u activated the eCommerce tracking feature in google analytics (on the analytics site and not ur magento site)?

There is an option in the google analytics setting which says that ‘This website is ecommerce website’. You need to activate that and wait for a day or two for the results to show up… You’ll notice that you’ll get to see the eCommerce tracking from even before your the day you activated Ecommerce tracking in Google analytics. This is because Magento has been sending data to google analytics all this while, just that you don’t switch on the Ecommerce tracking reports…

I hope it makes sense.. If not then let me know which parts you didn’t understand and I’ll explaining again..

 
Magento Community Magento Community
Magento Community
Magento Community
 
dustin-sparks
Jr. Member
 
Total Posts:  4
Joined:  2008-04-21
 

Hi Cubix Web Solutions,

I have the Google Analytics setup on my Magento installation http://whispersandroses.com/store and the Analytics are tracking fine but no ecommerce tracking.  I have the analytics settings enabled for ecommerce and see the data being tracked for everything EXCEPT ecommerce (No Sales, no transactions etc)

If it helps I have Magento ver. 1.3.2.4, I am writing you as you seem to have it working and maybe (hopefully) I am missing something simple as I have used GA for years and Magento for only about a year.

Thanks for your time,
-Dustin

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..

 
Magento Community Magento Community
Magento Community
Magento Community
 
Template fans
Guru
 
Total Posts:  446
Joined:  2009-11-02
 

Good resolution.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Cubix WS
Guru
 
Avatar
Total Posts:  318
Joined:  2009-07-01
LondON, United Kingdom
 

Hi Dustin

As I said earlier, Magento already has Google ANalytics ecommerce tracking built in on the success page and works by default.

Since yours is not working, the only possibility is that
1. Google analytics is not set up correctly. You mentioned it is already set up correctly.
2. Some code must have been changed by you on the success page which has broken this functionality

To check whether the functionality has been broken or not,
1. Buy a product which will lead to your site’s success page, which I presume must be http://whisphersandroses.com/store/checkout/onepage/success/
2. VIew the source of the success page and at the bottom of the source file, check whether google analytics ecommerce tracking code is available or not. As an example, this might be there on the source of the success page of a lens selling website:

<script type="text/javascript">
//<![CDATA[
pageTracker._addTrans("100000346","","450.7440","0.0000","0.0000","London","London","GB");
pageTracker._addItem("100000346","CPMPSB","Complete Multi-Purpose Solution","","14.2125","4.0000");
pageTracker._addItem("100000346","FCDP30-BC8.7-DI14.0-PO-4.50","Focus Dailies AquaComfort Plus","","0.4722","360.0000");
pageTracker._addItem("100000346","FCDP30-BC8.7-DI14.0-PO-3.50","Focus Dailies AquaComfort Plus","","0.4722","360.0000");
pageTracker._addItem("100000346","FCDL30-BC8.6-DI13.8-PO-4.00","Focus Dailies All Day Comfort","","0.2997","90.0000");
pageTracker._addItem("100000346","FCDL30-BC8.6-DI13.8-PO-2.25","Focus Dailies All Day Comfort","","0.2997","90.0000");
pageTracker._trackTrans();
//]]></script>

It gives info about order no., sku, product name, etc.

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!

P.S. We are a development company rasberry

Cheers

- Harshit

 
Magento Community Magento Community
Magento Community
Magento Community
 
dustin-sparks
Jr. Member
 
Total Posts:  4
Joined:  2008-04-21
 

Hi Harshit,

Thanks for the reply smile - The error was my fault - I didn’t have the FULL code pasted in the Magento admin, I am embarrassed...all is well & the site is tracking traffic & sales here http://whispersandroses.com/ can you PM me your rates & availability for Magento work?  I am getting increased demand for Magento stores.

 
Magento Community Magento Community
Magento Community
Magento Community
 
KTdid7733
Jr. Member
 
Total Posts:  1
Joined:  2009-12-15
 
pilare - 05 December 2009 03:30 PM

vmadmin - 03 November 2009 01:02 PM
@cellfservices
No, that will not work. The HTML/Javascript code Google gives you should not be used to replace the PHP code in “Ga.php”.

Magneto already supports GA tracking, including ecommerce tracking. The “Ga.php” file generates the proper (HTML/Javascript) code for you. All you have to do is turn on GA tracking and enter your GA account number (something like “UA-XXXXX-X").

That said… the tracking is working fine for me with the exception of ecommerce categories.
http://www.magentocommerce.com/boards/newreply/52505/

I have the same, it all works from the box only without the e-commerce categories. Did anybody found out why?? is there any fix for this issue??
I have installed the google analytics plus extension from fooman to track the checkout funnel. Maybe this is an issue but I really don’t think so.

There was a question here about categories not being tracked in Google Analytics. I am assuming that @pilare is referring to product categories by going to Ecommerce > Product Performance > Categories in Analytics. This field has always been blank for all of the Magento sites we have worked on.

Any Solution for this problem?

 
Magento Community Magento Community
Magento Community
Magento Community
 
joesken
Jr. Member
 
Total Posts:  9
Joined:  2009-07-27
 

Hi,

Just to open this up again I too am having an issue with Google Analytics ecommerce tracking. (Note only the ecommerce tracking).

In order to try and eliminate all other possible causes what I have done is installed a new clean install of Magento Version 1.4.0.0 and the sample data and added in the Google Analytics tracking code in the System -> Configuration - Google API -> Google Analytics Account Number.

Upon completion of an order the success page (index.php/checkout/onepage/success/) does successfully show the Google Analytics page view tracking but does *not* show the ecommerce transaction tracking.

Looking into this a little bit further I looked at Ga.php (/app/code/core/Mage/GoogleAnalytics/Block) where the Analytics code gets written.  It does (of course) have the full code to add the transactions for ecommerce tracking but they aren’t getting added to the return call for some reason.  It appears (from what I can tell) that $this->getQuote(); in the getQuoteOrdersHtml() function is returning null. 

As I say this is a totally new clean simple install and from everything I have read the ecommerce tracking is getting added automatically for many of you (however not for others I suspect). 

Any thoughts, suggestions and/or ideas (or even verification that the same is happening for others) would be appreciated.

Thanks

Jo

 
Magento Community Magento Community
Magento Community
Magento Community
 
joesken
Jr. Member
 
Total Posts:  9
Joined:  2009-07-27
 

Just FYI - Upgraded to 1.4.0.1 but the issue is still happening (no ecommerce tracking codes being inserted onto the page).

Anyone else getting this?

Thanks

J

 
Magento Community Magento Community
Magento Community
Magento Community
 
felsyeh
Jr. Member
 
Total Posts:  7
Joined:  2009-12-30
 

I am also getting error from Google Analytics after I upgraded to 1.4.0.

The error I get is:

_gaq is not defined

When it tries to setaccount.

Anyone find a resolution to this issue?

 
Magento Community Magento Community
Magento Community
Magento Community
 
oldcreekwbf
Jr. Member
 
Total Posts:  24
Joined:  2008-06-13
 

Were running 1.4.0.0 and getting the same error code as well.

'_gaq' is undefined

I’ve even gone so far as to strip out the entire site down to just the Google Analytics Code output by Magento and I still get the same error

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<
html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
    <
head>
    </
head>
    
    <
body class=" cms-index-index cms-home">
                <!-- 
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);
                
})();
                
                
_gaq.push(["_setAccount""UA-443709-1"]);
                
_gaq.push(["_trackPageview""/"]);
                
//]]>
                
</script>
                
<!-- END GOOGLE ANALYTICS CODE -->
    </
body>
</
html>
 
Magento Community Magento Community
Magento Community
Magento Community
 
Hucke_Media_de
Jr. Member
 
Avatar
Total Posts:  16
Joined:  2008-10-16
 

We had 1.4.0.0 and 1.4.0.1 not showing up Google Analytics code.

Solution was this: http://www.magentocommerce.com/bug-tracking/issue/?issue=8492

 
Magento Community Magento Community
Magento Community
Magento Community
 
felsyeh
Jr. Member
 
Total Posts:  7
Joined:  2009-12-30
 

Thanks I also found this in the bug-tracking: http://www.magentocommerce.com/bug-tracking/issue?issue=8378

The asynchronous google analytics code has this line lacking: “var _gaq = _gaq || [];” .
It throws an js error stating that _gaq is not defined.

It’s easy to fix.
Edit app/code/core/Mage/GoogleAnalytics/Block/Ga.php and add “var _gaq = _gaq || [];” on line 180.

 
Magento Community Magento Community
Magento Community
Magento Community
 
joesken
Jr. Member
 
Total Posts:  9
Joined:  2009-07-27
 

Fixed!

OK to fix this I needed both fixes as outlined above.

1 - Change the tracking code to appear before the body tag (as per huke)
2 - Fix the _gaq variable not being defined (as per felsyeh)

Thanks to all.  Tracking is now working and ecommerce tracking is now working.

J

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

Hi,

Solution No. 2 - Fix the _gaq variable not being defined (as per felsyeh) Edit app/code/core/Mage/GoogleAnalytics/Block/Ga.php on line 180.

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

is this correct?
ty

Dom

 
Magento Community Magento Community
Magento Community
Magento Community
 
joesken
Jr. Member
 
Total Posts:  9
Joined:  2009-07-27
 

Dom,

You must declare the variable before you use it.  So put the var _gaq=_gaq ¦¦ []; before the _gaq.push statement.

See: http://code.google.com/apis/analytics/docs/tracking/asyncTracking.html

J

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