/** * */
$this->fields['stats'] = array('type' => 'boolean', 'default' => true, 'editable' => true, 'label' => __('Activer les statistiques Fluidbook'), 'grade' => 3);
$this->fields['googleAnalytics'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Code Google Analytics'), 'size' => 10);
+ $this->fields['googleTagManager'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __('Code Google Tag Manager'), 'size' => 10);
$this->forms['basicStats'] = [
'label' => __('Statistiques'),
- 'fieldsnames' => ['stats', 'googleAnalytics'],
+ 'fieldsnames' => ['stats', 'googleAnalytics', 'googleTagManager'],
];
$this->fields['email_title'] = array('type' => 'text', 'default' => '', 'editable' => true, 'label' => __("Titre de l'email") . ' "' . __('Envoyer à un ami') . '"', 'hint' => __('Laisser vide pour utiliser la valeur par défaut'));
}
$this->config->product_zoom_references = [];
- foreach ($this->config->basketReferences as $ref => $data){
+ foreach ($this->config->basketReferences as $ref => $data) {
$this->config->product_zoom_references[$ref] = [$ref];
}
}
$this->config->tagcommander_plan = $fixedplan;
}
}
+ if (isset($this->book->parametres->googleTagManager) && $this->book->parametres->googleTagManager) {
+ $this->book->parametres->googleAnalyticsCustom .= "<!-- Google Tag Manager -->
+<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
+new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
+j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
+'https://www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
+})(window,document,'script','dataLayer','" . $this->book->parametres->googleTagManager . "');</script>
+<!-- End Google Tag Manager -->
+";
+ $this->book->parametres->statsCustom = '<!-- Google Tag Manager (noscript) -->
+<noscript><iframe src="https://www.googletagmanager.com/ns.html?id='.$this->book->parametres->googleTagManager.'"
+height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
+<!-- End Google Tag Manager (noscript) -->';
+ }
}
protected function writeSecure()