Tracking Onepage Checkout abandonment using Google Analytics
In the process of conversion rate optimization a store owner will sooner or later hit a wall with available Magento tools. While e-commerce tracking and cart abandonment information work great with Magento, checkout process is still a bit foggy area.
That’s where tracking checkout process and knowing the right moment/step of checkout abandonment using Google Anaytics comes in hand…
For this one we will use native Google Anlytics trackPageview method. Please note, this one works only with default Magento’s onepage checkout.
[1.] If it’s not enabled, enable Google Analytics from Magento admin.
[2.] Edit onepage.phtml in your Magento theme directory [this is location for default theme]:
app/design/frontend/base/default/template/checkout/onepage.phtml
and paste this code at the end of file:
code updated: 21.08.2013. [tnx Matej ;-)]
<script type="text/javascript">
//<![CDATA[
Checkout.prototype.gotoSection = function (section, reloadProgressBlock) {
if (reloadProgressBlock) {
this.reloadProgressBlock(this.currentStep);
}
// Checkout abandonment rate - by Inchoo
try {
_gaq.push(['_trackPageview', '/checkout/onepage/' + section + '/']);
} catch (err) {
}
this.currentStep = section;
var sectionElement = $('opc-' + section);
sectionElement.addClassName('allow');
this.accordion.openSection('opc-' + section);
if (!reloadProgressBlock) {
this.resetPreviousSteps();
}
};
//]]>
</script>
[3.] create Goal with funnel inside Google Analytics
Define all funnel steps as described above:
Google Analytics funnel steps:
- /checkout/cart/
- /checkout/onepage/
- /checkout/onepage/billing/
- /checkout/onepage/shipping/
- /checkout/onepage/shipping_method/
- /checkout/onepage/payment/
- /checkout/onepage/review/
[4.] Test your new settings
Go to your Magento onepage checkout and watch for HTTP requests sent after each step/accordion is finished. If there is an HTTP request for __utm.gif after every checkout/accordion with appropriate parameters and their values (underlined) – then your data is being collected.
Wait for a few hours, days or weeks, and then check your Google Analytics under:
Conversions -> Goals -> Funnel Visualization
and select appropriate goal/funnel.
While this method will not give you a definite answer to why people are abandoning eventual purchase, it might give you a better clue on what part of checkout process needs more of your attention, whether it’s overall checkout user experience (more information for each of the steps, etc.) or specific checkout options (shipping rates, available payment/shipping methods, etc).