GoogleServices/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/d3ga_universal.tpl

65 lines
2.7 KiB
Smarty
Raw Normal View History

2014-05-02 16:58:43 +02:00
[{if $blD3GoogleAnalyticsActive && $oD3GASettings->getValue('sD3GAId')}]
[{capture name="d3GATrackCode"}]
[{strip}]
<script type="text/javascript">
(function(i,s,o,g,r,a,m){
i['GoogleAnalyticsObject']=r;
i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)
},
i[r].l=1*new Date();
a=s.createElement(o),
m=s.getElementsByTagName(o)[0];
a.async=1;
a.src=g;
m.parentNode.insertBefore(a,m)
})(
window,document,'script','//www.google-analytics.com/analytics.js','ga'
2014-05-02 16:58:43 +02:00
);
ga('create', '[{$oD3GASettings->getValue('sD3GAId')}]', '[{$sD3CurrentShopUrl}]' [{$sD3GACreateParameter}]);
2014-05-02 16:58:43 +02:00
[{if $oD3GASettings->getValue('blD3GAAnonymizeIP')}]
ga('set', 'anonymizeIp', true);
2014-05-02 16:58:43 +02:00
[{/if}]
[{include file="d3ga_universal_adwords.tpl"}]
2014-05-02 16:58:43 +02:00
[{include file="d3ga_universal_custom.tpl"}]
2014-05-02 23:12:23 +02:00
[{if $oD3GASettings->getValue('blD3GAUseRemarketing')}]
ga('require', 'displayfeatures');
2014-05-02 23:12:23 +02:00
[{/if}]
ga('send', 'pageview' [{$sD3GASendPageViewParameter}]);
2014-05-02 16:58:43 +02:00
[{if $oD3GASettings->getValue('blD3GATrackPageLoadTime')}]
var perfData = window.performance.timing;
var pageLoadTime = perfData.domComplete - perfData.navigationStart;
var loadTime = "";
if (pageLoadTime < 1000) { loadTime = "0-1 seconds"; }
else if (pageLoadTime < 2000) { loadTime = "1-2 seconds"; }
else if (pageLoadTime < 3000) { loadTime = "2-3 seconds"; }
else if (pageLoadTime < 4000) { loadTime = "3-4 seconds"; }
else if (pageLoadTime < 5000) { loadTime = "4-5 seconds"; }
else if (pageLoadTime < 6000) { loadTime = "5-6 seconds"; }
else if (pageLoadTime < 10000) { loadTime = "6-10 seconds"; }
else { loadTime = "10+ seconds"; }
ga('set', 'metric1', loadTime);
[{*ga('send', 'event', 'Page Load Time', loadTime, {'nonInteraction': true});*}]
2014-05-02 16:58:43 +02:00
[{/if}]
[{include file="d3ga_universal_ecommerce.tpl"}]
</script>
[{/strip}]
[{/capture}]
[{if $oViewConf->getActiveClassName() == 'thankyou'}]
[{$oView->logCode($smarty.capture.d3GATrackCode)}]
[{/if}]
[{$smarty.capture.d3GATrackCode}]
[{/if}]