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).
70 comments
Since some new comments are buried in comment threads, this a comment repost for a frequent question – 100% match:
100% conversion is due to step matching. If your steps are i.e.
/checkout/onepage/
/checkout/onepage/two/
/checkout/onepage/three/
It would have 100% conversion rate due to how GA matches steps [weird, I know :)]. More info: https://support.google.com/analytics/answer/2976313?hl=en
Solution [for this example]: change first step to use regex that would match only that particular URL: “/checkout/(onepage/index/$|onepage/$)$”
Do you have similar situation?
After following this tutorial, we are seeing some activity on our funnel visualization, however I do not believe it is reporting accurately. According to our funnel, of the visitors that proceed to the Billing step, it is reported that 100% of them complete the funnel by placing an order. Obviously this is incorrect.
Is anyone experiencing similar behavior? Any advice or help would be greatly appreciated.
We are using Magento EE 1.14.0.1
Hi Bar,
can you check/post you funnel steps report [screenshot would be best]?
When adding the suggested JavaScript, it has broken my CheckOut Progress. This is not refreshed anymore ( with Ajax ), but is only showing headers ( Billing Address, Shipping Address and Payment ) from the steps.
We removed shipping-fee from onepage checkout.
Can you post how can find out rever gola path more than 3 steps that is default in anlytics
You say “Please note, this one works only with default Magento’s onepage checkout.”
We are using a different onepage checkout extension. Is it possible to set something similar to track the performance of that page?
Thanks
Hi Maria,
yes, it’s possible to track performance of other “onepage” checkout solutions, but it would require analysis and custom dev for each of them. As a rule of a thumb – if there is a linear flow between checkout steps of any kind – it would be possible to track performance for each step and create a funnel. Please, contact us if you’d like us to take a look…
I put note about default Magento onepage checkout mostly due to fact that there are many different implementations of “onepage” and “onestep” checkouts used with Magento out there. I must say, although it is possible to track individual user actions/steps for “onestep” checkouts, I still haven’t seen use case that resulted in any meaningful report mostly due to non-linear nature of “onestep” checkout. I’d like to see a case where analytics funnel works in “onestep” checkout environment. Anyone?! 😉
After much tinkering, I found a solution that seems to be working. Here are the steps that I took:
1. Created a filter, type Custom filter, Search and Replace. Filter field “Request URI”, Search String “/checkout/onepage/index/”, Replace String “/checkout/onepage/”, Case sensitive: No
2. On the goal. Made sure that the destination was set to “Regular Expression” and set the second step, “Checkout” to “/\/checkout\/onepage\/$/”
That seems to do the trick. But give it a little time to propagate.
I am getting the same result as shaiju. Any sugguestions?
//
//
This is the code which I have put in onepage.phtml
I tried the same way whcih you mentioned as above. But the funnel conversion not getting properly. I would like to add my funnel converion’s screenshot too.
https://www.dropbox.com/s/o2egm8ooskrpoti/Google%20Analytics-goal-setup.png
https://www.dropbox.com/s/t3w4d77auutwppm/Goal%20Funnel%20-%20Google%20Analytics.png
Any help would be much appreciated.
Thanks for this tutorial. Big Help! It is working for me and reporting in analytics, but I have noticed that now after adding the script to the bottom of the onepage.phtml the checkout progress on the right column is not functioning as it should. Any ideas on how I can correct this? I will be removing the script from our main site until I can get this functioning in our dev environment. any help would be much appreciated.
Another great tutorial by Inchoo 🙂 I wondered if anyone has managed to track the contact form enquiries as an analytics goal? Thanks!
Hey Drazen
Here is the screnshot: https://www.dropbox.com/s/uh6kjsb0lul0e0h/reverse-path-ga.jpg
I did the changes like I said 08/21 in an comment but I didn’t have the informations about abandonment yet.
Thanks!
Hi Guilerme, can you post screenshot from of reverse goal paths?
Drazen
All slashes are right and I changed the success URL to “head match”. I’ll monitor these Goal!
Looking my “Checkout Success” reverse goal path I saw the steps: review, payment, shipping_method, etc., like you did in this tutorial
Thanks for the help.
We use GA extension by Fooman. Never really understood: does this extension already do the above. or do we need to override anyways
Guilherme,
– change success URL to “head match”
– check slashes – “/” in your rules and HTTP request for __utm.gif.
For more troubleshooting:
Do you have any success goals in your GA by now?!
If you do, then check Conversions -> Goals -> Reverse goal path – that’s the actual conversion path, you can use those URLs in GOALS definition.
How do those paths look like (URL structure)?
Mathias, yes, we noticed, but took some to update the article. Tnx for your comment, it’s fixed now.
Drazen
I have the same problem that Adam had but I don’t saw the solution in comments. Here is the printscreen of UTM and GA: https://www.dropbox.com/s/1g7u9m2e2bng20t/ga-magento.jpg
Can you help me?
Thanks!
Thanks for your code 🙂
but this line is missing in your Code:
this.reloadProgressBlock(section);
@Vadim, and @all having issues – when submitting issues, please refer to debugging steps [4] in the article, and submit:
1] info about checkout page
2] HTTP requests output(s) – just like in the example [section 4 in the article]
Excellent article; followed the simple (and well documented steps) … working like a charm! Thanks 🙂
Hi, thanks for the article.
We have followed all the steps, but we cannot get the desired results. After /checkout/onepage/ step, GA displays transitions to the Billing sections as people drop-offs and the URL for people dropoffs is /checkout/onepage/billing/. We use custom Magento theme but it has one-page checkout. Here is the screenshot
. We have modified both default onepage.phtml for default and our themes, but nothing has changed. Are there any reasons for issue persistence? Please, advise. Many thanks.
P.S. We have tried different variants of script code (available above) but nothing.
@Toni
Thanks for the help – but i dont have such parameters
Is there any other way to activate the funnel?
@Andreas,
Exact match method will not work if something sends some parameters in your URLs during the checkout. Do you have some parameters such as ?ref generated by some testing, analytics or affiliate services or extensions?
Appendix: with “exact Match” i have less funnel Users than User at the Goal
@tone
this does not work. i have more goals reached than people in the funnel
+1 for Toni’s advice. I wasted days on this – the only way I could get it to work is “exact match”
Thanks @Toni ! I will try that.
@Andreas,
Just set it to exact match.
Hello,
same Problem like @adam:
Funnel works, but i have also 100% checkouts (That would be nice but i can imagine).
Hey Drazen, I’ve tried your guide, but it doesn’t work.
instead of getting the section in the end og the URL, I get:
checkout/onepage/?___SID=U Do you know why this happens? it is
magento ver. 1,702.
Hi Adam,
Do you have “required step” checkbox checked (switched on)?
Hey Drazen, can you pm me? Then we can post the resolution in comments?
I’d appreciate the help.
Further findings / notes:
* guest checkout is not enabled
* _utm for billing never gets sent
** if you are already logged in it takes you right to this step, so it never pushes this step to GA
Hi Adam,
Could you post a acreenshot to your funnel?
Could you post test results? Go to checkout and watch all HTTP requests for _utm.gif -> post a link to screenshot. Tnx…
“Required step” is not necessary, actually, it should be left unchecked as users might jump right into one of the steps (actually, for most configurations it’s /checkout/onepage/, but anyway, leave it unchecked).
I’m surprised that the “head match” doesn’t skew results with these urls
/checkout/onepage/
/checkout/onepage/billing/
/checkout/onepage/shipping/
/checkout/onepage/shipping_method/
/checkout/onepage/payment/
/checkout/onepage/review/
I’m try to track down why our analytics reports 100% conversion at each step.
I noticed also that the checkbox “required step” isn’t checked in your example either.
Hey Adam – did you ever figure out why the later steps always show 100% conversion? I can’t seem to find a solution.
Hi,
100% conversion is due to step matching. If your steps are i.e.
/checkout/onepage/
/checkout/onepage/two/
/checkout/onepage/three/
It would have 100% conversion rate due to how GA matches steps [weird, I know :)]. More info: https://support.google.com/analytics/answer/2976313?hl=en
Solution [for this example]: change first step to use regex that would match only that particular URL: “/checkout/(onepage/index/$|onepage/$)$”
Do you have similar situation?
@Vincent:
See if you can find a way to drop shipping fees entirely. Shipping fees seem to have quite an impact on conversions, even when they are low.
Source: http://www.fairgroundmedia.com/improve-conversion-rates-with-shipping-options-infographic
Hi Drazen Karacic
Have you had a chance to think about my idea of abandoned steps report?
That would be one of the most important Magento extensions!
Does this work for Magento Go?
@Luis
You beat me to it, I was just testing the same change before posting the answer. Works for me!
@Luis
Cheers for that. Have made the change and uploaded. Will see what happens.
@Si
I had the same issue. I just replaced
with
Hi “non woven”, 🙂
Tnx for your comment, I’m glad it helped.
Take a look at Srdjan’s article in the series of GA tracking in Magento:
https://inchoo.net/ecommerce/magento/track-validation-errors-on-magento-forms-using-google-analytics/
It might help in other situations, as well…
hi drazen,
i am looking for magento shopping cart abandonment rate decreasing methods,and your article definitely helped me with tracking abandonment rate.
i have never thought of using GA to track, alternatively,i used third party service to track and analyse for me.
@Drazen Karacic
You got it 100% right – this exactly what I had in mind: report which would show customers who abandoned checkout and showing at which step it happened.
If implemented as Magento plugin it might also have an option to retrieve that abandoned shopping cart so owner can make an adjustments and make an counter offer to client. – Let say I see that customer dropped at shipping cost, we check shipping quote and see that we can offer cheaper option so we make an offer which customer can accept. (but that may be too much to ask :))
Hi Drazen
Any thoughts on what might be causing my ‘/https://cheshirepineandoak.com/checkout/onepage/billing/’ issue as this is negating what could otherwise be extremely useful info…
Cheers, Si
Hi Vincent,
Tnx for your comment. We have discussed internally about this nice idea you have.
It could be done with two different approaches, depending on your particular needs.
Could you specify your requirement a little more? Would you like to have some kind of report from where you would see a list of users that abandoned checkout at #1, #2, #3, and then have possibility to contact them with some message? Is that what you had in mind?
you made it complicated
Nice article.What would be nice to know is which customer dropped at which step so owner could follow up with customer. I guess it could be done – since after step one in the checkout we know customer’s information (name, email) it should be possible to track how far did he(she) go in the checkout process.
Does anybody know solution for this – existing magento plugin probably?
Excellent article as always, thanks guys. Just one question, have had this implemented for a couple of weeks now and am getting data through, but there seems to be a problem. When I look at the funnel it shows that most of my customers are exiting at the Checkout Intro stage, but the exit address is strange – its the entire url prefixed with a forward slash – i.e. ‘/https://cheshirepineandoak.com/checkout/onepage/billing/’. Any ideas what might be causing this?
@nicki, care to explain a bit further? Are you talking about GA events tracking?
no setting required for this in magento google have default functionality i am running it without it google setting because google analytics have default functionality to track ajax pages
Hi nicki,
Tnx for your input, could you please elaborate your statement, and give us easier way.
Tnx
its not like this , you made it complicated
@Rose, you’be busted us!
Yes, I’m Dr. Ray’s twin bro, but what you didn’t notice is that Tomislav is Scott Wolf http://bit.ly/QbgQts . We’ve met in Hollywood during his medical consultation he was having with my brother.
We talked about technology and e-commerce, and the rest is history…
This one? http://bit.ly/AiHbdA
I heard that Drazen is his evil twin brother who stole his money and moved to Croatia.
greetings.
are you the clone of the DR. Ray?
You are very equal
ok,thank you very much!:)
Hi 54dev,
This tutorial is for Magento’s default Onepage checkout, but this technique could be applied to other checkouts as well.
Of course, it doesn’t make too much sense in applying this technique in oneSTEP checkout of any kind. 😉
If you would like to track user activity in oneSTEP checkout, this would be a good starting point:
https://developers.google.com/analytics/devguides/collection/gajs/eventTrackerGuide
i used gomage onstepcheckout
54dev,
Can you please provide URL where error can be reproduced?
Tnx…
Hi Rick,
It depends on how you implemented GA tracking on your site, and what’s your “Default URL”.
You are most likely the owner of domain and all subdirectories, and you probably track all of the traffic.
In that case the goal would be relative to your domain’s root: store/checkout/onepage/success
But, if you’ve implemented GA to track only traffic in specific subdirectory (i.e. Default URL is “wwww.domain.com/store”), the goal would be checkout/onepage/success
P.S. Sorry for delay, vacation time 😉
Uncaught ReferenceError: Checkout is not defined
I have a store located at http://www.queencreekolivemill.com/store/
When I am setting up the funnel analytic’s for the one page checkout, do i do it like this:
/checkout/cart/
or like this
/store//checkout/cart/
also, would the goal URL be:
/checkout/onepage/success
or
store//checkout/onepage/success
Thanks – Rick
Hi Peter, I’m glad you liked it. 🙂
By default theme, I meant all themes that handle Onepage checkout functionality (prototype accordion on Onepage checkout, to be more specific) as default theme.
For all other situations, script should be tweaked to fit the general principle of invoking a fake pageview GA call (as in this case) or event tracking in GA.
Hi, I love this article but what about a non-default Magento theme. Can you explain me a little bit what to do?