bebeboutik/modules/ganalytics/header_old.tpl
Srv Bebeboutik 6c0978166c add modules
2016-01-04 12:49:26 +01:00

41 lines
1.6 KiB
Smarty
Executable File

<script type="text/javascript">
var _gaq = _gaq || [];
_gaq.push(['_setAccount', '{$ganalytics_id}']);
{if isset($pageTrack)}_gaq.push(['_trackPageview', '{$pageTrack}']);{/if}
_gaq.push(['_trackPageLoadTime']);
{if $isOrder eq true} {* If it's an order we need more data for stats *}
_gaq.push(['_addTrans',
'{$trans.id}', {* order ID - required *}
'{$trans.store}', {* affiliation or store name *}
'{$trans.total}', {* total - required *}
'{$trans.tax}', {* tax *}
'{$trans.shipping}', {* shipping *}
'{$trans.city}', {* city *}
'{$trans.state}', {* state or province *}
'{$trans.country}' {* country *}
]);
{foreach from=$items item=item}
_gaq.push(['_addItem',
'{$item.OrderId}', {* order ID - required *}
'{$item.SKU}', {* SKU/code - required *}
'{$item.Product}', {* product name *}
'{$item.Category}', {* category or variation *}
'{$item.Price}', {* unit price - required *}
'{$item.Quantity}' {* quantity - required *}
]);
{/foreach}
{* submits transaction to the Analytics servers *}
{literal}
_gaq.push(['_trackTrans']);
{/literal}
{/if}
{literal}
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;{/literal}
{*ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';*}
ga.src = ('https:' == document.location.protocol ? 'https://' : 'http://') + 'stats.g.doubleclick.net/dc.js';{literal}
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})(); {/literal}
</script>