commit
318380dc16
|
@ -5,8 +5,8 @@ class pluginGoogle extends Plugin {
|
||||||
public function init()
|
public function init()
|
||||||
{
|
{
|
||||||
$this->dbFields = array(
|
$this->dbFields = array(
|
||||||
'google-analytics-tracking-id'=>'',
|
|
||||||
'google-site-verification'=>'',
|
'google-site-verification'=>'',
|
||||||
|
'google-analytics-tracking-id'=>'',
|
||||||
'google-tag-manager'=>''
|
'google-tag-manager'=>''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
@ -23,7 +23,7 @@ class pluginGoogle extends Plugin {
|
||||||
|
|
||||||
$html .= '<div>';
|
$html .= '<div>';
|
||||||
$html .= '<label for="jstracking-id">'.$Language->get('Google Analytics Tracking ID').'</label>';
|
$html .= '<label for="jstracking-id">'.$Language->get('Google Analytics Tracking ID').'</label>';
|
||||||
$html .= '<input id="jsgoogle-analytics-tracking-id" type="text" name="google-analytics-tracking-id" value="'.$this->getDbField('google-analytics-tracking-id').'">';
|
$html .= '<input id="jstracking-id" type="text" name="google-analytics-tracking-id" value="'.$this->getDbField('google-analytics-tracking-id').'">';
|
||||||
$html .= '<span class="tip">'.$Language->get('complete-this-field-with-the-tracking-id').'</span>';
|
$html .= '<span class="tip">'.$Language->get('complete-this-field-with-the-tracking-id').'</span>';
|
||||||
$html .= '</div>';
|
$html .= '</div>';
|
||||||
|
|
||||||
|
@ -39,12 +39,11 @@ class pluginGoogle extends Plugin {
|
||||||
public function siteHead()
|
public function siteHead()
|
||||||
{
|
{
|
||||||
global $Url;
|
global $Url;
|
||||||
global $WHERE_AM_I;
|
|
||||||
|
|
||||||
$html = '';
|
$html = '';
|
||||||
|
|
||||||
// Google HTML tag
|
// Google HTML tag
|
||||||
if ($this->getValue('google-site-verification') && ($WHERE_AM_I=='home')) {
|
if( $this->getValue('google-site-verification') && $Url->whereAmI()=='home' ) {
|
||||||
$html .= PHP_EOL.'<!-- Google HTML tag -->'.PHP_EOL;
|
$html .= PHP_EOL.'<!-- Google HTML tag -->'.PHP_EOL;
|
||||||
$html .= '<meta name="google-site-verification" content="'.$this->getDbField('google-site-verification').'" />'.PHP_EOL;
|
$html .= '<meta name="google-site-verification" content="'.$this->getDbField('google-site-verification').'" />'.PHP_EOL;
|
||||||
}
|
}
|
||||||
|
@ -61,8 +60,8 @@ class pluginGoogle extends Plugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Google Analytics
|
// Google Analytics
|
||||||
if ($this->getValue('google-analytics-tracking-id')) {
|
if( $this->getValue('google-analytics-tracking-id') ) {
|
||||||
$html = PHP_EOL.'<!-- Google Analytics -->'.PHP_EOL;
|
$html .= PHP_EOL.'<!-- Google Analytics -->'.PHP_EOL;
|
||||||
$html .= '
|
$html .= '
|
||||||
<script async src="https://www.googletagmanager.com/gtag/js?id='.$this->getValue('google-analytics-tracking-id').'"></script>
|
<script async src="https://www.googletagmanager.com/gtag/js?id='.$this->getValue('google-analytics-tracking-id').'"></script>
|
||||||
<script>
|
<script>
|
||||||
|
|
Loading…
Reference in New Issue