ifnull
11/15/2014 - 1:02 AM

Add Magneto cart abandonment funnel to Google Analytics

Add Magneto cart abandonment funnel to Google Analytics

Magento Code

Add the following code to checkout/onepage.phtml at the bottom.

By default this file is located here:

app/design/frontend/base/default/template/checkout/onepage.phtml

In a custom theme is would be somthing like:

app/design/frontend/default/shopper/template/checkout/onepage.phtml
//<![CDATA[
Checkout.prototype.gotoSection = function(section, reloadProgressBlock) {
    try {
        _gaq.push(['_trackPageview', '/checkout/onepage/' + section + '/']);
    } catch (err) {}

    var sectionElement = $('opc-'+section);
    sectionElement.addClassName('allow');

    var sectionElement2 = $('top-opc-'+section);
    sectionElement2.addClassName('allow');

    this.accordion.openSection('opc-'+section);
    this.reloadProgressBlock(section);
};
//]]>

Google Analytics Setup

  1. Navigate to the goal setup page: Admin > VIEW > Goals
  2. Select NEW GOAL.
  3. Goal setup: Custom
  4. Goal description Name: Checkout Success
  5. Goal description Type: Destination

Goal Details

Destination

/checkout/onepage/success/index.php

Funnel

NameURL
Cart/checkout/cart/index.php
Login/checkout/onepage/index/index.php
Billing/checkout/onepage/billing/index.php
Shipping/checkout/onepage/shipping/index.php
Shipping Method/checkout/onepage/shipping_method/index.php
Payment/checkout/onepage/payment/index.php
Review/checkout/onepage/review/index.php

Notes

  • I had to add index.php at the end of my destination URL and funnel URLs. You may not have to. Be sure to click Verify when setting up your funnel to test this.