Here is the reference page I used from Google: http://code.google.com/apis/analytics/docs/tracking/gaTrackingEcommerce.html
Not sure about ss_associate, since I do not every have that set on my transactions (should I just insert the company name?) Also, where it says "Products", that is what corresponds to Google's "category or variation". Is there a variable that could go there?
Does everything else look right? Thanks in advance for any/all advice.
- Code: Select all
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '-']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',ss_ordernum, ss_associate, ss_ordertotal, ss_taxtotal, ss_shiptotal, ss_city, ss_state, ss_country)]);
for (var p = 0 ; p < number_products ; p++) {
gaq.push(['_addItem',ss_ordernum, ss_sku[p], ss_name[p], "Products", ss_price[p], ss_quantity[p]]);
}
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>