/ Published in: PHP
This code allows you to track each step of Magento's One Page Checkout in Google Analytics. I installed it at the bottom of my `checkout/onepage.phtml` template file. Once installed, you can set up a funnel for the following:
* `/checkout/onepage/`
* `/checkout/onepage/billing/`
* `/checkout/onepage/shipping/`
* `/checkout/onepage/shipping_method/`
* `/checkout/onepage/payment/`
* `/checkout/onepage/review/`
* `/checkout/onepage/success/`
(This is a tweak of code [seen here](http://www.magentocommerce.com/boards/viewthread/12564/P0/). I prefer the gist of lanthaler's method over FOOMAN's because the data sent to Google is more specific, and based on explicit requests to load sections rather than requests to save data.)
* `/checkout/onepage/`
* `/checkout/onepage/billing/`
* `/checkout/onepage/shipping/`
* `/checkout/onepage/shipping_method/`
* `/checkout/onepage/payment/`
* `/checkout/onepage/review/`
* `/checkout/onepage/success/`
(This is a tweak of code [seen here](http://www.magentocommerce.com/boards/viewthread/12564/P0/). I prefer the gist of lanthaler's method over FOOMAN's because the data sent to Google is more specific, and based on explicit requests to load sections rather than requests to save data.)
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<script type="text/javascript"> // Report each step of the checkout process to Google Analytics Checkout.prototype.gotoSection = function(section) { try { pageTracker._trackPageview('<?php echo $this->getUrl('checkout/onepage') ?>' + section + '/'); } catch(err) { } section = $('opc-'+section); section.addClassName('allow'); this.accordion.openSection(section); }; </script>