Page 1 of 1

google tracking code help needed

Posted: Fri Apr 20, 2018 2:40 am
by oclvr
Hello, Google ask me to past the following product tracking code, please help me to fill up dynamic variable. We run OC Version 2.3.0.2.
<script>

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>

Re: google tracking code help needed

Posted: Fri Apr 20, 2018 2:51 am
by straightlight
The best location to add such code would be in your own JS file where the confirm() method of your order total extension module could initiate based on the completed checkout process when the customer hits the confirm button.