I want to add this code as well. It is not the analytics code, I already have that which goes in the footer.
The code kevinmc3 is talking about is also available from google adwords (if you have an account) and is used to track the conversion rate between visits and purchases as well as which product sells the best etc...
It needs to go into the checkout_success page ( or a page the buyer gets to after completing their purchase).
The code is in HTML and we also need to include the following functions:
"Next, somewhere in the receipt below the tracking code, call the _addTrans() and _addItem() functions. Begin with a call to _addTrans() to establish a transaction. _addTrans() takes the following arguments: Order ID,Affiliation, Total, Tax, Shipping, City, State, Country. For each item that the visitor purchases, call _addItem(). _addItem() takes the following arguments: Order ID, SKU or Code, Product Name, Category, Price, Quantity.
Here is a complete example:
<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-1");
pageTracker._initData();
pageTracker._trackPageview();
pageTracker._addTrans(
"1234", // Order ID
"Mountain View", // Affiliation
"11.99", // Total
"1.29", // Tax
"5", // Shipping
"San Jose", // City
"California", // State
"USA" // Country
);
pageTracker._addItem(
"1234", // Order ID
"DD44", // SKU
"T-Shirt", // Product Name
"Green Medium", // Category
"11.99", // Price
"1" // Quantity
);
pageTracker._trackTrans();
</script>"
The above in quotes is from the code instructions on the google adwords page for my account.
If anyone has done this before and can give me an idea of how to go about it, that would be greatly appreciated.
Thank you.