Tracking Magentos Onepage Checkout Steps in Google Analytics
August 28, 2019
Being able to track Checkout Abandonment is crucial when you're focused on increasing conversions, with Magento's one page checkout by default you can't step up goals for Google Analytics to pick out each step, so instead we can use the trackPageview method to track fake pageviews for each step, we can then add these into our Goal steps inside GA.
Step 1) Modify onepage checkout template file
First of all we need to modify the file called onepage.phtml located inside checkout/onepage.phtml within your theme's template directory, if the file doesn't exist here copy it across from the base/default folder:
Your Theme: app/design/frontend/[package]/[yourtemplate]/template/checkout/onepage.phtml Base Default: app/design/frontend/base/default/template/checkout/onepage.phtml
Once you've got the file open paste in the following code at the end of the file, save and upload.
Step 2) Set up Goal & Funnel on Google Analytics
All that is left to do now is to set up the goal and funnel on Google Analytics so we can begin tracking our abandonment's. To do this within the new version of Google Analytics in the top right in the main navigation bar there is a link called “Admin” on this page navigate to the Goals section under Profiles > Goals.
Then enter the following information: Google Analytics Goal Setup
Goal Type: URL Destination
Match Type: Head Match
Goal URL: /checkout/onepage/success/
Funnel Steps: Step 1: /checkout/cart/
Step 2: /checkout/onepage/
Step 3: /checkout/onepage/billing/
Step 4: /checkout/onepage/shipping/
Step 5: /checkout/onepage/shipping_method/
Step 6: /checkout/onepage/payment/
Step 7: /checkout/onepage/review/
And that's it!
Save those changes and voila! You're done and now tracking checkout abandonment! On the Standard Reporting section to Google Analytics go to Conversions > Goals > Funnel Visualization to see where your users are dropping out from the checkout process.