addition of code ecommerce

This commit is contained in:
Marion Muszynski 2016-09-20 16:47:05 +02:00
parent ed769a1749
commit 5cf235d874

View File

@ -85,9 +85,23 @@
})(window,document,'script','//www.google-analytics.com/analytics.js','ga'); })(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-30665119-1', 'auto'); ga('create', 'UA-30665119-1', 'auto');
{/literal}{if isset($page_name) && $page_name == 'order'}{literal} {/literal}{if isset($page_name) && $page_name == 'order'}{literal}
ga('require', 'ec'); ga('require', 'ec');
{/literal}{if $step == 0}{literal} {/literal}{if $step == 0}{literal}
{/literal}{if $cart}
{assign var='cartProducts' value=$cart->getProducts()}{literal}
{/literal}{foreach from=$cartProducts item=cartProduct}{literal}
ga('ec:addProduct', {
'id': {/literal}{$cartProduct['id_product']}{literal},
'name': '{/literal}{$cartProduct['name']}{literal}',
'category': '{/literal}{$cartProduct['category']}{literal}',
'price': {/literal}{Tools::ps_round(Product::getPriceStatic((int)$cartProduct['id_product'], true, ((isset($cartProduct['id_product_attribute']) AND !empty($cartProduct['id_product_attribute'])) ? (int)($cartProduct['id_product_attribute']) : NULL), 2), 2)}{literal},
'quantity': {/literal}{$cartProduct['cart_quantity']}{literal}
});
{/literal}{/foreach}{literal}
{/literal}{/if}{literal}
ga('ec:setAction','checkout', { ga('ec:setAction','checkout', {
'step': 1, 'step': 1,
}); });
@ -101,10 +115,11 @@
}); });
{/literal}{else if $step == 3}{literal} {/literal}{else if $step == 3}{literal}
ga('ec:setAction','checkout', { ga('ec:setAction','checkout', {
'step': 3, 'step': 4,
}); });
{/literal}{/if} {/literal}{/if}
{/if}{literal} {/if}{literal}
ga('send', 'pageview'); ga('send', 'pageview');
</script> </script>
{/literal} {/literal}