8
0

added: support for multi domain use in universal tracking code (Alexander Fehler), some cleanups

Dieser Commit ist enthalten in:
Daniel Seifert 2014-06-05 09:21:20 +00:00
Ursprung 5dc2667124
Commit 2eaa642027
10 geänderte Dateien mit 246 neuen und 74 gelöschten Zeilen

1
.gitattributes vendored
Datei anzeigen

@ -7,7 +7,6 @@ Sources/UGA_Custom_Dimensions.jpg -text
Sources/UGA_Einstellungen.jpg -text Sources/UGA_Einstellungen.jpg -text
Sources/UGA_Trichtereinrichtung.jpg -text Sources/UGA_Trichtereinrichtung.jpg -text
Sources/UGA_Trichtereinrichtung_1.jpg -text Sources/UGA_Trichtereinrichtung_1.jpg -text
Sources/changelog.txt -text
Sources/doku/01_asyncTracking-Dateien/cleardot.gif -text Sources/doku/01_asyncTracking-Dateien/cleardot.gif -text
Sources/doku/01_asyncTracking-Dateien/code_logo.gif -text Sources/doku/01_asyncTracking-Dateien/code_logo.gif -text
Sources/doku/01_asyncTracking-Dateien/codesite.css -text Sources/doku/01_asyncTracking-Dateien/codesite.css -text

Binäre Datei nicht angezeigt.

Datei anzeigen

@ -1,7 +0,0 @@
3.0.0.3
- Update der precheck.php
-- 2012-12-19 -- SK --
- anpassen der Verzeichnisse + Dateien an PE/CE 4.7.x bzw. EE 5.0.x
- "alten" Trunk auslagern unter branches/trunk_bis_4.6.x
- "alte" Versionen unter Tags verschieben in neuse Verzeichnis unter tags/versionen_bis_4.6.x

Datei anzeigen

@ -19,6 +19,11 @@
ga('create', '[{$oD3GASettings->getValue('sD3GAId')}]', '[{$sD3CurrentShopUrl}]' [{$sD3GACreateParameter}]); ga('create', '[{$oD3GASettings->getValue('sD3GAId')}]', '[{$sD3CurrentShopUrl}]' [{$sD3GACreateParameter}]);
[{if $oD3GASettings->getValue('blD3GAAllowDomainLinker')}]
ga('require', 'linker');
ga('linker:autoLink', [[{$sAFEGetMoreUrls}]]);
[{/if}]
[{if $oD3GASettings->getValue('blD3GAAnonymizeIP')}] [{if $oD3GASettings->getValue('blD3GAAnonymizeIP')}]
ga('set', 'anonymizeIp', true); ga('set', 'anonymizeIp', true);
[{/if}] [{/if}]

Datei anzeigen

@ -39,7 +39,7 @@ $aModule = array(
'en' => 'Provides a quick and easy integration with your Google Analytics account to your shop.', 'en' => 'Provides a quick and easy integration with your Google Analytics account to your shop.',
), ),
'thumbnail' => 'picture.png', 'thumbnail' => 'picture.png',
'version' => '3.1.0.0', 'version' => '3.1.0.1',
'author' => 'D³ Data Development (Inh. Thomas Dartsch)', 'author' => 'D³ Data Development (Inh. Thomas Dartsch)',
'email' => 'support@shopmodule.com', 'email' => 'support@shopmodule.com',
'url' => 'http://www.oxidmodule.com/', 'url' => 'http://www.oxidmodule.com/',

Datei anzeigen

