Compare commits

...

16 Commits

Author SHA1 Message Date
MaxBUhe db680b893f [Bump] metadata && changelog 2024-04-11 11:34:36 +02:00
MaxBUhe 4458fc55ee [Added] preventing wrong id-calling 2024-04-11 11:34:16 +02:00
MaxBUhe 6053219687 [Changed] cleaning ViewConfig 2024-04-11 11:33:51 +02:00
MaxBUhe dbaf871c9e [Changed] styling 2024-04-11 11:24:18 +02:00
MaxBUhe 2a8c939afd [OST830498][Removed] ( for now ) unnecessary set 2024-04-11 11:24:18 +02:00
MaxBUhe 02db7be9d8 [OST830498][Fixed] comment-error
Syntax-Error duo to the OXID-strip that made the inline-comment cut off "})" of the code
2024-04-11 11:24:17 +02:00
MaxBUhe aa616db0f2 [OST830498][Fixed] dataLayer overwriting 2024-04-11 11:24:17 +02:00
MaxBUhe 60a3c797fb [OST830498][Added] multilang ident 2024-04-11 11:24:16 +02:00
MaxBUhe 55306e0495 [OST830498][Added] consent-mode standard values 2024-04-11 11:24:16 +02:00
MaxBUhe d856a994ab [OST830498][Changed] metadataid centralized 2024-04-11 11:24:15 +02:00
MaxBUhe 550c9dbdf9 [Fixed] wrong method call
reverting LTS-methods to deprecated module-config call
2024-04-11 11:14:17 +02:00
MaxBUhe 44e54b7329 [Bump] metadata + changelog 2024-04-11 10:59:39 +02:00
MaxBUhe 5f72d0837e [OST#929760][Added] multilang texts for desc
Test: OK
2024-04-11 10:58:25 +02:00
MaxBUhe 201bcb6e37 [OST#929760][Added] serverside tagging usability
*missing any test, yet!
2024-04-11 10:58:24 +02:00
MaxBUhe 97c3927998 [Bump] metadata + changelog 2024-04-11 10:28:06 +02:00
MaxBUhe cbe3293ff1 [Fixed] potential error
if no basket-component is given, error occurs
2024-04-11 10:10:59 +02:00
8 changed files with 164 additions and 9 deletions

View File

@ -0,0 +1,11 @@
<?php
declare(strict_types=1);
namespace D3\GoogleAnalytics4\Application\Model;
class Constants
{
public const OXID_MODULE_ID = 'd3googleanalytics4';
}

View File

@ -27,6 +27,52 @@ $aLang = [
'SHOP_MODULE_d3_gtm_blGA4enab' => 'GA4 Aktivieren',
'SHOP_MODULE_d3_gtm_blUAenabled' => 'UA Aktivieren',
'SHOP_MODULE_d3_gtm_blEnableDebug' => 'Debug-Modus aktivieren',
'SHOP_MODULE_GROUP_d3_gtm_settings_serversidetagging' => 'Server-Side tagging',
'SHOP_MODULE_d3_gtm_settings_serversidetagging_js' => 'Servercontainer Ausführender-Code',
'HELP_SHOP_MODULE_d3_gtm_settings_serversidetagging_js' => 'Diese Domain wird im <strong>aktiven</strong>-code ausgefüht. Das heißt,
dass es sich hierbei um das HTML-Tag <code>script</code> handelt.
Dieses kümmert sich darum, dass die, im data_layer
zusammengefassten Daten an den GTM weitergeleitet werden.<br>
<br>
<h4>Folgend eine Darstellung, was genau ausgetauscht wird</h4>
<pre>
<code>
Vorher:
https://www.googletagmanager.com/gtm.js?id=
Nachher:
{Domain}?id=
</code>
</pre>
Die Conatiner-ID wird weiterhin im Punkt "Einstellung" eingetragen!
',
'SHOP_MODULE_d3_gtm_settings_serversidetagging_nojs' => 'Servercontainer NICHT Ausführender-Code<br><br>
"Serverseitiges Tagging ist eine neue Möglichkeit, mit Google Tag Manager Ihre Anwendung geräteübergreifend zu verwalten.<br>
Servercontainer verwenden dasselbe Tag-, Trigger- und Variablenmodell, das Sie gewohnt sind.<br>
Außerdem bieten sie neue Tools, mit denen Sie Nutzeraktivitäten überall messen können." <br>
<br>
- Quelle <a href="https://developers.google.com/tag-platform/tag-manager/server-side/intro">Developers-Google Server-Side tagging</a><br>
<br>
<strong>Verändern Sie die Werte nur, wenn Sie Server-Side tagging verwenden wollen!</strong>
',
'HELP_SHOP_MODULE_d3_gtm_settings_serversidetagging_nojs' => 'Diese Domain wird im <strong>passiven</strong>-code ausgefüht. Das heißt,
dass es sich hierbei um das HTML-Tag <code>noscript</code> handelt.
Dieses wird ausgeführt, wenn aus einem bestimmten Grund
das Javascript nicht ausgeführt wird.<br>
( keine Cookies erlaubt, JavaScript-Unterbindung, ... )
<br>
<h4>Folgend eine Darstellung, was genau ausgetauscht wird</h4>
<pre>
<code>
Vorher:
src="https://www.googletagmanager.com/ns.html?id={Container-ID}"
Nachher:
src="{Domain}?id={Container-ID}"
</code>
</pre>
Die Conatiner-ID wird weiterhin im Punkt "Einstellung" eingetragen!
',
// for cookie manager settings
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
@ -49,5 +95,10 @@ $aLang = [
<strong>Beachte:</strong><br>
Sofern Sie die <a target="_blank" href="https://consentmanager.net" style="color: blue">consentmanager</a> CMP verwenden,
bitte ich Sie, gründlichst, die Hinweise der <a target="_blank" href="https://git.d3data.de/D3Public/GoogleAnalytics4/src/branch/master/Docs/CMP/consentmanager.md">Moduldokumentation/Consentmanager</a> zu lesen.
'
',
'SHOP_MODULE_d3_gtm_blActivateConsentMode' => "Google Consent Mode 'Default Values' aktivieren",
'HELP_SHOP_MODULE_d3_gtm_blActivateConsentMode' => 'Diese Einstellung ist zu aktivieren, wenn Sie den Google-Consent-Mode ( Einwilligungsmodus ) verwenden wollen.
<hr>
"Im Einwilligungsmodus können Sie Google über den Cookie- oder App-ID-Einwilligungsstatus Ihrer Nutzer informieren.
Mit Tags wird das Verhalten angepasst. Dabei werden die Einstellungen der Nutzer berücksichtigt." ~ <a href="https://support.google.com/google-ads/answer/10000067">Google Einwilligungsmodus</a>',
];

View File

@ -3,9 +3,28 @@
var dataLayer = [{$oViewConf->getGtmDataLayer()}] || [];
</script>
[{assign var="d3GtmContainerIdString" value=$oViewConf->getGtmContainerId()}]
[{if $oViewConf->D3blShowGtmScript()}]
[{if $oViewConf->getGtmContainerId()}]
[{if $d3GtmContainerIdString}]
[{strip}]
[{if $oViewConf->isGtmConsentModeSetActivated()}]
<script type="text/javascript">
function gtag() {
dataLayer.push(arguments);
}
gtag("consent", "default", {
ad_user_data: "denied",
ad_personalization: "denied",
ad_storage: "denied",
analytics_storage: "denied",
wait_for_update: 2000
});
</script>
[{/if}]
<!-- Google Tag Manager -->
<script [{$oViewConf->getGtmScriptAttributes()}]>
(function (w, d, s, l, i) {
@ -13,9 +32,9 @@
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;
j.src = '[{$oViewConf->getServerSidetaggingJsDomain()}]?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
})(window, document, 'script', 'dataLayer', '[{$d3GtmContainerIdString}]');
</script>
<!-- End Google Tag Manager -->
[{/strip}]

View File

@ -2,7 +2,7 @@
[{if $oViewConf->getGtmContainerId()}][{strip}]
<!-- Google Tag Manager (noscript) -->
<noscript>
<iframe src="https://www.googletagmanager.com/ns.html?id=[{$oViewConf->getGtmContainerId()}]"
<iframe src="[{$oViewConf->getServerSidetaggingNoJsDomain()}]?id=[{$oViewConf->getGtmContainerId()}]"
height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript>
<!-- End Google Tag Manager (noscript) -->

View File

@ -1,5 +1,5 @@
[{if $d3CmpBasket->getAddToBasketDecision() && $d3CmpBasket->d3GtmRequestedArticleLoadedByAnid() !== null}]
[{if $d3CmpBasket && $d3CmpBasket->getAddToBasketDecision() && $d3CmpBasket->d3GtmRequestedArticleLoadedByAnid() !== null}]
[{assign var="oGtmProduct" value=$d3CmpBasket->d3GtmRequestedArticleLoadedByAnid()}]
[{assign var="oGtmAmountArticlesAdded" value=$d3CmpBasket->getD3GtmAddToCartAmountArticles()}]
[{*$smarty.block.parent*}]

View File

@ -4,6 +4,22 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.17.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.16.0...1.17.0) - 2024-04-11
### Added
- multilang translations
- GA4 consent-mode default values
### Changed
- metadataID centralized
## [1.16.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.15.1...1.16.0) - 2024-04-11
### Added
- ( Google ) Server-Side tagging usability
## [1.15.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.15.0...1.15.1) - 2024-04-11
### Fixed
- false processing of template during missing necessary-component
## [1.15.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.14.0...1.15.0) - 2024-01-25
### Fixed
- missing Component-ArticleDetails extension, missing ManufacturerListController extension

View File

@ -144,7 +144,10 @@ class ViewConfig extends ViewConfig_parent
private $blGA4enabled = null;
/**
* @return null
*/
public function isGA4enabled()
{
if ($this->blGA4enabled === null)
@ -155,6 +158,17 @@ class ViewConfig extends ViewConfig_parent
return $this->blGA4enabled;
}
/**
* @return bool
*/
public function isGtmConsentModeSetActivated() :bool
{
return Registry::getConfig()->getConfigParam('d3_gtm_blActivateConsentMode');
}
/**
* @return false|string
*/
public function getGtmDataLayer()
{
if (!$this->getGtmContainerId()) return "[]";
@ -193,14 +207,37 @@ class ViewConfig extends ViewConfig_parent
return json_encode([$dataLayer], JSON_PRETTY_PRINT);
}
/**
* @return bool
*/
public function isDebugModeOn() :bool
{
return Registry::getConfig()->getConfigParam('d3_gtm_blEnableDebug');
}
/**
* @param $listId
* @return void
*/
public function isPromotionList($listId)
{
$oConfig = Registry::getConfig();
$aPromotionListIds = $oConfig->getConfigParam("") ?? ['bargainItems', 'newItems', 'topBox', 'alsoBought', 'accessories', 'cross'];
}
/**
* @return string
*/
public function getServerSidetaggingJsDomain() :string
{
return Registry::getConfig()->getConfigParam('d3_gtm_settings_serversidetagging_js');
}
/**
* @return string
*/
public function getServerSidetaggingNoJsDomain() :string
{
return Registry::getConfig()->getConfigParam('d3_gtm_settings_serversidetagging_nojs');
}
}

View File

@ -1,5 +1,6 @@
<?php
use D3\GoogleAnalytics4\Application\Model\Constants as Constants;
use D3\GoogleAnalytics4\Modules\Application\Component\d3GtmBasketComponentExtension;
use D3\GoogleAnalytics4\Modules\Application\Component\Widget\d3GtmWidgetArticleDetails as d3GtmWidgetArticleDetails;
use D3\GoogleAnalytics4\Modules\Application\Controller\ArticleDetailsController;
@ -35,7 +36,7 @@ use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
$sMetadataVersion = '2.1';
$aModule = [
'id' => 'd3googleanalytics4',
'id' => Constants::OXID_MODULE_ID,
'title' => 'Google Analytics 4',
'description' => "Dieses Modul bietet die Möglichkeit in Ihrem OXID eShop (6.x) die neue 'Property'
Google Analytics 4 (GA4) von Google zu integrieren.<br>
@ -48,7 +49,7 @@ $aModule = [
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a>
",
'thumbnail' => 'thumbnail.png',
'version' => '1.15.0',
'version' => '1.17.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',
@ -189,6 +190,13 @@ $aModule = [
'value' => false,
'position' => 999
],
[
'group' => 'd3_gtm_settings',
'name' => 'd3_gtm_blActivateConsentMode',
'type' => 'bool',
'value' => false,
'position' => 999
],
[
'group' => 'd3_gtm_settings_cookiemanager',
'name' => 'd3_gtm_settings_hasOwnCookieManager',
@ -210,5 +218,18 @@ $aModule = [
'value' => 'none',
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST|COOKIEBOT',
],
// OST929760 - Erweiterung für Serverside Tagging
[
'group' => 'd3_gtm_settings_serversidetagging',
'name' => 'd3_gtm_settings_serversidetagging_js',
'type' => 'str',
'value' => 'https://www.googletagmanager.com/gtm.js',
],
[
'group' => 'd3_gtm_settings_serversidetagging',
'name' => 'd3_gtm_settings_serversidetagging_nojs',
'type' => 'str',
'value' => 'https://www.googletagmanager.com/ns.html',
],
]
];