From 91c1c57270ab627693fbf9b4f48d760f41817477 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Mon, 13 Nov 2023 16:59:56 +0100 Subject: [PATCH] wip #6316 @1 --- app/Fluidbook/Compiler/Stats.php | 67 ++++++++++++++++------- app/Models/Traits/PublicationSettings.php | 1 + 2 files changed, 49 insertions(+), 19 deletions(-) diff --git a/app/Fluidbook/Compiler/Stats.php b/app/Fluidbook/Compiler/Stats.php index 40903875c..b75574e79 100644 --- a/app/Fluidbook/Compiler/Stats.php +++ b/app/Fluidbook/Compiler/Stats.php @@ -22,26 +22,8 @@ trait Stats $this->config->statsMatomo = false; } - if ($this->fluidbookSettings->tagcommander_id) { - $id = $this->fluidbookSettings->tagcommander_id; - if (!$this->fluidbookSettings->tagcommander_prod) { - $id .= '/uat'; - } - - $default = ['page_name' => '']; - $this->config->tagcommander_default_vars = array_merge($default, $this->parseVariables($this->fluidbookSettings->tagcommander_default_vars)); - $this->config->set('tagcommander_default_vars.env_work', $this->fluidbookSettings->tagcommander_prod ? 'prod' : 'pre-prod'); + $this->_tagCommander(); - $scriptNames = explode(',', $this->config->tagcommander_scriptname); - $this->fluidbookSettings->googleAnalyticsCustom .= ''; - for ($i = 1; $i < count($scriptNames); $i++) { - $this->fluidbookSettings->statsCustom .= ''; - } - - if ($this->fluidbookSettings->tagcommander_plan) { - $this->config->tagcommander_plan = $this->_parsePlan($this->fluidbookSettings->tagcommander_plan); - } - } if (isset($this->fluidbookSettings->googleTagManager) && $this->fluidbookSettings->googleTagManager) { $this->fluidbookSettings->googleAnalyticsCustom .= " '; + for ($i = 1; $i < count($scriptNames); $i++) { + $this->fluidbookSettings->statsCustom .= ''; + } + } + + } + protected function _parsePlan($filename) { $planPath = $this->_wdirOrAbsolute($filename); diff --git a/app/Models/Traits/PublicationSettings.php b/app/Models/Traits/PublicationSettings.php index b5101c733..bfed2f93a 100644 --- a/app/Models/Traits/PublicationSettings.php +++ b/app/Models/Traits/PublicationSettings.php @@ -2108,6 +2108,7 @@ trait PublicationSettings ); $this->addSettingField('tagcommander_id', LongText::class, 'Tag commander ID', [ 'v2' => '{"type":"text","default":"","editable":true,"label":"Tag commander ID","grade":3}', + 'when' => ['tagcommander_plan_type' => 'file'], ]); $this->addSettingField('tagcommander_scriptname', LongText::class, 'Nom du script Tagcommander', [ 'v2' => '{"type":"text","default":"tc_Multisite_Head.js,tc_Multisite_Analytics.js,tc_Multisite_Medias.js","editable":true,"label":"Nom du script Tagcommander","grade":3}', -- 2.39.5