Skip to content

Instantly share code, notes, and snippets.

@etianen
Created April 27, 2010 10:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save etianen/380617 to your computer and use it in GitHub Desktop.
Save etianen/380617 to your computer and use it in GitHub Desktop.
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-XXXXX-X']);
_gaq.push(['_trackPageview']);
_gaq.push(['_addTrans',
'<?php echo $orderId; ?>', // order ID - required
'<?php echo $storeName; ?>', // affiliation or store name
'<?php echo $total; ?>', // total - required
'<?php echo $tax; ?>', // tax
'<?php echo $shipping; ?>', // shipping
'<?php echo $city; ?>', // city
'<?php echo $state; ?>', // state or province
'<?php echo $country; ?>' // country
]);
_gaq.push(['_addItem',
'<?php echo $orderId; ?>', // order ID - required
'<?php echo $productId; ?>', // SKU/code
'<?php echo $productName; ?>', // product name
'<?php echo $variant; ?>', // category or variation
'<?php echo $price; ?>', // unit price - required
'<?php echo $quantity; ?>' // quantity - required
]);
_gaq.push(['_trackTrans']); //submits transaction to the Analytics servers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment