@@ -43,44 +43,44 @@ public function run()
4343 if (!\Configuration::get ('GA_ACCOUNT_ID ' )) {
4444 return ;
4545 }
46- $ this ->context ->controller ->addJs ($ this ->module ->getPathUri () . 'views/js/GoogleAnalyticActionLib.js ' );
4746
48- $ shops = \Shop::getShops ();
49- $ isMultistoreActive = \Shop::isFeatureActive ();
50- $ currentShopId = (int ) \Context::getContext ()->shop ->id ;
51- $ userId = null ;
52- $ gaCrossdomainEnabled = false ;
47+ $ this ->context ->controller ->addJs ($ this ->module ->getPathUri () . 'views/js/GoogleAnalyticActionLib.js ' );
5348
54- if (\Configuration:: get ( ' GA_USERID_ENABLED ' ) &&
55- $ this -> context -> customer && $ this -> context -> customer -> isLogged ()
56- ) {
57- $ userId = ( int ) $ this -> context -> customer -> id ;
58- }
49+ $ shops = \Shop:: getShops ();
50+ $ isMultistoreActive = \Shop:: isFeatureActive ();
51+ $ currentShopId = ( int ) \Context:: getContext ()-> shop -> id ;
52+ $ userId = null ;
53+ $ gaCrossdomainEnabled = false ;
5954
60- $ gaAnonymizeEnabled = \Configuration::get ('GA_ANONYMIZE_ENABLED ' );
61-
62- if (( int ) \Configuration:: get ( ' GA_CROSSDOMAIN_ENABLED ' ) && $ isMultistoreActive && count ( $ shops ) > 1 ) {
63- $ gaCrossdomainEnabled = true ;
64- }
55+ if ( \Configuration::get ('GA_USERID_ENABLED ' ) &&
56+ $ this -> context -> customer && $ this -> context -> customer -> isLogged ()
57+ ) {
58+ $ userId = ( int ) $ this -> context -> customer -> id ;
59+ }
6560
66- $ this ->context ->smarty ->assign (
67- [
68- 'backOffice ' => $ this ->backOffice ,
69- 'currentShopId ' => $ currentShopId ,
70- 'userId ' => $ userId ,
71- 'gaAccountId ' => \Tools::safeOutput (\Configuration::get ('GA_ACCOUNT_ID ' )),
72- 'shops ' => $ shops ,
73- 'gaCrossdomainEnabled ' => $ gaCrossdomainEnabled ,
74- 'gaAnonymizeEnabled ' => $ gaAnonymizeEnabled ,
75- 'useSecureMode ' => \Configuration::get ('PS_SSL_ENABLED ' ),
76- ]
77- );
61+ $ gaAnonymizeEnabled = \Configuration::get ('GA_ANONYMIZE_ENABLED ' );
7862
79- return $ this ->module ->display (
80- $ this ->module ->getLocalPath () . $ this ->module ->name ,
81- 'ps_googleanalytics.tpl '
82- );
63+ if ((int ) \Configuration::get ('GA_CROSSDOMAIN_ENABLED ' ) && $ isMultistoreActive && count ($ shops ) > 1 ) {
64+ $ gaCrossdomainEnabled = true ;
8365 }
66+
67+ $ this ->context ->smarty ->assign (
68+ [
69+ 'backOffice ' => $ this ->backOffice ,
70+ 'currentShopId ' => $ currentShopId ,
71+ 'userId ' => $ userId ,
72+ 'gaAccountId ' => \Tools::safeOutput (\Configuration::get ('GA_ACCOUNT_ID ' )),
73+ 'shops ' => $ shops ,
74+ 'gaCrossdomainEnabled ' => $ gaCrossdomainEnabled ,
75+ 'gaAnonymizeEnabled ' => $ gaAnonymizeEnabled ,
76+ 'useSecureMode ' => \Configuration::get ('PS_SSL_ENABLED ' ),
77+ ]
78+ );
79+
80+ return $ this ->module ->display (
81+ $ this ->module ->getLocalPath () . $ this ->module ->name ,
82+ 'ps_googleanalytics.tpl '
83+ );
8484 }
8585
8686 /**
0 commit comments