Need help implementing Google Analytics Code to track C5 E-Commerce transactions

Permalink
I've done enough research to see that others have asked this question and don't seem to have had it answered yet. I chatted with a Google Help person today about it and this is an excerpt from the conversation. Can someone please help translate this into a "this is what you copy and paste, exactly as written" to accomplish basic ecommerce tracking?

Should be very doable

Most platforms have add-ons specifically for this, such as WooCommerce on WP but it's not hard, basically adding a JS on the product pages such as:
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. });


... with the variable values populated by the CMS, such as in PHP like:
ga('ecommerce:addItem', { 
'id': '<?= $id ?>', // Transaction ID. Required. 
'name': '<?= $name ?>', // Product name. Required. 
'sku': '<?= $sku ?>', // SKU/code. 
'category': '<?= $category ?>', // Category or variation. 
'price': '<?= $price ?>', // Unit price. 
'quantity': '<?= $quantity ?>' // Quantity. });


...it's a push event written out by your server-side scripting server generating the JS which is then triggered by the user action

barkingtuna