2011-02-27 00:25:02 +01:00
|
|
|
<?php
|
|
|
|
|
2012-12-21 11:20:32 +01:00
|
|
|
/**
|
|
|
|
* This module is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This module is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* For further informations, see <http://www.gnu.org/licenses/>.
|
|
|
|
*
|
|
|
|
* @link http://www.oxidmodule.com
|
|
|
|
* @link http://www.shopmodule.com
|
2013-02-21 14:49:05 +01:00
|
|
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
2012-12-21 11:20:32 +01:00
|
|
|
*/
|
|
|
|
|
2013-02-21 14:51:41 +01:00
|
|
|
class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_parent
|
2011-02-27 00:25:02 +01:00
|
|
|
{
|
2011-02-27 21:21:16 +01:00
|
|
|
private $_sModId = 'd3_googleanalytics';
|
2012-12-21 11:17:54 +01:00
|
|
|
|
2014-05-09 10:40:33 +02:00
|
|
|
public $aD3GAPageTypes = array(
|
|
|
|
'start' => 'home',
|
|
|
|
'search' => 'searchresults',
|
|
|
|
'alist' => 'category',
|
|
|
|
'manufacturerlist' => 'category',
|
|
|
|
'vendorlist' => 'category',
|
|
|
|
'details' => 'product',
|
|
|
|
'basket' => 'cart',
|
|
|
|
'order' => 'purchase',
|
|
|
|
);
|
|
|
|
|
2012-12-21 11:20:32 +01:00
|
|
|
/**
|
|
|
|
* @return null
|
|
|
|
*/
|
2011-02-27 00:25:02 +01:00
|
|
|
public function render()
|
|
|
|
{
|
|
|
|
$ret = parent::render();
|
|
|
|
|
2014-05-09 10:40:33 +02:00
|
|
|
$oSet = d3_cfg_mod::get($this->_d3getModId());
|
|
|
|
|
2014-06-05 11:21:20 +02:00
|
|
|
if ($oSet->isActive()) {
|
|
|
|
/** @var $oParentView oxView */
|
|
|
|
$oParentView = $this->getParent();
|
|
|
|
$oParentView->addTplParam('blD3GoogleAnalyticsActive', $oSet->isActive());
|
|
|
|
$oParentView->addTplParam('oD3GASettings', $oSet);
|
|
|
|
$oParentView->addTplParam('sD3GATTpl', $this->d3getGATTpl());
|
|
|
|
$oParentView->addTplParam('sD3GACreateParameter', $this->d3getCreateParameters());
|
|
|
|
$oParentView->addTplParam('sAFEGetMoreUrls', $this->afGetMoreUrls());
|
|
|
|
$oParentView->addTplParam('sD3GASendPageViewParameter', $this->d3getSendPageViewParameters());
|
|
|
|
$oParentView->addTplParam('sD3CurrentShopUrl', $this->d3GetCreateCurrentShopUrl());
|
2014-10-20 13:39:32 +02:00
|
|
|
$oParentView->addTplParam('blD3GAIsMobile', $this->d3isMobile());
|
2015-06-03 09:57:45 +02:00
|
|
|
$oParentView->addTplParam('iD3GASendNoBounceEventTime', $this->d3GetSendNoBounceEventTime());
|
2014-10-16 17:57:12 +02:00
|
|
|
|
2015-07-28 15:13:19 +02:00
|
|
|
if ($oSet->getValue('sD3GATSActive')) {
|
|
|
|
$oParentView->addTplParam('sD3CurrentGTSLang', $this->d3GetGTSLang());
|
|
|
|
}
|
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
if ($oSet->getValue('sD3GATSActive') && $oSet->getValue('sD3GATSShoppingActive')) {
|
|
|
|
$aInfos = $this->d3GATSGetProdInfos();
|
|
|
|
$oParentView->addTplParam('sD3GATSProdId', $this->d3GATSGetProdIdList($aInfos['aArtIdList']));
|
|
|
|
}
|
2014-06-05 11:21:20 +02:00
|
|
|
|
|
|
|
if ($oSet->getValue('blD3GASetRemarketing')) {
|
|
|
|
$aInfos = $this->d3GetGAProdInfos();
|
|
|
|
$oParentView->addTplParam('sD3GARemarketingProdId', $this->d3GetGAProdIdList($aInfos['aArtIdList']));
|
|
|
|
$oParentView->addTplParam(
|
|
|
|
'sD3GARemarketingPrice',
|
|
|
|
$aInfos['dPrice'] > 0 ? number_format($aInfos['dPrice'], 2, '.', ''): ''
|
|
|
|
);
|
|
|
|
$oParentView->addTplParam('sD3GARemarketingPageType', $this->d3GetGAPageType());
|
|
|
|
}
|
2014-05-09 10:40:33 +02:00
|
|
|
}
|
|
|
|
|
2011-02-27 00:25:02 +01:00
|
|
|
return $ret;
|
|
|
|
}
|
2013-02-21 14:49:05 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2013-04-24 12:40:35 +02:00
|
|
|
private function _d3getModId()
|
2013-02-21 14:49:05 +01:00
|
|
|
{
|
|
|
|
return $this->_sModId;
|
|
|
|
}
|
2014-05-02 16:58:43 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function d3getGATTpl()
|
|
|
|
{
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'async') {
|
|
|
|
return 'd3_googleanalytics.tpl';
|
|
|
|
}
|
|
|
|
|
|
|
|
return 'd3ga_universal.tpl';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
2014-06-05 11:21:20 +02:00
|
|
|
public function d3GetCreateCurrentShopUrl()
|
2014-05-02 16:58:43 +02:00
|
|
|
{
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
|
2014-06-05 11:21:20 +02:00
|
|
|
return 'auto';
|
2014-05-02 16:58:43 +02:00
|
|
|
}
|
2014-06-05 11:21:20 +02:00
|
|
|
|
2014-10-13 16:56:53 +02:00
|
|
|
return $this->d3GetCurrentShopUrl();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function d3GetCurrentShopUrl()
|
|
|
|
{
|
2014-06-05 11:21:20 +02:00
|
|
|
return oxRegistry::getConfig()->getActiveShop()->getFieldData('oxurl');
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function afGetMoreUrls()
|
|
|
|
{
|
|
|
|
if (false == d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
|
|
|
|
return '';
|
2014-05-05 16:49:37 +02:00
|
|
|
}
|
2014-06-05 11:21:20 +02:00
|
|
|
|
|
|
|
$sSeparator = ',';
|
|
|
|
|
|
|
|
return implode($sSeparator, $this->_d3GetNonBaseLanguageUrls());
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function _d3GetNonBaseLanguageUrls()
|
|
|
|
{
|
|
|
|
$myConfig = oxRegistry::getConfig();
|
|
|
|
$aLanguageUrls = $myConfig->getConfigParam('aLanguageURLs');
|
2014-07-24 11:21:40 +02:00
|
|
|
$aSslLanguageUrls = $myConfig->getConfigParam('aLanguageSSLURLs');
|
2014-06-05 11:21:20 +02:00
|
|
|
|
2014-07-24 11:21:40 +02:00
|
|
|
$aUrls = array();
|
2014-06-05 11:21:20 +02:00
|
|
|
if ($myConfig->getConfigParam('bl_perfLoadLanguages')) {
|
|
|
|
$aLanguages = oxRegistry::getLang()->getLanguageArray(null, true, true);
|
|
|
|
reset($aLanguages);
|
2014-07-24 11:21:40 +02:00
|
|
|
foreach ($aLanguages as $oVal) {
|
2014-11-25 09:52:46 +01:00
|
|
|
$this->_d3AddLanguageUrlsToList($aLanguageUrls, $oVal, $aSslLanguageUrls, $aUrls);
|
2014-06-05 11:21:20 +02:00
|
|
|
}
|
2014-05-05 15:50:01 +02:00
|
|
|
}
|
2014-05-02 16:58:43 +02:00
|
|
|
|
2014-11-25 09:52:46 +01:00
|
|
|
$this->_d3UnsetCurrentUrl($aUrls);
|
|
|
|
|
2014-06-05 11:21:20 +02:00
|
|
|
return $aUrls;
|
|
|
|
}
|
|
|
|
|
2014-07-24 11:21:40 +02:00
|
|
|
/**
|
|
|
|
* @param $aLanguageUrls
|
|
|
|
* @param $oVal
|
|
|
|
* @param $aSslLanguageUrls
|
|
|
|
* @param $aUrls
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
2014-11-25 09:52:46 +01:00
|
|
|
protected function _d3AddLanguageUrlsToList($aLanguageUrls, $oVal, $aSslLanguageUrls, &$aUrls)
|
2014-07-24 11:21:40 +02:00
|
|
|
{
|
2014-07-24 11:39:57 +02:00
|
|
|
$blIsSsl = oxRegistry::getConfig()->isSsl();
|
2014-07-24 11:21:40 +02:00
|
|
|
|
2014-07-24 11:39:57 +02:00
|
|
|
if ($this->_d3CheckLanguageUrlsToList($aLanguageUrls, $oVal, $blIsSsl)) {
|
2014-11-25 09:52:46 +01:00
|
|
|
$sUrl = $this->_d3GANormalizeUrl($aLanguageUrls[$oVal->id]);
|
|
|
|
$aUrls[md5($sUrl)] = "'" . $sUrl . "'";
|
2014-07-24 11:21:40 +02:00
|
|
|
}
|
|
|
|
|
2014-07-24 11:39:57 +02:00
|
|
|
if ($this->_d3CheckLanguageUrlsToList($aSslLanguageUrls, $oVal, !$blIsSsl)) {
|
2014-11-25 09:52:46 +01:00
|
|
|
$sSslUrl = $this->_d3GANormalizeUrl($aLanguageUrls[$oVal->id]);
|
|
|
|
$aUrls[md5($sSslUrl)] = "'" . $sSslUrl . "'";
|
2014-07-24 11:21:40 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return $aUrls;
|
|
|
|
}
|
|
|
|
|
2014-11-25 09:52:46 +01:00
|
|
|
/**
|
|
|
|
* @param $sUrl
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
protected function _d3GANormalizeUrl($sUrl)
|
|
|
|
{
|
|
|
|
$sPattern = "^http(s?)://";
|
|
|
|
/** @var d3str $oD3Str */
|
|
|
|
$oD3Str = oxNew('d3str');
|
|
|
|
|
|
|
|
return preg_replace('@'.$sPattern.'@', '', $oD3Str->untrailingslashit($sUrl));
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $aUrls
|
|
|
|
*/
|
|
|
|
protected function _d3UnsetCurrentUrl(&$aUrls)
|
|
|
|
{
|
|
|
|
unset($aUrls[md5($this->_d3GANormalizeUrl(oxRegistry::getConfig()->getCurrentShopUrl()))]);
|
|
|
|
}
|
|
|
|
|
2014-07-24 11:39:57 +02:00
|
|
|
/**
|
|
|
|
* @param $aLanguageUrls
|
|
|
|
* @param $oVal
|
|
|
|
* @param $blIsSsl
|
|
|
|
*
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
protected function _d3CheckLanguageUrlsToList($aLanguageUrls, $oVal, $blIsSsl)
|
|
|
|
{
|
|
|
|
return $blIsSsl || $aLanguageUrls[$oVal->id] != $aLanguageUrls[oxRegistry::getLang()->getBaseLanguage()];
|
|
|
|
}
|
|
|
|
|
2014-06-05 11:21:20 +02:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function d3getCreateParameters()
|
|
|
|
{
|
|
|
|
$aParameter = array();
|
|
|
|
|
|
|
|
$aParameter = $this->_d3getCreateDomainNameParameter($aParameter);
|
|
|
|
$aParameter = $this->_d3getCreateCookiePathParameter($aParameter);
|
|
|
|
$aParameter = $this->_d3getCreateDomainLinkerParameter($aParameter);
|
|
|
|
$aParameter = $this->_d3getCreateSpeedSamplerateParameter($aParameter);
|
|
|
|
$aParameter = $this->_d3getCreateSamplerateParameter($aParameter);
|
|
|
|
|
2014-05-02 16:58:43 +02:00
|
|
|
if (count($aParameter)) {
|
|
|
|
return ", {".implode(',', $aParameter)."}";
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function d3getSendPageViewParameters()
|
2014-05-05 15:50:01 +02:00
|
|
|
{
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GAType') == 'async') {
|
|
|
|
return $this->_d3getAsyncSendpageViewParameters();
|
|
|
|
}
|
|
|
|
|
|
|
|
return $this->_d3getUniversalSendPageViewParameters();
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
protected function _d3getAsyncSendpageViewParameters()
|
2014-05-02 16:58:43 +02:00
|
|
|
{
|
|
|
|
$aParameter = array();
|
|
|
|
|
2014-05-05 15:50:01 +02:00
|
|
|
/** @var oxUBase $oCurrentView */
|
|
|
|
$oCurrentView = oxRegistry::getConfig()->getActiveView();
|
|
|
|
$oCurrentView->getIsOrderStep();
|
|
|
|
|
2014-06-05 11:21:20 +02:00
|
|
|
$aParameter = $this->_d3getAsynchSendpageViewClassParameter($oCurrentView, $aParameter);
|
2014-05-05 15:50:01 +02:00
|
|
|
|
|
|
|
if (count($aParameter)) {
|
|
|
|
return ", " . implode(',', $aParameter) . "";
|
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
2014-05-09 10:40:33 +02:00
|
|
|
}
|
2014-05-05 15:50:01 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
protected function _d3getUniversalSendPageViewParameters()
|
|
|
|
{
|
|
|
|
$aParameter = array();
|
|
|
|
|
|
|
|
/** @var oxUBase $oCurrentView */
|
|
|
|
$oCurrentView = oxRegistry::getConfig()->getActiveView();
|
|
|
|
$oCurrentView->getIsOrderStep();
|
|
|
|
|
2014-06-05 11:21:20 +02:00
|
|
|
$aParameter = $this->_d3getUniversalSendPageViewPageParameter($oCurrentView, $aParameter);
|
|
|
|
$aParameter = $this->_d3getUniversalSendPageViewDebugParameter($aParameter);
|
2014-05-02 16:58:43 +02:00
|
|
|
|
|
|
|
if (count($aParameter)) {
|
2014-05-05 15:50:01 +02:00
|
|
|
return ", {" . implode(',', $aParameter) . "}";
|
2014-05-02 16:58:43 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
return '';
|
|
|
|
}
|
2014-05-09 10:40:33 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
protected function _d3HasNoPageParameter()
|
|
|
|
{
|
|
|
|
if (strtolower($_SERVER['REQUEST_METHOD']) == 'post') {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function d3GetGAPageType()
|
|
|
|
{
|
|
|
|
$oCurrentView = oxRegistry::getConfig()->getActiveView();
|
|
|
|
|
|
|
|
if (is_array($this->aD3GAPageTypes) &&
|
|
|
|
isset($this->aD3GAPageTypes[strtolower($oCurrentView->getClassName())])
|
|
|
|
) {
|
|
|
|
return $this->aD3GAPageTypes[strtolower($oCurrentView->getClassName())];
|
|
|
|
};
|
|
|
|
|
|
|
|
return 'Siteview';
|
|
|
|
}
|
|
|
|
|
2014-10-13 16:56:53 +02:00
|
|
|
/**
|
|
|
|
* @return string
|
|
|
|
*/
|
|
|
|
public function d3GetGTSLang()
|
|
|
|
{
|
|
|
|
$aHomeCountries = oxRegistry::getConfig()->getConfigParam('aHomeCountry');
|
2014-11-20 12:18:50 +01:00
|
|
|
$aKeys = array_keys($aHomeCountries);
|
|
|
|
$sHomeCountryId = $aHomeCountries[current($aKeys)];
|
2014-10-13 16:56:53 +02:00
|
|
|
/** @var oxcountry $oCountry */
|
|
|
|
$oCountry = oxNew('oxcountry');
|
|
|
|
$oCountry->load($sHomeCountryId);
|
|
|
|
|
|
|
|
return strtolower(oxRegistry::getLang()->getLanguageAbbr()).'_'.
|
|
|
|
strtoupper($oCountry->getFieldData('OXISOALPHA2'));
|
|
|
|
}
|
|
|
|
|
2014-05-09 10:40:33 +02:00
|
|
|
/**
|
2014-10-16 17:57:12 +02:00
|
|
|
* @return array
|
2014-05-09 10:40:33 +02:00
|
|
|
*/
|
2014-10-16 17:57:12 +02:00
|
|
|
public function d3GATSGetProdInfos()
|
2014-05-09 10:40:33 +02:00
|
|
|
{
|
|
|
|
startProfile(__METHOD__);
|
|
|
|
|
|
|
|
$oCurrentView = oxRegistry::getConfig()->getActiveView();
|
|
|
|
|
|
|
|
$aArticleIds = array();
|
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
$sMethodName = 'get'.ucfirst($oCurrentView->getClassName())."ProdList";
|
|
|
|
$oArticleLister = oxNew('d3_google_trustedstore_articlelister');
|
2014-05-09 10:40:33 +02:00
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
if (method_exists($oArticleLister, $sMethodName)) {
|
2014-05-09 10:40:33 +02:00
|
|
|
stopProfile(__METHOD__);
|
2014-10-16 17:57:12 +02:00
|
|
|
return call_user_func(array($oArticleLister, $sMethodName), $oCurrentView);
|
2014-05-09 10:40:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
stopProfile(__METHOD__);
|
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
return array('aArtIdList' => $aArticleIds);
|
2014-05-09 10:40:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param array $aArticleIds
|
|
|
|
*
|
|
|
|
* @return string
|
|
|
|
*/
|
2014-10-16 17:57:12 +02:00
|
|
|
public function d3GATSGetProdIdList($aArticleIds)
|
2014-05-09 10:40:33 +02:00
|
|
|
{
|
|
|
|
if (count($aArticleIds)) {
|
2014-11-20 12:18:50 +01:00
|
|
|
$aKeys = array_keys($aArticleIds);
|
|
|
|
|
|
|
|
return $aArticleIds[current($aKeys)];
|
2014-05-09 10:40:33 +02:00
|
|
|
} else {
|
2014-10-17 09:34:22 +02:00
|
|
|
return "not_set";
|
2014-05-09 10:40:33 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-16 17:57:12 +02:00
|
|
|
* @return string
|
2014-05-09 10:40:33 +02:00
|
|
|
*/
|
2014-10-16 17:57:12 +02:00
|
|
|
public function d3GetGAProdInfos()
|
2014-05-09 10:40:33 +02:00
|
|
|
{
|
2014-10-16 17:57:12 +02:00
|
|
|
startProfile(__METHOD__);
|
2014-05-09 10:40:33 +02:00
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
$oCurrentView = oxRegistry::getConfig()->getActiveView();
|
2014-05-09 10:40:33 +02:00
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
$aArticleIds = array();
|
|
|
|
$dPrice = 0;
|
2014-05-09 10:40:33 +02:00
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
$sMethodName = 'get'.ucfirst($oCurrentView->getClassName())."ProdList";
|
|
|
|
$oArticleLister = oxNew('d3_google_remarketing_articlelister');
|
2014-05-09 10:40:33 +02:00
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
if (method_exists($oArticleLister, $sMethodName)) {
|
|
|
|
stopProfile(__METHOD__);
|
|
|
|
return call_user_func(array($oArticleLister, $sMethodName), $oCurrentView);
|
|
|
|
}
|
2014-05-09 10:40:33 +02:00
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
stopProfile(__METHOD__);
|
2014-05-09 10:40:33 +02:00
|
|
|
|
2014-10-16 17:57:12 +02:00
|
|
|
return array('aArtIdList' => $aArticleIds, 'dPrice' => $dPrice);
|
2014-05-09 10:40:33 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2014-10-16 17:57:12 +02:00
|
|
|
* @param array $aArticleIds
|
2014-05-09 10:40:33 +02:00
|
|
|
*
|
2014-10-16 17:57:12 +02:00
|
|
|
* @return string
|
2014-05-09 10:40:33 +02:00
|
|
|
*/
|
2014-10-16 17:57:12 +02:00
|
|
|
public function d3GetGAProdIdList($aArticleIds)
|
2014-05-09 10:40:33 +02:00
|
|
|
{
|
2014-10-16 17:57:12 +02:00
|
|
|
if (count($aArticleIds)) {
|
|
|
|
return "['".implode("', '", $aArticleIds)."']";
|
|
|
|
} else {
|
|
|
|
return "''";
|
2014-05-09 10:40:33 +02:00
|
|
|
}
|
|
|
|
}
|
2014-06-05 11:21:20 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $aParameter
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function _d3getCreateDomainNameParameter($aParameter)
|
|
|
|
{
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName')) {
|
|
|
|
$aParameter[] = "'cookieDomain': '" . d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName') . "'";
|
|
|
|
$aParameter[] = "'legacyCookieDomain': '" .
|
|
|
|
d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName') . "'";
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $aParameter
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function _d3getCreateCookiePathParameter($aParameter)
|
|
|
|
{
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetCookiePath')) {
|
|
|
|
$aParameter[] = "'cookiePath': '" . d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetCookiePath') . "'";
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $aParameter
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function _d3getCreateDomainLinkerParameter($aParameter)
|
|
|
|
{
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
|
|
|
|
$aParameter[] = "'allowLinker': true";
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $aParameter
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function _d3getCreateSpeedSamplerateParameter($aParameter)
|
|
|
|
{
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->getValue('iD3GASiteSpeedSampleRate')) {
|
|
|
|
$aParameter[] = "'siteSpeedSampleRate': " .
|
|
|
|
d3_cfg_mod::get($this->_sModId)->getValue('iD3GASiteSpeedSampleRate');
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $aParameter
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function _d3getCreateSamplerateParameter($aParameter)
|
|
|
|
{
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->getValue('iD3GASampleRate')) {
|
|
|
|
$aParameter[] = "'sampleRate': " . d3_cfg_mod::get($this->_sModId)->getValue('iD3GASampleRate');
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param oxUBase $oCurrentView
|
|
|
|
* @param array $aParameter
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function _d3getAsynchSendpageViewClassParameter($oCurrentView, $aParameter)
|
|
|
|
{
|
|
|
|
if ($oCurrentView->getIsOrderStep() ||
|
|
|
|
strtolower($oCurrentView->getClassName()) == 'thankyou' ||
|
|
|
|
$this->_d3HasNoPageParameter()
|
|
|
|
) {
|
|
|
|
$aParameter[] = "'/{$oCurrentView->getClassName()}.html'";
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param oxUBase $oCurrentView
|
|
|
|
* @param array $aParameter
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function _d3getUniversalSendPageViewPageParameter($oCurrentView, $aParameter)
|
|
|
|
{
|
|
|
|
if ($oCurrentView->getIsOrderStep() || strtolower($oCurrentView->getClassName()) == 'thankyou') {
|
|
|
|
$aParameter[] = "'page': '/{$oCurrentView->getClassName()}.html'";
|
|
|
|
$aParameter[] = "'title': 'Checkout: " . ucfirst($oCurrentView->getClassName()) . "'";
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
} elseif ($this->_d3HasNoPageParameter()) {
|
|
|
|
$aParameter[] = "'page': '/{$oCurrentView->getClassName()}.html'";
|
|
|
|
$aParameter[] = "'title': '" . ucfirst($oCurrentView->getClassName()) . "'";
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @param $aParameter
|
|
|
|
*
|
|
|
|
* @return array
|
|
|
|
*/
|
|
|
|
protected function _d3getUniversalSendPageViewDebugParameter($aParameter)
|
|
|
|
{
|
|
|
|
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode()) {
|
|
|
|
$aParameter[] = "
|
|
|
|
'hitCallback': function() {
|
|
|
|
alert('analytics.js done sending data');
|
|
|
|
}
|
|
|
|
";
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
|
|
|
|
|
|
|
return $aParameter;
|
|
|
|
}
|
2014-10-20 13:39:32 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return bool
|
|
|
|
*/
|
|
|
|
public function d3isMobile()
|
|
|
|
{
|
2014-10-23 11:07:55 +02:00
|
|
|
if (class_exists('oeThemeSwitcherThemeManager')) {
|
|
|
|
/** @var oeThemeSwitcherThemeManager $oThemeManager */
|
|
|
|
$oThemeManager = oxNew('oeThemeSwitcherThemeManager');
|
|
|
|
|
|
|
|
return $oThemeManager->isMobileThemeRequested();
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
2014-10-20 13:39:32 +02:00
|
|
|
}
|
2015-06-03 09:57:45 +02:00
|
|
|
|
|
|
|
/**
|
|
|
|
* @return int
|
|
|
|
*/
|
|
|
|
public function d3GetSendNoBounceEventTime()
|
|
|
|
{
|
|
|
|
$iTime = d3_cfg_mod::get($this->_sModId)->getValue('iSendNoBounceEventTime');
|
|
|
|
|
|
|
|
if (isset($iTime) && is_int($iTime)) {
|
|
|
|
return $iTime;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 10000;
|
|
|
|
}
|
2014-05-02 16:58:43 +02:00
|
|
|
}
|