Google Analytics Goal Funnel for Magento One page Checkout

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 skinfrontenddefaultYOURTHEMEjs if not then copy it there from skinfrontendbasedefaultjs

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.

By
About the author: "Dave is a content marketing specialist within the SEO team at Blueclaw. He comes from a technical SEO and link building background and has worked both in-house and agency side in a wide variety of industries."
View all posts by David Hellowell