From 91e0c5c0c9d70cb72505034726c3500504ee0113 Mon Sep 17 00:00:00 2001 From: MaxBUhe Date: Wed, 29 May 2024 11:39:53 +0200 Subject: [PATCH] [Added] new Admin-UI --- .../Admin/GA4AdminUserInterface_main.php | 97 +++++++++ .../admin/de/d3googleanalytics4_lang.php | 77 +++++++ .../admin/tpl/d3googleanalytics4_main.tpl | 194 ++++++++++++++++++ menu.xml | 8 + metadata.php | 7 + 5 files changed, 383 insertions(+) create mode 100644 Application/Controller/Admin/GA4AdminUserInterface_main.php create mode 100644 Application/views/admin/de/d3googleanalytics4_lang.php create mode 100644 Application/views/admin/tpl/d3googleanalytics4_main.tpl create mode 100644 menu.xml diff --git a/Application/Controller/Admin/GA4AdminUserInterface_main.php b/Application/Controller/Admin/GA4AdminUserInterface_main.php new file mode 100644 index 0000000..f857f2c --- /dev/null +++ b/Application/Controller/Admin/GA4AdminUserInterface_main.php @@ -0,0 +1,97 @@ +addTplParam('d3ConfigObject', $oConf); + $this->addTplParam('d3ViewObject', $this); + $this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList()); + + return $return; + } + + public function save() + { + parent::save(); + + $aParams = Registry::getRequest()->getRequestEscapedParameter('editval'); + + $aCheckBoxParams = [ + '_blEnableGa4', + '_blEnableDebug', + '_blEnableConsentMode', + '_blEnableOwnCookieManager', + ]; + + foreach ($aCheckBoxParams as $checkBoxName){ + if (isset($aParams['bool'][$checkBoxName])){ + $aParams['bool'][$checkBoxName] = true; + }else{ + $aParams['bool'][$checkBoxName] = false; + } + } + + $this->d3SaveShopConfigVars($aParams); + } + + /** + * @param array $aParams + * @return void + */ + protected function d3SaveShopConfigVars(array $aParams) + { + $oConfig = Registry::getConfig(); + foreach ($aParams as $sConfigType => $aConfigParams) { + foreach ($aConfigParams as $sParamName => $sParamValue){ + if($this->d3GetModuleConfigParam($sParamName) !== $sParamValue){ + $oConfig->saveShopConfVar( + $sConfigType, + Constants::OXID_MODULE_ID.$sParamName, + $sParamValue, + $oConfig->getShopId(), + Constants::OXID_MODULE_ID + ); + } + } + } + } + + /** + * @param array $postArray + * @param array $toExcludeArray + * @return array + */ + public function clearOffPostParams(array $postArray, array $toExcludeArray) :array + { + foreach ($toExcludeArray as $excludeThis){ + if (in_array($excludeThis, array_keys($postArray))){ + unset($postArray[$excludeThis]); + } + } + + return $postArray; + } + + /** + * @param string $configParamName + * @return mixed + */ + public function d3GetModuleConfigParam(string $configParamName) + { + return Registry::getConfig()->getShopConfVar(Constants::OXID_MODULE_ID.$configParamName, null, Constants::OXID_MODULE_ID); + } +} \ No newline at end of file diff --git a/Application/views/admin/de/d3googleanalytics4_lang.php b/Application/views/admin/de/d3googleanalytics4_lang.php new file mode 100644 index 0000000..fcdcaea --- /dev/null +++ b/Application/views/admin/de/d3googleanalytics4_lang.php @@ -0,0 +1,77 @@ + 'UTF-8', + + 'd3mxgoogleanalytics4' => 'Google Analytics 4', + 'd3mxgoogleanalytics4set' => 'Modulverwaltung', + + // Base Translations + 'D3BASECONFIG' => 'Grundeinstellungen', + 'D3CLOSE' => 'Schließen', + 'D3NONE' => '- keinen -', + 'D3CONTAINERID' => 'Container-ID', + 'D3ACTIVATEMOD' => 'Modul aktivieren', + 'D3CNTRLPARAM' => 'Steuerungsparameter', + + // Use debug mode? + 'D3USEDEBUGMODE' => "Debug-Modus aktivieren", + + // Use Consentmode? + 'D3USEGOOGLECONSENTMODE' => "Google Consent Mode 'Default Values' akivieren", + + // Use CMP? + 'D3CMPTABTITLE' => 'Cookie Manager Einstellungen', + 'D3CMPUSEQ' => 'Cookie Manager nutzen?', + 'D3CMP' => 'Consent Management Platform ( CMP )', + + // Additional Config + // Server-Side tagging + 'D3SERVERSIDETAGGING' => 'Server-Side tagging', + 'D3DETAILED_DESC' => 'Detailliertere Erklärung der Funktion', + 'D3SERVERSIDETAGGING_HINT' => 'Die Conatiner-ID wird weiterhin unter "Grundeinstellungen" eingetragen!

