diff --git a/bl-plugins/google/plugin.php b/bl-plugins/google/plugin.php index 124ac535..afac2f55 100644 --- a/bl-plugins/google/plugin.php +++ b/bl-plugins/google/plugin.php @@ -2,91 +2,90 @@ class pluginGoogle extends Plugin { - public function init() - { - $this->dbFields = array( - 'google-analytics-tracking-id'=>'', - 'google-site-verification'=>'', - 'google-tag-manager'=>'' - ); - } + public function init() + { + $this->dbFields = array( + 'google-site-verification'=>'', + 'google-analytics-tracking-id'=>'', + 'google-tag-manager'=>'' + ); + } - public function form() - { - global $Language; + public function form() + { + global $Language; - $html = '
'; - $html .= ''; - $html .= ''; - $html .= ''.$Language->get('complete-this-field-with-the-google-site-verification').''; - $html .= '
'; + $html = '
'; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('complete-this-field-with-the-google-site-verification').''; + $html .= '
'; - $html .= '
'; - $html .= ''; - $html .= ''; - $html .= ''.$Language->get('complete-this-field-with-the-tracking-id').''; - $html .= '
'; + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('complete-this-field-with-the-tracking-id').''; + $html .= '
'; - $html .= '
'; - $html .= ''; - $html .= ''; - $html .= ''.$Language->get('complete-this-field-with-the-tracking-id-google-tag').''; - $html .= '
'; + $html .= '
'; + $html .= ''; + $html .= ''; + $html .= ''.$Language->get('complete-this-field-with-the-tracking-id-google-tag').''; + $html .= '
'; - return $html; - } + return $html; + } - public function siteHead() - { - global $Url; - global $WHERE_AM_I; + public function siteHead() + { + global $Url; - $html = ''; + $html = ""; - // Google HTML tag - if ($this->getValue('google-site-verification') && ($WHERE_AM_I=='home')) { - $html .= PHP_EOL.''.PHP_EOL; - $html .= ''.PHP_EOL; - } + // Google HTML tag + if( $this->getValue('google-site-verification') && $Url->whereAmI()=='home' ) { + $html .= PHP_EOL.""; + $html .= ''.PHP_EOL; + } - // Google Tag Manager - if( $this->getValue('google-tag-manager') ) { - $html .= PHP_EOL."".PHP_EOL; - $html .= "".PHP_EOL; - $html .= "".PHP_EOL; - } + // Google Tag Manager + if( $this->getValue('google-tag-manager') ) { + $html .= PHP_EOL.""; + $html .= "".PHP_EOL; + $html .= "".PHP_EOL; + } - // Google Analytics - if ($this->getValue('google-analytics-tracking-id')) { - $html = PHP_EOL.''.PHP_EOL; - $html .= ' - - + '.PHP_EOL; - } + gtag("config", "'.$this->getValue('google-analytics-tracking-id').'"); + '.PHP_EOL; + } - return $html; - } + return $html; + } - public function siteBodyBegin() - { - // Google Tag Manager - if ($this->getValue('google-tag-manager')) { - $html = ''.PHP_EOL; - $html .= ''.PHP_EOL; - $html .= ''.PHP_EOL; - return $html; - } - return false; - } + public function siteBodyBegin() + { + // Google Tag Manager + if ($this->getValue('google-tag-manager')) { + $html = ''; + $html .= ''.PHP_EOL; + $html .= ''.PHP_EOL; + return $html; + } + return false; + } -} \ No newline at end of file +}