avoid js errors because of empty NoBounceEventTime, tpl blocks added
Cette révision appartient à :
Parent
d760ff512b
révision
3742b80fb3
@ -173,11 +173,9 @@
|
||||
[{/if}]
|
||||
|
||||
[{* bounce optimization*}]
|
||||
[{block name="d3ga_bounceoptimzation"}]
|
||||
[{block name="d3ga_bounceoptimization"}]
|
||||
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
|
||||
[{if $oD3GASettings->getValue('iSendNoBounceEventTime')}]
|
||||
setTimeout('_gaq.push([\'_trackEvent\', \'NoBounce\', \'Over defined seconds\'])',[{$oD3GASettings->getValue('iSendNoBounceEventTime')}]);
|
||||
[{/if}]
|
||||
setTimeout('_gaq.push([\'_trackEvent\', \'NoBounce\', \'Over defined seconds\'])',[{$iD3GASendNoBounceEventTime}]);
|
||||
|
||||
[{if $oD3GASettings->getValue('blSendNoBounceEventScroll')}]
|
||||
window.addEventListener ?
|
||||
|
@ -2,18 +2,20 @@
|
||||
[{capture name="d3GATrackCode"}]
|
||||
[{strip}]
|
||||
[{if $oD3GASettings->getValue('blD3GAUseOptOut')}]
|
||||
<script type="text/javascript">
|
||||
var gaProperty = '[{$oD3GASettings->getValue('sD3GAId')}]';
|
||||
var disableStr = 'ga-disable-' + gaProperty;
|
||||
if (document.cookie.indexOf(disableStr + '=true') > -1) {
|
||||
window[disableStr] = true;
|
||||
}
|
||||
[{block name="d3ga_optoutscript"}]
|
||||
<script type="text/javascript">
|
||||
var gaProperty = '[{$oD3GASettings->getValue('sD3GAId')}]';
|
||||
var disableStr = 'ga-disable-' + gaProperty;
|
||||
if (document.cookie.indexOf(disableStr + '=true') > -1) {
|
||||
window[disableStr] = true;
|
||||
}
|
||||
|
||||
function gaOptout() {
|
||||
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
|
||||
window[disableStr] = true;
|
||||
}
|
||||
</script>
|
||||
function gaOptout() {
|
||||
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
|
||||
window[disableStr] = true;
|
||||
}
|
||||
</script>
|
||||
[{/block}]
|
||||
[{/if}]
|
||||
|
||||
<script type="text/javascript">
|
||||
@ -52,11 +54,9 @@
|
||||
[{/if}]
|
||||
|
||||
[{* bounce optimization*}]
|
||||
[{block name="d3ga_bounceoptimzation"}]
|
||||
[{block name="d3ga_bounceoptimization"}]
|
||||
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
|
||||
[{if $oD3GASettings->getValue('iSendNoBounceEventTime')}]
|
||||
setTimeout('ga(\'send\', \'event\', \'NoBounce\', \'Over defined seconds\')',[{$oD3GASettings->getValue('iSendNoBounceEventTime')}]);
|
||||
[{/if}]
|
||||
setTimeout('ga(\'send\', \'event\', \'NoBounce\', \'Over defined seconds\')',[{$iD3GASendNoBounceEventTime}]);
|
||||
|
||||
[{if $oD3GASettings->getValue('blSendNoBounceEventScroll')}]
|
||||
window.addEventListener ?
|
||||
@ -79,21 +79,23 @@
|
||||
[{include file="d3ga_universal_ecommerce.tpl"}]
|
||||
|
||||
[{if $oD3GASettings->getValue('blD3GATrackPageLoadTime')}]
|
||||
var perfData = window.performance.timing;
|
||||
var pageLoadTime = perfData.domComplete - perfData.navigationStart;
|
||||
var loadTime = "";
|
||||
[{block name="d3ga_trackpageloadtime"}]
|
||||
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"; }
|
||||
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});*}]
|
||||
ga('set', 'metric1', loadTime);
|
||||
[{*ga('send', 'event', 'Page Load Time', loadTime, {'nonInteraction': true});*}]
|
||||
[{/block}]
|
||||
[{/if}]
|
||||
</script>
|
||||
|
||||
|
@ -53,6 +53,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
||||
$oParentView->addTplParam('sD3GASendPageViewParameter', $this->d3getSendPageViewParameters());
|
||||
$oParentView->addTplParam('sD3CurrentShopUrl', $this->d3GetCreateCurrentShopUrl());
|
||||
$oParentView->addTplParam('blD3GAIsMobile', $this->d3isMobile());
|
||||
$oParentView->addTplParam('iD3GASendNoBounceEventTime', $this->d3GetSendNoBounceEventTime());
|
||||
|
||||
if ($oSet->getValue('sD3GATSActive') && $oSet->getValue('sD3GATSShoppingActive')) {
|
||||
$aInfos = $this->d3GATSGetProdInfos();
|
||||
@ -566,4 +567,18 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function d3GetSendNoBounceEventTime()
|
||||
{
|
||||
$iTime = d3_cfg_mod::get($this->_sModId)->getValue('iSendNoBounceEventTime');
|
||||
|
||||
if (isset($iTime) && is_int($iTime)) {
|
||||
return $iTime;
|
||||
}
|
||||
|
||||
return 10000;
|
||||
}
|
||||
}
|
||||
|
Chargement…
Référencer dans un nouveau ticket
Block a user