+ "Serverseitiges Tagging ist eine neue Möglichkeit, mit Google Tag Manager Ihre Anwendung geräteübergreifend zu verwalten.
+ Servercontainer verwenden dasselbe Tag-, Trigger- und Variablenmodell, das Sie gewohnt sind.
+ Außerdem bieten sie neue Tools, mit denen Sie Nutzeraktivitäten überall messen können."
+
+ - Quelle Developers-Google Server-Side tagging
+
+ Verändern Sie die Werte nur, wenn Sie Server-Side tagging verwenden wollen! Gegebenenfalls fragen Sie einen technischen Ansprechpartner. + ', + 'D3SERVERSIDETAGGING_TITLE_ACTIVE' => 'Ausführender code', + 'D3SERVERSIDETAGGING_ACTIVE' => 'Diese Domain wird im aktiven-code ausgefüht. Das heißt, + dass es sich hierbei um das HTML-Tag script handelt. + Dieses kümmert sich darum, dass die im DataLayer + zusammengefassten Daten an den GTM weitergeleitet werden.
+
+

Folgend eine Darstellung, was genau ausgetauscht wird

+
+
+Vorher:
+https://www.googletagmanager.com/gtm.js?id=
+
+Nachher:
+{Domain}?id=
+
+                                                                        
', + 'D3SERVERSIDETAGGING_TITLE_PASSIVE' => 'nicht Ausführneder code', + 'D3SERVERSIDETAGGING_PASSIVE' => 'Diese Domain wird im passiven-code ausgefüht. Das heißt, + dass es sich hierbei um das HTML-Tag noscript handelt. + Dieses wird ausgeführt, wenn aus einem bestimmten Grund + das Javascript nicht ausgeführt wird.
+ ( keine Cookies erlaubt, JavaScript-Unterbindung, ... ) +
+

Folgend eine Darstellung, was genau ausgetauscht wird

+
+
+Vorher:
+src="https://www.googletagmanager.com/ns.html?id={Container-ID}"
+
+Nachher:
+src="{Domain}?id={Container-ID}"
+
+                                                                        
', +); \ No newline at end of file diff --git a/Application/views/admin/tpl/d3googleanalytics4_main.tpl b/Application/views/admin/tpl/d3googleanalytics4_main.tpl new file mode 100644 index 0000000..4d5e180 --- /dev/null +++ b/Application/views/admin/tpl/d3googleanalytics4_main.tpl @@ -0,0 +1,194 @@ +[{include file="headitem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}] + + + + + +[{if $readonly}] + [{assign var="readonly" value="readonly disabled"}] + [{else}] + [{assign var="readonly" value=""}] + [{/if}] + +
+
+
+
+ [{$oViewConf->getHiddenSid()}] + + + + +
+
+ [{oxmultilang ident="D3BASECONFIG"}] +
+
+
+ d3GetModuleConfigParam('_blEnableGa4')}]checked[{/if}] id="blGA4enab"> + +
+
+ [{oxmultilang ident="D3CONTAINERID"}] + +
+
+ d3GetModuleConfigParam('_blEnableDebug')}]checked[{/if}]> + +
+
+ d3GetModuleConfigParam('_blEnableConsentMode')}]checked[{/if}]> + +
+
+ +
+
+
+
+
+
+

+ +

+
+
+
+ d3GetModuleConfigParam('_blEnableOwnCookieManager')}]checked[{/if}]> + +
+
+ [{oxmultilang ident="D3CNTRLPARAM"}] + +
+ + +
+
+
+
+

+ +

+
+
+
+
+ [{oxmultilang ident="D3SERVERSIDETAGGING_HINT"}] +
+
+
+ [{oxmultilang ident="D3SERVERSIDETAGGING_TITLE_ACTIVE"}] + +
+
+ [{oxmultilang ident="D3SERVERSIDETAGGING_TITLE_PASSIVE"}] + +
+ +
+ + + + +
+
+
+
+
+
+
+
+
+
+ + \ No newline at end of file diff --git a/menu.xml b/menu.xml new file mode 100644 index 0000000..9096fa4 --- /dev/null +++ b/menu.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/metadata.php b/metadata.php index acd1bc1..d78eefd 100755 --- a/metadata.php +++ b/metadata.php @@ -1,5 +1,6 @@ 'Data Development (Inh.: Thomas Dartsch)', 'email' => 'support@shopmodule.com', 'url' => 'https://www.oxidmodule.com/', + 'controllers' => [ + 'd3googleanalytics4_main' => GA4AdminUserInterfaceMainController::class + ], 'extend' => [ // Core OEViewConfig::class => ViewConfig::class, @@ -93,6 +97,9 @@ $aModule = [ 'page/account/d3gtmnoticelist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmnoticelist.tpl', 'page/account/d3gtmrecommendationlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmrecommendationlist.tpl', 'page/account/d3gtmwishlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmwishlist.tpl', + + // Admin Templates + 'ga4/admin/d3ga4uimain.tpl' => 'd3/googleanalytics4/Application/views/admin/tpl/d3googleanalytics4_main.tpl', ], 'blocks' => [ // tag manager js