Skip to content

Instantly share code, notes, and snippets.

@scottcorgan
Created July 5, 2012 05:39
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 scottcorgan/3051569 to your computer and use it in GitHub Desktop.
Save scottcorgan/3051569 to your computer and use it in GitHub Desktop.
Google Analytics Ecommerce Tracking
//
// We add this once for each transaction
//
_gaq.push(['_addTrans',
'1234', // order ID - required
'Womens Apparel', // affiliation or store name
'28.28', // total - required
'1.29', // tax
'15.00', // shipping
'San Jose', // city
'California', // state or province
'USA' // country
]);
//
// Now we add an item for each item purchased
//
_gaq.push(['_addItem',
'1234', // order ID - necessary to associate item with transaction
'DD44', // SKU/code - required
'T-Shirt', // product name
'Olive Medium', // category or variation
'11.99', // unit price - required
'1' // quantity - required
]);
_gaq.push(['_trackTrans']);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment