avoid js errors because of empty NoBounceEventTime, tpl blocks added
This commit is contained in:
parent
d760ff512b
commit
3742b80fb3
@ -173,11 +173,9 @@
|
|||||||
[{/if}]
|
[{/if}]
|
||||||
|
|
||||||
[{* bounce optimization*}]
|
[{* bounce optimization*}]
|
||||||
[{block name="d3ga_bounceoptimzation"}]
|
[{block name="d3ga_bounceoptimization"}]
|
||||||
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
|
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
|
||||||
[{if $oD3GASettings->getValue('iSendNoBounceEventTime')}]
|
setTimeout('_gaq.push([\'_trackEvent\', \'NoBounce\', \'Over defined seconds\'])',[{$iD3GASendNoBounceEventTime}]);
|
||||||
setTimeout('_gaq.push([\'_trackEvent\', \'NoBounce\', \'Over defined seconds\'])',[{$oD3GASettings->getValue('iSendNoBounceEventTime')}]);
|
|
||||||
[{/if}]
|
|
||||||
|
|
||||||
[{if $oD3GASettings->getValue('blSendNoBounceEventScroll')}]
|
[{if $oD3GASettings->getValue('blSendNoBounceEventScroll')}]
|
||||||
window.addEventListener ?
|
window.addEventListener ?
|
||||||
|
@ -2,18 +2,20 @@
|
|||||||
[{capture name="d3GATrackCode"}]
|
[{capture name="d3GATrackCode"}]
|
||||||
[{strip}]
|
[{strip}]
|
||||||
[{if $oD3GASettings->getValue('blD3GAUseOptOut')}]
|
[{if $oD3GASettings->getValue('blD3GAUseOptOut')}]
|
||||||
<script type="text/javascript">
|
[{block name="d3ga_optoutscript"}]
|
||||||
var gaProperty = '[{$oD3GASettings->getValue('sD3GAId')}]';
|
<script type="text/javascript">
|
||||||
var disableStr = 'ga-disable-' + gaProperty;
|
var gaProperty = '[{$oD3GASettings->getValue('sD3GAId')}]';
|
||||||
if (document.cookie.indexOf(disableStr + '=true') > -1) {
|
var disableStr = 'ga-disable-' + gaProperty;
|
||||||
window[disableStr] = true;
|
if (document.cookie.indexOf(disableStr + '=true') > -1) {
|
||||||
}
|
window[disableStr] = true;
|
||||||
|
}
|
||||||
|
|
||||||
function gaOptout() {
|
function gaOptout() {
|
||||||
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
|
document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/';
|
||||||
window[disableStr] = true;
|
window[disableStr] = true;
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
[{/block}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
@ -52,11 +54,9 @@
|
|||||||
[{/if}]
|
[{/if}]
|
||||||
|
|
||||||
[{* bounce optimization*}]
|
[{* bounce optimization*}]
|
||||||
[{block name="d3ga_bounceoptimzation"}]
|
[{block name="d3ga_bounceoptimization"}]
|
||||||
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
|
[{if $oD3GASettings->getValue('blUseBounceRateOptimization')}]
|
||||||
[{if $oD3GASettings->getValue('iSendNoBounceEventTime')}]
|
setTimeout('ga(\'send\', \'event\', \'NoBounce\', \'Over defined seconds\')',[{$iD3GASendNoBounceEventTime}]);
|
||||||
setTimeout('ga(\'send\', \'event\', \'NoBounce\', \'Over defined seconds\')',[{$oD3GASettings->getValue('iSendNoBounceEventTime')}]);
|
|
||||||
[{/if}]
|
|
||||||
|
|
||||||
[{if $oD3GASettings->getValue('blSendNoBounceEventScroll')}]
|
[{if $oD3GASettings->getValue('blSendNoBounceEventScroll')}]
|
||||||
window.addEventListener ?
|
window.addEventListener ?
|
||||||
@ -79,21 +79,23 @@
|
|||||||
[{include file="d3ga_universal_ecommerce.tpl"}]
|
[{include file="d3ga_universal_ecommerce.tpl"}]
|
||||||
|
|
||||||
[{if $oD3GASettings->getValue('blD3GATrackPageLoadTime')}]
|
[{if $oD3GASettings->getValue('blD3GATrackPageLoadTime')}]
|
||||||
var perfData = window.performance.timing;
|
[{block name="d3ga_trackpageloadtime"}]
|
||||||
var pageLoadTime = perfData.domComplete - perfData.navigationStart;
|
var perfData = window.performance.timing;
|
||||||
var loadTime = "";
|
var pageLoadTime = perfData.domComplete - perfData.navigationStart;
|
||||||
|
var loadTime = "";
|
||||||
|
|
||||||
if (pageLoadTime < 1000) { loadTime = "0-1 seconds"; }
|
if (pageLoadTime < 1000) { loadTime = "0-1 seconds"; }
|
||||||
else if (pageLoadTime < 2000) { loadTime = "1-2 seconds"; }
|
else if (pageLoadTime < 2000) { loadTime = "1-2 seconds"; }
|
||||||
else if (pageLoadTime < 3000) { loadTime = "2-3 seconds"; }
|
else if (pageLoadTime < 3000) { loadTime = "2-3 seconds"; }
|
||||||
else if (pageLoadTime < 4000) { loadTime = "3-4 seconds"; }
|
else if (pageLoadTime < 4000) { loadTime = "3-4 seconds"; }
|
||||||
else if (pageLoadTime < 5000) { loadTime = "4-5 seconds"; }
|
else if (pageLoadTime < 5000) { loadTime = "4-5 seconds"; }
|
||||||
else if (pageLoadTime < 6000) { loadTime = "5-6 seconds"; }
|
else if (pageLoadTime < 6000) { loadTime = "5-6 seconds"; }
|
||||||
else if (pageLoadTime < 10000) { loadTime = "6-10 seconds"; }
|
else if (pageLoadTime < 10000) { loadTime = "6-10 seconds"; }
|
||||||
else { loadTime = "10+ seconds"; }
|
else { loadTime = "10+ seconds"; }
|
||||||
|
|
||||||
ga('set', 'metric1', loadTime);
|
ga('set', 'metric1', loadTime);
|
||||||
[{*ga('send', 'event', 'Page Load Time', loadTime, {'nonInteraction': true});*}]
|
[{*ga('send', 'event', 'Page Load Time', loadTime, {'nonInteraction': true});*}]
|
||||||
|
[{/block}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
|
@ -53,6 +53,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
$oParentView->addTplParam('sD3GASendPageViewParameter', $this->d3getSendPageViewParameters());
|
$oParentView->addTplParam('sD3GASendPageViewParameter', $this->d3getSendPageViewParameters());
|
||||||
$oParentView->addTplParam('sD3CurrentShopUrl', $this->d3GetCreateCurrentShopUrl());
|
$oParentView->addTplParam('sD3CurrentShopUrl', $this->d3GetCreateCurrentShopUrl());
|
||||||
$oParentView->addTplParam('blD3GAIsMobile', $this->d3isMobile());
|
$oParentView->addTplParam('blD3GAIsMobile', $this->d3isMobile());
|
||||||
|
$oParentView->addTplParam('iD3GASendNoBounceEventTime', $this->d3GetSendNoBounceEventTime());
|
||||||
|
|
||||||
if ($oSet->getValue('sD3GATSActive') && $oSet->getValue('sD3GATSShoppingActive')) {
|
if ($oSet->getValue('sD3GATSActive') && $oSet->getValue('sD3GATSShoppingActive')) {
|
||||||
$aInfos = $this->d3GATSGetProdInfos();
|
$aInfos = $this->d3GATSGetProdInfos();
|
||||||
@ -566,4 +567,18 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
|
|||||||
|
|
||||||
return false;
|
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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user