I am trying to track eCommerce transactions using google analytics ecommerce tracking...
<?php
$tx_token = '234234234';
$amount = '19.99';
?>
<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-12345678-1']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'<?php echo $tx_token; ?>', // Transaction ID
'My Store', // Affiliation or store name
'<?php echo $amount; ?>', // Total
]);
_gaq.push(['_addItem',
'D1D44',
'My Item',
'Category / Variation',
'<?php echo $amount; ?>',
'1'
]);
_gaq.push(['_trackTrans']);
(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>
Should this be enough? Do I need the $tx_token value in addItem as well as addTrans?