Compare commits
19 Commits
Author | SHA1 | Date |
---|---|---|
MaxBUhe | a184627443 | |
MaxBUhe | 681d0932e0 | |
MaxBUhe | efc9aa08e0 | |
MaxBUhe | db39d4155f | |
MaxBUhe | 17839b319e | |
MaxBUhe | 7847ad9874 | |
MaxBUhe | b3f2446a7d | |
MaxBUhe | ce1614996a | |
MaxBUhe | ec2d43ff3c | |
MaxBUhe | c32c66322f | |
MaxBUhe | 8079eee236 | |
MaxBUhe | 00c0bd2497 | |
MaxBUhe | 76eeb0d5bd | |
MaxBUhe | 0baa44e5d7 | |
MaxBUhe | a38dcb8e45 | |
MaxBUhe | 1ae5a9d926 | |
MaxBUhe | 938d1514a6 | |
MaxBUhe | 9a48d32c3b | |
MaxBUhe | bc8876367c |
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Application\Model;
|
||||
|
||||
|
||||
class Constants
|
||||
{
|
||||
public const OXID_MODULE_ID = 'd3googleanalytics4';
|
||||
}
|
|
@ -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>',
|
||||
];
|
||||
|
|
|
@ -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>
|
||||
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}]
|
||||
|
|
|
@ -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) -->
|
||||
|
|
|
@ -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*}]
|
||||
|
|
35
CHANGELOG.md
35
CHANGELOG.md
|
@ -4,6 +4,30 @@ 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).
|
||||
|
||||
## [unreleased](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.2...rel_2.x) - 2024-x
|
||||
### Added
|
||||
- trait for generalized method
|
||||
|
||||
## [2.17.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.1...2.17.2) - 2024-04-11
|
||||
### Fixed
|
||||
- error on missing necessary-component
|
||||
|
||||
## [2.17.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.0...2.17.1) - 2024-04-10
|
||||
### Fixed
|
||||
- second call of getGtmContainerId() ( returned false )
|
||||
|
||||
## [2.17.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.16.0...2.17.0) - 2024-04-10
|
||||
### Added
|
||||
- Google-Analytics default values
|
||||
- default values switch ( admin module settings )
|
||||
- translations
|
||||
## Changed
|
||||
- centralized metadata-id
|
||||
|
||||
## [2.16.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.15.0...2.16.0) - 2024-03-20
|
||||
### Added
|
||||
- ( Google ) Server-Side tagging usability
|
||||
|
||||
## [2.15.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.14.0...2.15.0) - 2024-02-05
|
||||
### Fixed
|
||||
- missing Component-ArticleDetails extension, missing ManufacturerListController extension
|
||||
|
@ -142,6 +166,17 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
### Added
|
||||
- using of ContainerFactory in ViewConfig
|
||||
|
||||
## [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.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
|
||||
|
|
|
@ -4,41 +4,5 @@ namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
|||
|
||||
class Category extends Category_parent
|
||||
{
|
||||
/**
|
||||
* @param int $indexOfArray
|
||||
* @return string
|
||||
*/
|
||||
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
|
||||
{
|
||||
if ($bShallTakeStd){
|
||||
$splitCatArray =
|
||||
array_values(
|
||||
array_filter(
|
||||
explode(
|
||||
'/',
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
|
||||
return $splitCatArray[$indexOfArray];
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
);
|
||||
}
|
||||
use articleTreeStructure;
|
||||
}
|
|
@ -4,41 +4,5 @@ namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
|||
|
||||
class Manufacturer extends Manufacturer_parent
|
||||
{
|
||||
/**
|
||||
* @param int $indexOfArray
|
||||
* @return string
|
||||
*/
|
||||
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
|
||||
{
|
||||
if ($bShallTakeStd){
|
||||
$splitCatArray =
|
||||
array_values(
|
||||
array_filter(
|
||||
explode(
|
||||
'/',
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
|
||||
return $splitCatArray[$indexOfArray];
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
);
|
||||
}
|
||||
use articleTreeStructure;
|
||||
}
|
|
@ -0,0 +1,11 @@
|
|||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
||||
|
||||
|
||||
class Vendor extends \OxidEsales\Eshop\Application\Model\Vendor
|
||||
{
|
||||
use articleTreeStructure;
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
||||
|
||||
trait articleTreeStructure
|
||||
{
|
||||
/**
|
||||
* @param int $indexOfArray
|
||||
* @return string
|
||||
*/
|
||||
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
|
||||
{
|
||||
if ($bShallTakeStd){
|
||||
$splitCatArray =
|
||||
array_values(
|
||||
array_filter(
|
||||
explode(
|
||||
'/',
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
|
||||
return $splitCatArray[$indexOfArray];
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
|
@ -12,6 +12,7 @@
|
|||
|
||||
namespace D3\GoogleAnalytics4\Modules\Core;
|
||||
|
||||
use D3\GoogleAnalytics4\Application\Model\Constants;
|
||||
use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
|
||||
use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
|
||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||
|
@ -36,7 +37,7 @@ class ViewConfig extends ViewConfig_parent
|
|||
$this->sContainerId = ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_sContainerID', 'd3googleanalytics4');
|
||||
->get('d3_gtm_sContainerID', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
return $this->sContainerId;
|
||||
}
|
||||
|
@ -162,12 +163,20 @@ class ViewConfig extends ViewConfig_parent
|
|||
$this->sContainerId = ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_blEnableGA4', 'd3googleanalytics4');
|
||||
->get('d3_gtm_blEnableGA4', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
|
||||
return $this->blGA4enabled;
|
||||
}
|
||||
|
||||
public function isGtmConsentModeSetActivated() :bool
|
||||
{
|
||||
return $this->sContainerId = ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_blActivateConsentMode', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
|
||||
public function getGtmDataLayer()
|
||||
{
|
||||
if (!$this->getGtmContainerId()) return "[]";
|
||||
|
@ -215,4 +224,30 @@ class ViewConfig extends ViewConfig_parent
|
|||
$oConfig = Registry::getConfig();
|
||||
$aPromotionListIds = $oConfig->getConfigParam("") ?? ['bargainItems', 'newItems', 'topBox', 'alsoBought', 'accessories', 'cross'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getServerSidetaggingJsDomain() :string
|
||||
{
|
||||
return ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_settings_serversidetagging_js', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getServerSidetaggingNoJsDomain() :string
|
||||
{
|
||||
return ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_settings_serversidetagging_nojs', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
}
|
25
metadata.php
25
metadata.php
|
@ -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' => '2.15.0',
|
||||
'version' => '2.17.2',
|
||||
'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',
|
||||
],
|
||||
]
|
||||
];
|
Loading…
Reference in New Issue