I've just found this on
8 Awesome Google Analytics Hacks, Tips and Tricks. It's how to configure the Google Analytics ecommerce module. To turn it on, go to the account settings, and change the ecommerce Website button from "No" to "Yes", then on your receipt page, add the following code with the fields below being filled from the order confirmation page.
HTML Code:
<script type="text/javascript"><!–
var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
document.write(unescape("%3Cscript src=’" + gaJsHost + "google-analytics.com/ga.js’ type=’text/javascript’%3E%3C/script%3E"));
// –></script>
<script type="text/javascript"><!–
var pageTracker = _gat._getTracker("UA-xxxxx-x");
pageTracker._trackPageview();
pageTracker._addTrans(
"1234", // The ID for the whole transaction
"Mountain View", // The affiliate name, if there is one. If not, put as your name
"11.99", // Total transaction value
"1.29", // Tax
"5.99", // Shipping charges
"San Jose", // City
"California", // State
"USA" // Country
);
pageTracker._addItem(
"1234", // The ID for this single part of the order
"DD44", // Product SKU
"T-Shirt", // Product Name
"Green Medium", // Category
"11.99", // Price
"1" // Quantity
);
pageTracker._trackTrans();
// –></script>
To put this into practice, you would do something like this (on a PHP site).
PHP Code:
pageTracker._addItem(<?php echo "$order_id , $name , $total , $tax , $shipping , $city , $state , $country"; ?>);
etc
There're more great Google Analytics tips like this one on
http://searchlightdigital.com/8-awes...ips-and-tricks
Thanks to Nass on UKBFs for originally posting the link
here.