@ -45,14 +45,16 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
$oSet = d3_cfg_mod::get($this->_d3getModId()); $oSet = d3_cfg_mod::get($this->_d3getModId());
if ($oSet->isActive()) {
/** @var $oParentView oxView */ /** @var $oParentView oxView */
$oParentView = $this->getParent(); $oParentView = $this->getParent();
$oParentView->addTplParam('blD3GoogleAnalyticsActive', $oSet->isActive()); $oParentView->addTplParam('blD3GoogleAnalyticsActive', $oSet->isActive());
$oParentView->addTplParam('oD3GASettings', $oSet); $oParentView->addTplParam('oD3GASettings', $oSet);
$oParentView->addTplParam('sD3GATTpl', $this->d3getGATTpl()); $oParentView->addTplParam('sD3GATTpl', $this->d3getGATTpl());
$oParentView->addTplParam('sD3GACreateParameter', $this->d3getCreateParameters()); $oParentView->addTplParam('sD3GACreateParameter', $this->d3getCreateParameters());
$oParentView->addTplParam('sAFEGetMoreUrls', $this->afGetMoreUrls());
$oParentView->addTplParam('sD3GASendPageViewParameter', $this->d3getSendPageViewParameters()); $oParentView->addTplParam('sD3GASendPageViewParameter', $this->d3getSendPageViewParameters());
$oParentView->addTplParam('sD3CurrentShopUrl', oxRegistry::getConfig()->getActiveShop()->getFieldData('oxurl')); $oParentView->addTplParam('sD3CurrentShopUrl', $this->d3GetCreateCurrentShopUrl());
if ($oSet->getValue('blD3GASetRemarketing')) { if ($oSet->getValue('blD3GASetRemarketing')) {
$aInfos = $this->d3GetGAProdInfos(); $aInfos = $this->d3GetGAProdInfos();
@ -63,7 +65,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
); );
$oParentView->addTplParam('sD3GARemarketingPageType', $this->d3GetGAPageType()); $oParentView->addTplParam('sD3GARemarketingPageType', $this->d3GetGAPageType());
} }
}
return $ret; return $ret;
} }
@ -88,6 +90,59 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
return 'd3ga_universal.tpl'; return 'd3ga_universal.tpl';
} }
/**
* @return string
*/
public function d3GetCreateCurrentShopUrl()
{
if (d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
return 'auto';
}
return oxRegistry::getConfig()->getActiveShop()->getFieldData('oxurl');
}
/**
* @return string
*/
public function afGetMoreUrls()
{
if (false == d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
return '';
}
$sSeparator = ',';
return implode($sSeparator, $this->_d3GetNonBaseLanguageUrls());
}
/**
* @return array
*/
protected function _d3GetNonBaseLanguageUrls()
{
$myConfig = oxRegistry::getConfig();
$aLanguageUrls = $myConfig->getConfigParam('aLanguageURLs');
$aUrls = array();
/** @var oxUBase $oActView */
$oActView = $myConfig->getTopActiveView();
if ($myConfig->getConfigParam('bl_perfLoadLanguages')) {
$aLanguages = oxRegistry::getLang()->getLanguageArray(null, true, true);
reset($aLanguages);
while ((list($sKey, $oVal) = each($aLanguages))) {
$aLanguages[$sKey]->link = $oActView->getLink($oVal->id);
$sUrl = str_replace('http://', '', $aLanguageUrls[$oVal->id]);
if ($aLanguageUrls[$oVal->id] != $aLanguageUrls[oxRegistry::getLang()->getBaseLanguage()]) {
$aUrls[] = "'".$sUrl."'";
}
}
}
return $aUrls;
}
/** /**
* @return string * @return string
*/ */
@ -95,24 +150,11 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
{ {
$aParameter = array(); $aParameter = array();
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName')) { $aParameter = $this->_d3getCreateDomainNameParameter($aParameter);
$aParameter[] = "'cookieDomain': '".d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName')."'"; $aParameter = $this->_d3getCreateCookiePathParameter($aParameter);
$aParameter[] = "'legacyCookieDomain': '". $aParameter = $this->_d3getCreateDomainLinkerParameter($aParameter);
d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetDomainName')."'"; $aParameter = $this->_d3getCreateSpeedSamplerateParameter($aParameter);
} $aParameter = $this->_d3getCreateSamplerateParameter($aParameter);
if (d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetCookiePath')) {
$aParameter[] = "'cookiePath': '".d3_cfg_mod::get($this->_sModId)->getValue('sD3GASetCookiePath')."'";
}
if (d3_cfg_mod::get($this->_sModId)->getValue('blD3GAAllowDomainLinker')) {
$aParameter[] = "'allowLinker': true";
}
if (d3_cfg_mod::get($this->_sModId)->getValue('iD3GASiteSpeedSampleRate')) {
$aParameter[] = "'siteSpeedSampleRate': ".
d3_cfg_mod::get($this->_sModId)->getValue('iD3GASiteSpeedSampleRate');
}
if (d3_cfg_mod::get($this->_sModId)->getValue('iD3GASampleRate')) {
$aParameter[] = "'sampleRate': ".d3_cfg_mod::get($this->_sModId)->getValue('iD3GASampleRate');
}
if (count($aParameter)) { if (count($aParameter)) {
return ", {".implode(',', $aParameter)."}"; return ", {".implode(',', $aParameter)."}";
@ -144,12 +186,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
$oCurrentView = oxRegistry::getConfig()->getActiveView(); $oCurrentView = oxRegistry::getConfig()->getActiveView();
$oCurrentView->getIsOrderStep(); $oCurrentView->getIsOrderStep();
if ($oCurrentView->getIsOrderStep() || $aParameter = $this->_d3getAsynchSendpageViewClassParameter($oCurrentView, $aParameter);
strtolower($oCurrentView->getClassName()) == 'thankyou' ||
$this->_d3HasNoPageParameter()
) {
$aParameter[] = "'/{$oCurrentView->getClassName()}.html'";
}
if (count($aParameter)) { if (count($aParameter)) {
return ", " . implode(',', $aParameter) . ""; return ", " . implode(',', $aParameter) . "";
@ -169,21 +206,8 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
$oCurrentView = oxRegistry::getConfig()->getActiveView(); $oCurrentView = oxRegistry::getConfig()->getActiveView();
$oCurrentView->getIsOrderStep(); $oCurrentView->getIsOrderStep();
if ($oCurrentView->getIsOrderStep() || strtolower($oCurrentView->getClassName()) == 'thankyou') { $aParameter = $this->_d3getUniversalSendPageViewPageParameter($oCurrentView, $aParameter);
$aParameter[] = "'page': '/{$oCurrentView->getClassName()}.html'"; $aParameter = $this->_d3getUniversalSendPageViewDebugParameter($aParameter);
$aParameter[] = "'title': 'Checkout: ".ucfirst($oCurrentView->getClassName())."'";
} elseif ($this->_d3HasNoPageParameter()) {
$aParameter[] = "'page': '/{$oCurrentView->getClassName()}.html'";
$aParameter[] = "'title': '".ucfirst($oCurrentView->getClassName())."'";
}
if (d3_cfg_mod::get($this->_sModId)->hasDebugMode()) {
$aParameter[] = "
'hitCallback': function() {
alert('analytics.js done sending data');
}
";
}
if (count($aParameter)) { if (count($aParameter)) {
return ", {" . implode(',', $aParameter) . "}"; return ", {" . implode(',', $aParameter) . "}";
@ -348,6 +372,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
} }
/** /**
* don't change method name, it was dynamically generated
* @param account_noticelist $oView * @param account_noticelist $oView
* *
* @return array * @return array
@ -359,6 +384,7 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
} }
/** /**
* don't change method name, it was dynamically generated
* @param account_wishlist $oView * @param account_wishlist $oView
* *
* @return array * @return array
@ -393,4 +419,150 @@ class d3_oxcmp_utils_googleanalytics extends d3_oxcmp_utils_googleanalytics_pare
return array('aArtIdList' => $aArticleIds, 'dPrice' => $dPrice); return array('aArtIdList' => $aArticleIds, 'dPrice' => $dPrice);
} }
/**
* @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;
}
} }

Datei anzeigen

@ -21,18 +21,18 @@ class d3_googleanalytics_update extends d3install_updatebase
public $sModName = 'Google Analytics Schnittstelle'; public $sModName = 'Google Analytics Schnittstelle';
public $sModVersion = '3.1.0.0'; public $sModVersion = '3.1.0.1';
public $sModRevision = '133'; public $sModRevision = '139';
// heredoc syntax using for class members is available from PHP 5.3 up // heredoc syntax using for class members is available from PHP 5.3 up
public $sBaseConf = public $sBaseConf =
"8ZEb1MwM201blJ3TDltMzJCdVcydUZMa3BNbFZhenJYSlZMbXRnUm82clRwcUVpTkdIS2orbmVOR0N1S "JycSFpDSXZYWEpRK1B2dERSbVg5VDVraUJ1VXBIOGpiY0NrY3M4Yzlrc1Q2Z2pPTms4SFRZODhGQTRwN
DEwb1Iwcmh1QTNXc002U2V1L25oL1krQkIyNVZaV2ZYMWtSaWxWZWhIdG9xdjVnM21CNmpMekx5NEpPa 05QWktLUUozaXhSVVM2eU9VdWdMdklpL2hrV29YMS9lY1BMOUVsYjBiMmJOKzFQSjgzRGlqOGlwMUVVN
0FBU090Y29KSU5kVjNUTC9laTNpQnhPWHJpMlZyOGc1aE1BTUthcWk2N3krYStHenRMQ0RiWG1BU1MyY UxJY0plT3lBNkptc0VwcXNZT3YzY2hUTTB2QlF6RUIrbTJtVXRmNkppcTJreUJVd0xaUGI1RytmN1VkM
zk4bmd3em1VemJFUUZEUHRCbkZ1TTFTbWp4cUxWVlRkb1loQ0MxZGZyTW00ejV1Sy9Qa0dJTXAySGU5T zBaTjNxQkZ5dTg0c05qRUcreDV0WFo0WFZrWjlZd1ltMVpJOTQybDYvQkNDWmVPQzRSdHkrOXpwMld6a
E9YMEhCblpabm02elJWYXhtSkd0TDdaQ21FSmVpbFp1aU5QYUZtM2VONVVoWUc4b0MzcGRFbWtQczN3c VVFTTBLWjRLTG1uT3k3ZUxXVUYwZlVCR2lQT0ZBWFRVZkd6UmtrOUN0bnFRczdzMnRudHAvMGttaGlhd
Hc9"; EE9";
public $sRequirements = ''; public $sRequirements = '';

Datei anzeigen

@ -6,7 +6,7 @@ class requConfig
public $sModId = 'd3_googleanalytics'; public $sModId = 'd3_googleanalytics';
public $sModVersion = '3.1.0.0'; public $sModVersion = '3.1.0.1';
/********************** check configuration section ************************/ /********************** check configuration section ************************/

Datei anzeigen

@ -1,3 +1,6 @@
=> 3.1.0.1
- Universal-Trackingcode für Multi-Domain-Nutzung angepasst
=> 3.1.0.0 => 3.1.0.0
- Universal-Analytics Tracking-Code implementiert - Universal-Analytics Tracking-Code implementiert
- zusätzliche Steuerungsparameter eingefügt - zusätzliche Steuerungsparameter eingefügt