Remove Google plugin
This commit is contained in:
parent
b75288e362
commit
0e27e31a84
|
@ -240,9 +240,6 @@ $WHERE_AM_I = $Url->whereAmI();
|
|||
// --- Objects shortcuts ---
|
||||
$L = $language;
|
||||
|
||||
// GDPR
|
||||
Cookie::set('BLUDIT_GDPR_ALLOW_TRACKING', true, 7);
|
||||
|
||||
// DEBUG: Print constants
|
||||
// $arr = array_filter(get_defined_constants(), 'is_string');
|
||||
// echo json_encode($arr);
|
||||
|
|
|
@ -1,7 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "GDPR Cookie",
|
||||
"description": "General Data Protection Cookie Concent"
|
||||
}
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "2.3",
|
||||
"releaseDate": "2018-01-23",
|
||||
"license": "MIT",
|
||||
"compatible": "2.3",
|
||||
"notes": ""
|
||||
}
|
|
@ -1,103 +0,0 @@
|
|||
<?php
|
||||
|
||||
class pluginGDPRCookie extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'enabled'=>true,
|
||||
'message'=>'Allow to Google Analytics tracking you?'
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label>Show concent to the user</label>';
|
||||
$html .= '<select name="enabled">';
|
||||
$html .= '<option value="true" '.($this->getValue('enabled')===true?'selected':'').'>'.$Language->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('enabled')===false?'selected':'').'>'.$Language->get('Disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<span class="tip">Show the consent to the user before loading the script of Google Analytics. The user can reject be tracked for Google Analytics.</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function siteHead()
|
||||
{
|
||||
$html = '<style>
|
||||
#pluginGDPRCookie {
|
||||
display: block;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
background: #eee;
|
||||
padding: 2px 10px;
|
||||
font-size: 1em;
|
||||
color: #555;
|
||||
z-index: 2000;
|
||||
width: 100%;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #999;
|
||||
}
|
||||
|
||||
#pluginGDPRCookie div.buttons {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#pluginGDPRCookie button {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
</style>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function siteBodyBegin()
|
||||
{
|
||||
$script = <<<EOT
|
||||
<script>
|
||||
function pluginGDPRCookie_allowTracking() {
|
||||
setCookie("BLUDIT_GDPR_ALLOW_TRACKING", true, 7);
|
||||
pluginGDPRCookie_hideModal();
|
||||
}
|
||||
|
||||
function pluginGDPRCookie_disableTracking() {
|
||||
setCookie("BLUDIT_GDPR_ALLOW_TRACKING", false, 7);
|
||||
pluginGDPRCookie_hideModal();
|
||||
}
|
||||
|
||||
function pluginGDPRCookie_hideModal() {
|
||||
document.getElementById("pluginGDPRCookie").style.display = "none";
|
||||
}
|
||||
</script>
|
||||
EOT;
|
||||
|
||||
if ($this->getValue('enabled')) {
|
||||
$html = '<div id="pluginGDPRCookie">';
|
||||
$html .= '<div>Allow to Google Analytics tracking you?</div>';
|
||||
$html .= '<div class="buttons">';
|
||||
$html .= '<button id="pluginGDPRCookie_allowButton">Allow</button>';
|
||||
$html .= '<button id="pluginGDPRCookie_denyButton">Deny</button>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
} else {
|
||||
$html = '<script> window.onload=function() { allowTracking(); }</script>';
|
||||
}
|
||||
|
||||
$script .= '
|
||||
<script>
|
||||
window.onload=function() {
|
||||
document.getElementById("pluginGDPRCookie_allowButton").addEventListener("click", pluginGDPRCookie_allowTracking);
|
||||
document.getElementById("pluginGDPRCookie_denyButton").addEventListener("click", pluginGDPRCookie_disableTracking);
|
||||
}
|
||||
</script>
|
||||
';
|
||||
|
||||
return $script.$html;
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google Analytics",
|
||||
"description": "This plugin generates the necessary code for the following Google tools: Google Analytics, Google Tag Manager and Google Site Verification HTML Tag."
|
||||
},
|
||||
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "Google Analytics Tracking ID",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Complete this field with the Google Site verification to verify the site owner.",
|
||||
"complete-this-field-with-the-tracking-id": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Analytics.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Tag Manager."
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "2.3",
|
||||
"releaseDate": "2018-01-23",
|
||||
"license": "MIT",
|
||||
"compatible": "2.3",
|
||||
"notes": ""
|
||||
}
|
|
@ -1,113 +0,0 @@
|
|||
<?php
|
||||
|
||||
class pluginGoogleAnalytics extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'EUGDPR'=>true,
|
||||
'trackingID'=>''
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label for="jstrackingID">'.$Language->get('Google Analytics Tracking ID').'</label>';
|
||||
$html .= '<input id="jstrackingID" type="text" name="trackingID" value="'.$this->getValue('trackingID').'">';
|
||||
$html .= '<span class="tip">'.$Language->get('complete-this-field-with-the-tracking-id').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label>EU General Data Protection</label>';
|
||||
$html .= '<select name="EUGDPR">';
|
||||
$html .= '<option value="true" '.($this->getValue('EUGDPR')===true?'selected':'').'>'.$Language->get('Enabled').'</option>';
|
||||
$html .= '<option value="false" '.($this->getValue('EUGDPR')===false?'selected':'').'>'.$Language->get('Disabled').'</option>';
|
||||
$html .= '</select>';
|
||||
$html .= '<span class="tip">Show the consent to the user before loading the script of Google Analytics. The user can reject be tracked for Google Analytics.</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function siteHead()
|
||||
{
|
||||
$html = '<style>
|
||||
#pluginGoogleAnalytics {
|
||||
display: block;
|
||||
position: fixed;
|
||||
top: 0;
|
||||
background: #eee;
|
||||
padding: 2px 10px;
|
||||
font-size: 1em;
|
||||
color: #555;
|
||||
z-index: 2000;
|
||||
width: 100%;
|
||||
padding: 30px;
|
||||
text-align: center;
|
||||
border-bottom: 1px solid #999;
|
||||
}
|
||||
|
||||
#pluginGoogleAnalytics div.buttons {
|
||||
margin-top: 10px;
|
||||
}
|
||||
|
||||
#pluginGoogleAnalytics button {
|
||||
margin-right: 10px;
|
||||
}
|
||||
}
|
||||
</style>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function siteBodyBegin()
|
||||
{
|
||||
$script = '
|
||||
<script>
|
||||
function executeGoogleAnalytics() {
|
||||
|
||||
var s = document.createElement("script");
|
||||
s.src = "https://www.googletagmanager.com/gtag/js?id='.$this->getValue('trackingID').'";
|
||||
document.body.appendChild(s);
|
||||
|
||||
var s = document.createElement("script");
|
||||
s.text = \'window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);} gtag("js", new Date()); gtag("config", "'.$this->getValue('trackingID').'");\';
|
||||
document.body.appendChild(s);
|
||||
|
||||
hideGoogleAnalyticsDialog();
|
||||
}
|
||||
|
||||
function hideGoogleAnalyticsDialog() {
|
||||
document.getElementById("pluginGoogleAnalytics").style.display = "none";
|
||||
}
|
||||
|
||||
</script>
|
||||
';
|
||||
|
||||
if ($this->getValue('EUGDPR')) {
|
||||
$html = '<div id="pluginGoogleAnalytics">';
|
||||
$html .= '<div>Allow to Google Analytics tracking you?</div>';
|
||||
$html .= '<div class="buttons">';
|
||||
$html .= '<button id="pluginGoogleAnalytics_allowButton">Allow</button>';
|
||||
$html .= '<button id="pluginGoogleAnalytics_denyButton">Deny</button>';
|
||||
$html .= '</div>';
|
||||
$html .= '</div>';
|
||||
} else {
|
||||
$html = '<script> window.onload=function() { executeGoogleAnalytics(); }</script>';
|
||||
}
|
||||
|
||||
$script .= '
|
||||
<script>
|
||||
window.onload=function() {
|
||||
document.getElementById("pluginGoogleAnalytics_allowButton").addEventListener("click", executeGoogleAnalytics);
|
||||
document.getElementById("pluginGoogleAnalytics_denyButton").addEventListener("click", hideGoogleAnalyticsDialog);
|
||||
}
|
||||
</script>
|
||||
';
|
||||
|
||||
return $script.$html;
|
||||
}
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google",
|
||||
"description": "Einbindung des Codes für die Verwendung der Google Search Console, von Google Analytics und des Google Tag Managers."
|
||||
},
|
||||
|
||||
"google-webmasters-tools": "Site Verification Code",
|
||||
"google-analytics-tracking-id": "Tracking ID",
|
||||
"google-tag-manager": "Container ID",
|
||||
"complete-this-field-with-the-google-site-verification": "Site Verification Code zur Bestätigung der Inhaberschaft der Website.",
|
||||
"complete-this-field-with-the-tracking-id": "Tracking ID, um das JavaScript für die Verwendung von Google Analytics zu erzeugen.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Container ID, um das JavaScript für die Verwendung des Google Tag Managers zu erzeugen."
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google",
|
||||
"description": "Einbindung des Codes für die Verwendung der Google Search Console, von Google Analytics und des Google Tag Managers."
|
||||
},
|
||||
|
||||
"google-webmasters-tools": "Site Verification Code",
|
||||
"google-analytics-tracking-id": "Tracking ID",
|
||||
"google-tag-manager": "Container ID",
|
||||
"complete-this-field-with-the-google-site-verification": "Site Verification Code zur Bestätigung der Inhaberschaft der Website.",
|
||||
"complete-this-field-with-the-tracking-id": "Tracking ID, um das JavaScript für die Verwendung von Google Analytics zu erzeugen.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Container ID, um das JavaScript für die Verwendung des Google Tag Managers zu erzeugen."
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google",
|
||||
"description": "This plugin generates the necessary code for the following Google tools: Google Analytics, Google Tag Manager and Google Site Verification HTML Tag."
|
||||
},
|
||||
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "Google Analytics Tracking ID",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Complete this field with the Google Site verification to verify the site owner.",
|
||||
"complete-this-field-with-the-tracking-id": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Analytics.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Tag Manager."
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Herramientas de Google",
|
||||
"description": "Este plugin genera los meta tags para validar el sitio con Google Webmasters Tools y el código JavaScript para trackear el sitio con Google Analytics."
|
||||
},
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "Google Analytics Tracking ID",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Complete este campo con el código de verificación de Google Webmasters Tools para verificar la propiedad del sitio.",
|
||||
"complete-this-field-with-the-tracking-id": "Complete este campo con el Tracking ID para generar el código Javascript para trackear el sitio.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Complete este campo con el Tracking ID para generar el código Javascript para Google Tag Manager."
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Outils Google",
|
||||
"description": "Ce plugin génère le code nécessaire pour les outils Google suivants : Google Analytics, Google Tag Manager and Google Site Verification HTML Tag."
|
||||
},
|
||||
|
||||
"google-webmasters-tools": "Outils pour les webmasters",
|
||||
"google-analytics-tracking-id": "ID de suivi Google Analytics",
|
||||
"google-tag-manager": "Gestionnaire de balises Google",
|
||||
"complete-this-field-with-the-google-site-verification": "Remplissez ce champ avec la vérification Google pour vérifier le propriétaire du site.",
|
||||
"complete-this-field-with-the-tracking-id": "Remplissez ce champ avec l’ID de suivi pour générer le code Javascript Google Analytics.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Remplissez ce champ avec l’ID de suivi pour générer le code Javascript Google Tag Manager."
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google",
|
||||
"description": "Questo plugin genera il codice necessario per i seguenti strumenti di Google: Google Analytics, Google Tag Manager e Google Site Verification HTML Tag."
|
||||
},
|
||||
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "Google Analytics Tracking ID",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Completa questo campo con il Google Site verification per verificare il proprietario del sito.",
|
||||
"complete-this-field-with-the-tracking-id": "Completa questo campo con il Tracking ID per generare il codice Javascript di tracciamento per Google Analytics.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Completa questo campo con il Tracking ID per generare il codice Javascript di tracciamento per Google Tag Manager."
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google Tools",
|
||||
"description": "Google Search Consoleでサイトを検証するためのメタタグとGoogle AnalyticsでトラッキングするためのJavaScriptコードを生成します。"
|
||||
},
|
||||
|
||||
"google-webmasters-tools": "Google Search Console",
|
||||
"google-analytics-tracking-id": "Google Analytics トラッキングID",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Google Seach Consoleがサイト所有権を確認するためのメタタグを入力します。",
|
||||
"complete-this-field-with-the-tracking-id": "Google Analyticsがトラッキングをするために生成したトラッキングIDを入力します。",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "トラッキングをするために生成したトラッキングIDを入力します。"
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google Tools",
|
||||
"description": "Deze plugin genereerd een meta tag om je site te verifiëren met Google Webmasters Tools en de JavaScript code om je site te tracken met Google Analytics."
|
||||
},
|
||||
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "Google Analytics Tracking ID",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Vul dit veld in met de Google Site verificatie om jezelf te verifiëren als site beheerder.",
|
||||
"complete-this-field-with-the-tracking-id": "Vul dit veld in met de Tracking ID om de Javascript tracking code te genereren voor Google Analytics.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Vul dit veld in met de Tracking ID."
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Narzędzia Google",
|
||||
"description": "Wtyczka ta generuje kod metatagów pozwalający zweryfikować stronę z serwisem Narzędzia Google Dla Webmasterów oraz wygenerować kod JavaScript monitorujący ruch z usługą Google Analytics."
|
||||
},
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "Google Analytics Tracking ID",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Complete this field with the Google Site verification to verify the site owner.",
|
||||
"complete-this-field-with-the-tracking-id": "Complete this field with the Tracking ID to generate the Javascript tracking code for Google Analytics.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Complete this field with the ID"
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google Tools",
|
||||
"description": "Этот плагин генерирует мета теги для проверки вашего сайта в Google Webmasters Tools и код JavaScript для отслеживания вашего сайта в Google Analytics."
|
||||
},
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "Google Analytics Tracking ID",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Заполните это поле для проверки владельца сайта.",
|
||||
"complete-this-field-with-the-tracking-id": "Заполните это поле с Tracking ID чтобы сгенерировать код Javascript для отслеживания в Google Analytics.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Заполните это поле с Tracking ID чтобы сгенерировать код Javascript для."
|
||||
}
|
|
@ -1,13 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Google Araçları",
|
||||
"description": "Bu eklenti Google Webmaster Araçlarını kullanabilmeniz ve sitenizin Google Analytics tarafından incelenebilmesi için geçerli bir meta tag ve Javascript kodu oluşturur."
|
||||
},
|
||||
"google-webmasters-tools": "Google Webmaster Araçları",
|
||||
"google-analytics-tracking-id": "Google Analytics İzleme No",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Google Site Doğrulama ile bu alanı doldurarak sitenizi doğrulayın",
|
||||
"complete-this-field-with-the-tracking-id": "Bu alanı İzleme No ile doldurarak Google Analytics için Javascript kodu oluşturun.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Bu alanı İzleme No ile doldurarak için Javascript kodu oluşturun."
|
||||
}
|
|
@ -1,14 +0,0 @@
|
|||
{
|
||||
"plugin-data":
|
||||
{
|
||||
"name": "Інструменти Google",
|
||||
"description": "Цей плагін генерує мета-тег для перевірки вашого сайту у Google Webmasters Tools і JavaScript-код для відстеження вашого сайту з Google Analytics."
|
||||
},
|
||||
|
||||
"google-webmasters-tools": "Google Webmasters tools",
|
||||
"google-analytics-tracking-id": "КОД відстеження Google Analytics",
|
||||
"google-tag-manager": "Google Tag Manager",
|
||||
"complete-this-field-with-the-google-site-verification": "Заповніть це поле для перевірки власника сайту.",
|
||||
"complete-this-field-with-the-tracking-id": "Заповніть це поле для генерації Javascript-коду відстеження у Google Analytics.",
|
||||
"complete-this-field-with-the-tracking-id-google-tag": "Заповніть це поле для генерації Javascript-коду відстеження."
|
||||
}
|
|
@ -1,10 +0,0 @@
|
|||
{
|
||||
"author": "Bludit",
|
||||
"email": "",
|
||||
"website": "https://plugins.bludit.com",
|
||||
"version": "2.3",
|
||||
"releaseDate": "2018-01-23",
|
||||
"license": "MIT",
|
||||
"compatible": "2.3",
|
||||
"notes": ""
|
||||
}
|
|
@ -1,92 +0,0 @@
|
|||
<?php
|
||||
|
||||
class pluginGoogle extends Plugin {
|
||||
|
||||
public function init()
|
||||
{
|
||||
$this->dbFields = array(
|
||||
'google-site-verification'=>'',
|
||||
'google-analytics-tracking-id'=>'',
|
||||
'google-tag-manager'=>''
|
||||
);
|
||||
}
|
||||
|
||||
public function form()
|
||||
{
|
||||
global $Language;
|
||||
|
||||
$html = '<div>';
|
||||
$html .= '<label for="jsgoogle-site-verification">'.$Language->get('Google Webmasters tools').'</label>';
|
||||
$html .= '<input id="jsgoogle-site-verification" type="text" name="google-site-verification" value="'.$this->getDbField('google-site-verification').'">';
|
||||
$html .= '<span class="tip">'.$Language->get('complete-this-field-with-the-google-site-verification').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label for="jstracking-id">'.$Language->get('Google Analytics Tracking ID').'</label>';
|
||||
$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 .= '</div>';
|
||||
|
||||
$html .= '<div>';
|
||||
$html .= '<label for="jsgoogle-tag-manager">'.$Language->get('Google Tag Manager').'</label>';
|
||||
$html .= '<input id="jsgoogle-tag-manager" type="text" name="google-tag-manager" value="'.$this->getDbField('google-tag-manager').'">';
|
||||
$html .= '<span class="tip">'.$Language->get('complete-this-field-with-the-tracking-id-google-tag').'</span>';
|
||||
$html .= '</div>';
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function siteHead()
|
||||
{
|
||||
global $Url;
|
||||
|
||||
$html = '';
|
||||
|
||||
// Google HTML tag
|
||||
if ($this->getValue('google-site-verification') && $Url->whereAmI()=='home') {
|
||||
$html .= PHP_EOL.'<!-- Google HTML tag -->'.PHP_EOL;
|
||||
$html .= '<meta name="google-site-verification" content="'.$this->getDbField('google-site-verification').'" />'.PHP_EOL;
|
||||
}
|
||||
|
||||
// Google Tag Manager
|
||||
if ($this->getValue('google-tag-manager')) {
|
||||
$html .= PHP_EOL."<!-- Google Tag Manager -->".PHP_EOL;
|
||||
$html .= "<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':".PHP_EOL;
|
||||
$html .= "new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],".PHP_EOL;
|
||||
$html .= "j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=".PHP_EOL;
|
||||
$html .= "'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);".PHP_EOL;
|
||||
$html .= "})(window,document,'script','dataLayer','".$this->getValue('google-tag-manager')."');</script>".PHP_EOL;
|
||||
$html .= "<!-- End Google Tag Manager -->".PHP_EOL;
|
||||
}
|
||||
|
||||
// Google Analytics
|
||||
if ($this->getValue('google-analytics-tracking-id')) {
|
||||
$html .= PHP_EOL.'<!-- Google Analytics -->'.PHP_EOL;
|
||||
$html .= '
|
||||
<script async src="https://www.googletagmanager.com/gtag/js?id='.$this->getValue('google-analytics-tracking-id').'"></script>
|
||||
<script>
|
||||
window.dataLayer = window.dataLayer || [];
|
||||
function gtag(){dataLayer.push(arguments);}
|
||||
gtag("js", new Date());
|
||||
|
||||
gtag("config", "'.$this->getValue('google-analytics-tracking-id').'");
|
||||
</script>'.PHP_EOL;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
|
||||
public function siteBodyBegin()
|
||||
{
|
||||
$html = '';
|
||||
|
||||
// Google Tag Manager
|
||||
if ($this->getValue('google-tag-manager')) {
|
||||
$html .= '<!-- Google Tag Manager (noscript) -->'.PHP_EOL;
|
||||
$html .= '<noscript><iframe src="https://www.googletagmanager.com/ns.html?id='.$this->getValue('google-tag-manager').'" height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>'.PHP_EOL;
|
||||
$html .= '<!-- End Google Tag Manager (noscript) -->'.PHP_EOL;
|
||||
}
|
||||
|
||||
return $html;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue