diff --git a/app/code/community/Fooman/GoogleAnalyticsPlus/Block/Common/Abstract.php b/app/code/community/Fooman/GoogleAnalyticsPlus/Block/Common/Abstract.php index f633404..92e2633 100644 --- a/app/code/community/Fooman/GoogleAnalyticsPlus/Block/Common/Abstract.php +++ b/app/code/community/Fooman/GoogleAnalyticsPlus/Block/Common/Abstract.php @@ -170,7 +170,7 @@ public function getAlternativeAccountId() } /** - * get Google Analytics account id + * get Google Analytics universal account id * * @return mixed */ @@ -179,6 +179,16 @@ public function getUniversalAccount() return Mage::getStoreConfig('google/analyticsplus_universal/accountnumber'); } + /** + * get Google Analytics universal account id for alternative profile + * + * @return mixed + */ + public function getAlternativeUniversalAccount() + { + return Mage::getStoreConfig('google/analyticsplus_universal/altaccountnumber'); + } + /** * are we using universal * diff --git a/app/code/community/Fooman/GoogleAnalyticsPlus/Block/Universal.php b/app/code/community/Fooman/GoogleAnalyticsPlus/Block/Universal.php index dd36fe8..cbafb31 100644 --- a/app/code/community/Fooman/GoogleAnalyticsPlus/Block/Universal.php +++ b/app/code/community/Fooman/GoogleAnalyticsPlus/Block/Universal.php @@ -12,6 +12,8 @@ */ class Fooman_GoogleAnalyticsPlus_Block_Universal extends Fooman_GoogleAnalyticsPlus_Block_GaConversion { + const TRACKER_TWO_NAME = 'tracker2'; + protected function _construct() { parent::_construct(); @@ -55,9 +57,11 @@ public function getUniversalAnonymise() /** * Build any params that is passed on create of analytics object * + * @param bool $createTrackerTwo + * * @return string */ - public function getUniversalParams() + public function getUniversalParams($createTrackerTwo = false) { $params = array(); if (Mage::getStoreConfig('google/analyticsplus_universal/domainname')) { @@ -66,6 +70,9 @@ public function getUniversalParams() if ($this->canUseUniversalUserTracking()) { $params['userId'] = $this->getCustomerId(); } + if ($createTrackerTwo) { + $params['name'] = self::TRACKER_TWO_NAME; + } if (count($params) == 0) { return "'auto'"; } diff --git a/app/code/community/Fooman/GoogleAnalyticsPlus/etc/config.xml b/app/code/community/Fooman/GoogleAnalyticsPlus/etc/config.xml index 60a519a..f8bd97f 100644 --- a/app/code/community/Fooman/GoogleAnalyticsPlus/etc/config.xml +++ b/app/code/community/Fooman/GoogleAnalyticsPlus/etc/config.xml @@ -2,7 +2,7 @@ - 0.15.0 + 0.15.1 diff --git a/app/code/community/Fooman/GoogleAnalyticsPlus/etc/system.xml b/app/code/community/Fooman/GoogleAnalyticsPlus/etc/system.xml index e9c6d4e..44f9d7e 100644 --- a/app/code/community/Fooman/GoogleAnalyticsPlus/etc/system.xml +++ b/app/code/community/Fooman/GoogleAnalyticsPlus/etc/system.xml @@ -167,6 +167,15 @@ 1 1 + + + + text + 150 + 1 + 1 + 1 + Google Documentation for details]]> diff --git a/app/design/frontend/base/default/template/fooman/googleanalyticsplus/ajax-tracking.phtml b/app/design/frontend/base/default/template/fooman/googleanalyticsplus/ajax-tracking.phtml index e0fc250..b103e0d 100644 --- a/app/design/frontend/base/default/template/fooman/googleanalyticsplus/ajax-tracking.phtml +++ b/app/design/frontend/base/default/template/fooman/googleanalyticsplus/ajax-tracking.phtml @@ -9,6 +9,7 @@ this.classic = settings.classic; this.altClassic = settings.altClassic; this.universal = settings.universal; + this.altUniversal = settings.altUniversal; }, trackEvent: function(section){ @@ -22,6 +23,9 @@ if (this.universal) { ga('send', 'pageview', urlToTrack); } + if (this.altUniversal) { + ga('.send', 'pageview', urlToTrack); + } } } @@ -30,7 +34,8 @@ pageQuery: 'getPageQuery() ?>', classic: 'getMainAccountId() ?>', altClassic: 'getAlternativeAccountId() ?>', - universal: 'isUniversalEnabled() ? $this->getUniversalAccount():'' ?>' + universal: 'isUniversalEnabled() ? $this->getUniversalAccount():'' ?>', + altUniversal: 'isUniversalEnabled() ? $this->getAlternativeUniversalAccount():'' ?>' } ); diff --git a/app/design/frontend/base/default/template/fooman/googleanalyticsplus/universal.phtml b/app/design/frontend/base/default/template/fooman/googleanalyticsplus/universal.phtml index 9f431ab..d131c04 100644 --- a/app/design/frontend/base/default/template/fooman/googleanalyticsplus/universal.phtml +++ b/app/design/frontend/base/default/template/fooman/googleanalyticsplus/universal.phtml @@ -1,4 +1,5 @@ shouldInclude()): ?> + getAlternativeUniversalAccount(); ?> isSuccessPage()):?> @@ -21,26 +35,48 @@