From 3742b80fb3ad82cb8bd962f0ff03ef6951ba307b Mon Sep 17 00:00:00 2001 From: DanielSeifert Date: Wed, 3 Jun 2015 07:57:45 +0000 Subject: [PATCH] avoid js errors because of empty NoBounceEventTime, tpl blocks added --- .../views/tpl/widget/d3_googleanalytics.tpl | 6 +- .../views/tpl/widget/d3ga_universal.tpl | 58 ++++++++++--------- .../d3_oxcmp_utils_googleanalytics.php | 15 +++++ 3 files changed, 47 insertions(+), 32 deletions(-) diff --git a/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/d3_googleanalytics.tpl b/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/d3_googleanalytics.tpl index f7d9818..04bf4b7 100644 --- a/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/d3_googleanalytics.tpl +++ b/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/d3_googleanalytics.tpl @@ -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 ? diff --git a/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/d3ga_universal.tpl b/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/d3ga_universal.tpl index ca4f8f7..d89a856 100644 --- a/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/d3ga_universal.tpl +++ b/changed_full/470-/modules/d3/d3_googleanalytics/views/tpl/widget/d3ga_universal.tpl @@ -2,18 +2,20 @@ [{capture name="d3GATrackCode"}] [{strip}] [{if $oD3GASettings->getValue('blD3GAUseOptOut')}] - + function gaOptout() { + document.cookie = disableStr + '=true; expires=Thu, 31 Dec 2099 23:59:59 UTC; path=/'; + window[disableStr] = true; + } + + [{/block}] [{/if}] diff --git a/copy_this/modules/d3/d3_googleanalytics/modules/components/d3_oxcmp_utils_googleanalytics.php b/copy_this/modules/d3/d3_googleanalytics/modules/components/d3_oxcmp_utils_googleanalytics.php index 25955f2..32bd95e 100644 --- a/copy_this/modules/d3/d3_googleanalytics/modules/components/d3_oxcmp_utils_googleanalytics.php +++ b/copy_this/modules/d3/d3_googleanalytics/modules/components/d3_oxcmp_utils_googleanalytics.php @@ -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; + } }