Google Analytics eCommerce code help

Hey,

I was wondering if it’s possible to get some help setting up eCommerce on my Google Analytics account.

How do I add a unique order ID to the javascript field? Do I just leave it blank? All of my customers are directed to the same thankyou page so I’m not sure how to track a bunch of unique order ID’s on the one page.

The code is on this site and the code I’ve altered below: I just need to alter the _addTrans and _addItem parts.

This is my altered version:

Thanks for any help.


<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">
try {
var pageTracker = _gat._getTracker("UA-xxxxxx-x");
pageTracker._trackPageview();
} catch(err) {} </script> 


<script type="text/javascript">
try {
var pageTracker = _gat._getTracker("UA-XXXXX-1");

pageTracker._trackPageview();

pageTracker._addTrans(
"", // Order ID
"Clickbank", // Affiliation
"48.00", // Total
"0.00", // Tax
"0", // Shipping
"", // City
"", // State
"" // Country
);

pageTracker._addItem(
"1", // Order ID
"", // SKU
"My e-book title", // Product Name 
"e-book", // Category
"48.00", // Price
"1" // Quantity
);

pageTracker._trackTrans();
} catch(err) {}</script>

Usually you record an order to your database and then use the ID from database for the tracking code. You insert it right to the JS code with PHP or other server-side script:


pageTracker._addTrans(
"<?=$order_id?>", // Order ID
"Clickbank", // Affiliation
"48.00", // Total
"0.00", // Tax
"0", // Shipping
"", // City
"", // State
"" // Country
);

pageTracker._addItem(
"<?=$order_id?>", // Order ID - should match the one from _addTrans()
"", // SKU
"My e-book title", // Product Name 
"e-book", // Category
"48.00", // Price
"1" // Quantity
);