Return to Snippet

Revision: 18546
at October 1, 2009 20:45 by jdbartlett

Initial Code
<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);

Initial URL

Initial Description
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]( 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.)

Initial Title
Report each step of Magento's One Page Checkout to Google Analytics

Initial Tags

Initial Language