Skip to content

Instantly share code, notes, and snippets.

@jacobdubail
Created July 10, 2018 22:16
Show Gist options
  • Save jacobdubail/21d95aad15017fdf85d6773bc75db4db to your computer and use it in GitHub Desktop.
Save jacobdubail/21d95aad15017fdf85d6773bc75db4db to your computer and use it in GitHub Desktop.
GA Ecommerce Snippet
<script type="text/javascript">
ga('require', 'ecommerce');
ga('ecommerce:addTransaction', {
'id': '1234', // Transaction ID. Required.
'affiliation': 'Acme Clothing', // Affiliation or store name.
'revenue': '11.99', // Grand Total.
'shipping': '5', // Shipping.
'tax': '1.29' // Tax.
});
ga('ecommerce:addItem', {
'id': '1234', // Transaction ID. Required.
'name': 'Fluffy Pink Bunnies', // Product name. Required.
'sku': 'DD23444', // SKU/code.
'category': 'Party Toys', // Category or variation.
'price': '11.99', // Unit price.
'quantity': '1' // Quantity.
});
ga('ecommerce:send');
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment