31 lines
973 B
Smarty
Executable File
31 lines
973 B
Smarty
Executable File
<script type="text/javascript">
|
|
{if $isOrder eq true}
|
|
|
|
ga('require', 'ecommerce', 'ecommerce.js');
|
|
|
|
ga('ecommerce:addTransaction', {
|
|
'id': '{$trans.id}', // Transaction ID. Required
|
|
'affiliation': '{$trans.store}', // Affiliation or store name.
|
|
'revenue': '{$trans.total}', // Grand Total.
|
|
'shipping': '{$trans.shipping}', // Shipping.
|
|
'tax': '{$trans.tax}' // Tax.
|
|
});
|
|
|
|
{foreach from=$items item=item}
|
|
ga('ecommerce:addItem', {
|
|
'id': '{$item.OrderId}', // Transaction ID. Required.
|
|
'name': '{$item.Product}', // Product name. Required.
|
|
'sku': 'DD23444', // SKU/code.
|
|
'category': '{$item.Category}', // Category or variation.
|
|
'price': '{$item.Price}', // Unit price.
|
|
'quantity': '{$item.Quantity}' // Quantity.
|
|
});
|
|
{/foreach}
|
|
|
|
ga('ecommerce:send');
|
|
ga('ecommerce:clear');
|
|
|
|
{/if}
|
|
|
|
</script>
|