One of the most valuable sources of data in optimising your ecommerce store is your tracking data and one very informative tool in the Google Analytics suite is the goal funnels. These funnels allow you to see how visitors have progressed through a process to your goal, in ecommerce this is often progressing from adding a product to their cart through the checkout process to completion. Improvements in the conversion rate of this process can make a big impact on sales and the first step in making such improvements is in identifying where your customers are dropping out of the process.
As Magento’s standard one page checkout uses AJAX to load each section the whole checkout process is seen as just 1 page by analytics meaning you are unable to tell whether your users are dropping out at the login/register stage or are having problems with the payment information. The following article will explain how to make the necessary changes to your Magento installation to track this.
Step 1. Modify the Magento AJAX action.
The key to seeing the different steps in your checkout is ensuring a page view is triggered each time one of the sections of the checkout is loaded. To do this we need to edit opcheckout.js this file should be in \skin\frontend\default\YOURTHEME\js if not then copy it there from \skin\frontend\base\default\js
Within this file search for “gotoSection: function(section)” to find the function we are interested in amending and add in the lines of code shown below.
gotoSection: function(section)
{
try {
// Old Analytics code
//pageTracker._trackPageview('checkout/onepage/'+section);
// Newer Asynchronous Analytics code
_gaq.push(['_trackPageview', 'checkout/onepage/'+section]);
} catch(err) { }
section = $('opc-'+section);
section.addClassName('allow');
this.accordion.openSection(section);
},
If you are using the old analytics code then you will need to remove the slashes from the line “//pageTracker….” and comment out (add a double slash to the beginning of) the line beginning “_gaq.push…”.
Step 2. Set up your goal funnel in Google Analytics
Goal Type: URL Destination
Match Type: Head Match
Goal URL: /checkout/onepage/success/
Step 1
URL: /checkout/cart/
Name: Cart
Step 2
URL: /checkout/onepage/
Name: Login or Register
Step 3
URL: /checkout/onepage/billing/
Name: Billing Address
Step 4
URL: /checkout/onepage/shipping/
Name: Shipping Address
Step 5
URL: /checkout/onepage/shipping_method/
Name: Shipping Method
Step 6
URL: /checkout/onepage/payment/
Name: Payment Details
Step 7
URL: /checkout/onepage/review/
Name: Confirmation
And then all you need to do is wait a day for the data to be captured and you should the drop out rate at each step of the checkout.


Very interesting information!Perfect just what I was looking for!
I’m testing this in a stage environment, would the first / in the funnel matter? I’ve tried this numerous times and it never seems to work. We just upgraded to 1.11 (EE) so I’ll see if it works this time, but if you can shed some light on whether this works on all versions or only certain versions, and if it works on only production servers or if it’ll work on stage servers (with stage analytics setup) as well, I’d appreciate it. Thanks!!!
The first step is not required as it is possible for customers to get to the checkout page without viewing the cart page.
Haven’t had chance to try it on the enterprise edition, but judging by the site on the domain from your email address Joe it seems the page URLs are the same so in theory it should work the same.
Hi John,
Just what I was looking for. Just to clarify, my opcheckout file is in \skin\frontend\base\default\js. So you’re saying I need to now move this to the other location and create a js folder for it? There isn’t one currently there so I am a little concerned with doing that.
Sorry for the very basic question – little weak in this department =)
Thanks!
What is the URL of the site in question, I can check from viewing the site the route to your skin folder.
Thanks, we have just implemented this, so hopefully tomorrow we will see the results!
Darryl
It should not work any more.
For new magento , it should be different.
The new version shoud be in this way:
Goal Funnel
Step1: /checkout/onepage/ (Required step)
Step2: /checkout/onepage/opc-billing
Step3: /checkout/onepage/opc-shipping
Step4: /checkout/onepage/opc-shipping_method
Step5: /checkout/onepage/opc-payment
Step6: /checkout/onepage/opc-review
Step7: /checkout/onepage/opc-review-placeOrderClicked