Compare commits

...

11 Commits

Author SHA1 Message Date
9d4f51e574 [Bump] Metadata & Changelog 2025-02-19 22:12:05 +01:00
31f7578aa4 [Changed] composer.json meta-reqs 2025-02-19 22:09:40 +01:00
05fbafea6e [Fixed] missing menu-translation 2025-02-19 22:04:11 +01:00
c0951277b8 [Fixed] false metadata view_cart entry 2025-02-19 21:58:48 +01:00
28f04c8281 [Bump] Metadata && Changelog 2024-12-21 14:53:16 +01:00
f7bef420aa [OST614872][Added] method for additional globals 2024-12-16 17:37:12 +01:00
c0c78ce63d don't submit item prices, if user doesn't have "show price" right 2024-11-15 13:46:44 +01:00
2ec373c95f [Bump] Metadata && Changelog 2024-09-21 16:23:06 +02:00
6fcb9f8b84 [Changed] add "internal_names" to constant 2024-09-21 16:20:48 +02:00
53b3c878ce [Fixed] Consentmanager doesn't get delivered
false value given for important decision-making. Since the value was false, we got "false" as return for D3blShowGtmScript() which made consentmanager not send the data to GTM
2024-09-21 16:08:08 +02:00
65b618e25c [Removed] unnecessary "none" entry for CMP-choosability 2024-09-21 16:06:32 +02:00
18 changed files with 106 additions and 37 deletions

View File

@ -7,19 +7,25 @@ use D3\GoogleAnalytics4\Application\Model\CMP\Usercentrics;
class ManagerTypes class ManagerTypes
{ {
const EXTERNAL_SERVICE = "eigener Service"; const EXTERNAL_SERVICE = "eigener Service";
const INTERNAL_EXTERNAL_SERVICE = "externalService";
const NET_COOKIE_MANAGER = "Netensio Cookie Manager"; const NET_COOKIE_MANAGER = "Netensio Cookie Manager";
const INTERNAL_NET_COOKIE_MANAGER = "net_cookie_manager";
/** /**
* Further information's: * Further information's:
* https://github.com/aggrosoft/oxid-cookie-compliance * https://github.com/aggrosoft/oxid-cookie-compliance
*/ */
const AGCOOKIECOMPLIANCE = "Aggrosoft Cookie Compliance"; const AGCOOKIECOMPLIANCE = "Aggrosoft Cookie Compliance";
const INTERNAL_AGCOOKIECOMPLIANCE = "agcookiecompliance";
const CONSENTMANAGER = "Consentmanager"; const CONSENTMANAGER = "Consentmanager";
const INTERNAL_CONSENTMANAGER = "cmconsentmanager";
const COOKIEFIRST = "Cookiefirst"; const COOKIEFIRST = "Cookiefirst";
const INTERNAL_COOKIEFIRST = "cookiefirst";
const COOKIEBOT = "Cookiebot"; const COOKIEBOT = "Cookiebot";
const INTERNAL_COOKIEBOT = "cookiebot";
/** /**
* @return array * @return array
@ -27,14 +33,14 @@ class ManagerTypes
public function getManagerList(): array public function getManagerList(): array
{ {
return [ return [
"externalService" => self::EXTERNAL_SERVICE, self::INTERNAL_EXTERNAL_SERVICE => self::EXTERNAL_SERVICE,
"agcookiecompliance" => self::AGCOOKIECOMPLIANCE, self::INTERNAL_AGCOOKIECOMPLIANCE => self::AGCOOKIECOMPLIANCE,
"net_cookie_manager" => self::NET_COOKIE_MANAGER, self::INTERNAL_NET_COOKIE_MANAGER => self::NET_COOKIE_MANAGER,
Usercentrics::sModuleIncludationInternalName => Usercentrics::sModuleIncludationPublicName, Usercentrics::sModuleIncludationInternalName => Usercentrics::sModuleIncludationPublicName,
Usercentrics::sExternalIncludationInternalName => Usercentrics::sExternalIncludationPublicName, Usercentrics::sExternalIncludationInternalName => Usercentrics::sExternalIncludationPublicName,
"cmconsentmanager" => self::CONSENTMANAGER, self::INTERNAL_CONSENTMANAGER => self::CONSENTMANAGER,
"cookiefirst" => self::COOKIEFIRST, self::INTERNAL_COOKIEFIRST => self::COOKIEFIRST,
"cookiebot" => self::COOKIEBOT, self::INTERNAL_COOKIEBOT => self::COOKIEBOT,
]; ];
} }
@ -46,4 +52,21 @@ class ManagerTypes
{ {
return in_array($sManager, array_keys($this->getManagerList()), true); return in_array($sManager, array_keys($this->getManagerList()), true);
} }
/**
* @return array
*
* the CMP from this method always needs the script tag delivered to the dom.
*/
public function scriptTagDeliveredByDefaultArray() :array
{
return [
Usercentrics::sModuleIncludationInternalName,
Usercentrics::sExternalIncludationInternalName,
ManagerTypes::INTERNAL_CONSENTMANAGER,
ManagerTypes::INTERNAL_COOKIEFIRST,
ManagerTypes::INTERNAL_COOKIEBOT,
ManagerTypes::INTERNAL_EXTERNAL_SERVICE
];
}
} }

View File

@ -7,6 +7,7 @@ $aLang = array(
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'd3mxgoogleanalytics4' => 'Google Analytics 4', 'd3mxgoogleanalytics4' => 'Google Analytics 4',
'd3mxd3modules' => 'Google Analytics 4',
'd3mxgoogleanalytics4set' => 'Einstellungen', 'd3mxgoogleanalytics4set' => 'Einstellungen',
// Base Translations // Base Translations

View File

@ -80,7 +80,6 @@
[{oxmultilang ident="D3CMP"}] [{oxmultilang ident="D3CMP"}]
</label> </label>
<select class="form-select w-50" name="editval[select][_HAS_STD_MANAGER]" aria-label="Default select example"> <select class="form-select w-50" name="editval[select][_HAS_STD_MANAGER]" aria-label="Default select example">
<option value="NONE" selected>[{oxmultilang ident="D3NONE"}]</option>
[{foreach from=$d3ManagerTypeArray key="sInternalName" item="sPublicName" name="editval[aCmpNameArray]"}] [{foreach from=$d3ManagerTypeArray key="sInternalName" item="sPublicName" name="editval[aCmpNameArray]"}]
<option value="[{$sInternalName}]" [{if $sInternalName === $d3CurrentCMP}]SELECTED[{/if}]>[{$sPublicName}]</option> <option value="[{$sInternalName}]" [{if $sInternalName === $d3CurrentCMP}]SELECTED[{/if}]>[{$sPublicName}]</option>
[{/foreach}] [{/foreach}]

View File

@ -36,7 +36,7 @@
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]', 'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]', 'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
[{/if}] [{/if}]
'price': [{$gtmItemPriceObject->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$gtmItemPriceObject->getPrice()}],[{/oxhasrights}]
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]', 'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'quantity': [{$basketitem->getAmount()}], 'quantity': [{$basketitem->getAmount()}],
'position': [{$smarty.foreach.gtmCartContents.index}] 'position': [{$smarty.foreach.gtmCartContents.index}]

View File

@ -37,7 +37,7 @@
{ {
'item_id': '[{$oGtmProduct->getFieldData('oxartnum')}]', 'item_id': '[{$oGtmProduct->getFieldData('oxartnum')}]',
'item_name': '[{$oGtmProduct->getFieldData('oxtitle')}]', 'item_name': '[{$oGtmProduct->getFieldData('oxtitle')}]',
'price': [{$d3PriceObject->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3PriceObject->getPrice()}],[{/oxhasrights}]
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]', 'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_variant': '[{if $oGtmProduct->getFieldData('oxvarselect')}][{$oGtmProduct->getFieldData('oxvarselect')}][{/if}]', 'item_variant': '[{if $oGtmProduct->getFieldData('oxvarselect')}][{$oGtmProduct->getFieldData('oxvarselect')}][{/if}]',
[{if $gtmCategory}] [{if $gtmCategory}]

View File

@ -35,7 +35,7 @@
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]', 'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]', 'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
[{/if}] [{/if}]
'price': [{$d3oItemPrice->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3oItemPrice->getPrice()}],[{/oxhasrights}]
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]', 'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'quantity': [{$basketitem->getAmount()}], 'quantity': [{$basketitem->getAmount()}],
'position': [{$smarty.foreach.gtmCartContents.index}] 'position': [{$smarty.foreach.gtmCartContents.index}]

View File

@ -40,7 +40,7 @@
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3, true)}]', 'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]', 'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
[{/if}] [{/if}]
'price': [{$gtmPurchaseItemPriceObject->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$gtmPurchaseItemPriceObject->getPrice()}],[{/oxhasrights}]
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}], 'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
'position': [{$smarty.foreach.gtmArticles.iteration}] 'position': [{$smarty.foreach.gtmArticles.iteration}]
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}] }[{if !$smarty.foreach.gtmArticles.last}],[{/if}]

View File

@ -28,7 +28,7 @@
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]', 'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]', 'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
[{/if}] [{/if}]
'price': [{$d3oItemPrice->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3oItemPrice->getPrice()}],[{/oxhasrights}]
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]', 'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'quantity': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]', 'quantity': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]',
'position': [{$smarty.foreach.gtmRemovedItems.index}] 'position': [{$smarty.foreach.gtmRemovedItems.index}]

View File

@ -33,7 +33,7 @@
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]', 'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]', 'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
[{/if}] [{/if}]
'price': [{$d3oItemPrice->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3oItemPrice->getPrice()}],[{/oxhasrights}]
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]', 'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'quantity': [{$basketitem->getAmount()}], 'quantity': [{$basketitem->getAmount()}],
'position': [{$smarty.foreach.gtmCartContents.index}] 'position': [{$smarty.foreach.gtmCartContents.index}]

View File

@ -28,7 +28,7 @@
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]', 'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
[{/if}] [{/if}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}] [{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
'price': [{$d3PriceObject->getPrice()}] [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3PriceObject->getPrice()}][{/oxhasrights}]
} }
] ]
}[{if $oViewConf->isDebugModeOn()}], }[{if $oViewConf->isDebugModeOn()}],

View File

@ -22,7 +22,7 @@
{ {
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]', 'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]', 'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$d3PriceObject->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3PriceObject->getPrice()}],[{/oxhasrights}]
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]', 'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
[{if $gtmCategory}] [{if $gtmCategory}]
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]', 'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',

View File

@ -18,7 +18,7 @@
{ {
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]', 'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]', 'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$d3PriceObject->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3PriceObject->getPrice()}],[{/oxhasrights}]
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]', 'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
[{if $gtmCategory}] [{if $gtmCategory}]
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]', 'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',

View File

@ -30,7 +30,7 @@
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]', 'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]', 'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
[{/if}] [{/if}]
'price': [{$d3oItemPrice->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3oItemPrice->getPrice()}],[{/oxhasrights}]
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]', 'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'quantity': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]', 'quantity': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]',
'position': [{$smarty.foreach.gtmRemovedItems.index}] 'position': [{$smarty.foreach.gtmRemovedItems.index}]

View File

@ -20,7 +20,7 @@
{ {
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]', 'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]', 'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$d3PriceObject->getPrice()}], [{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3PriceObject->getPrice()}],[{/oxhasrights}]
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]', 'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
[{if $gtmCategory}] [{if $gtmCategory}]
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]', 'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',

View File

@ -4,7 +4,25 @@ 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/), 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). 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 ## [unreleased](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.24.0...rel_2.x) - 2025-x
### Added
- data layer doesn't contain prices if current user hasn't "show price" rights
## [2.24.0.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.23.0...2.24.0.0) - 2025-02-19
### Fixed
- false metadata view_cart entry
- missing menu-translation
## [2.23.0.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.22.0...2.23.0.0) - 2024-12-21
### Added
- another tag-versioning position
- additional global variables, if given
## [2.22.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.21.0...2.22.0) - 2024-09-21
### Fixed
- Consentmanager didn't get delivered
### Changed
- write "internal_names" of CMP to constants
## [2.21.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.20.1...2.21.0) - 2024-09-19 ## [2.21.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.20.1...2.21.0) - 2024-09-19
### Fixed ### Fixed

View File

@ -88,7 +88,7 @@ class ViewConfig extends ViewConfig_parent
$sCookieID = trim($this->d3GetModuleConfigParam('_sControlParameter')); $sCookieID = trim($this->d3GetModuleConfigParam('_sControlParameter'));
// Netensio Cookie Manager // Netensio Cookie Manager
if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) { if ($this->sCookieManagerType === ManagerTypes::INTERNAL_NET_COOKIE_MANAGER) {
$oSession = Registry::getSession(); $oSession = Registry::getSession();
$aCookies = $oSession->getVariable("aCookieSel"); $aCookies = $oSession->getVariable("aCookieSel");
@ -96,20 +96,18 @@ class ViewConfig extends ViewConfig_parent
} }
// Aggrosoft Cookie Consent // Aggrosoft Cookie Consent
if ($this->sCookieManagerType === ManagerTypes::AGCOOKIECOMPLIANCE) { if ($this->sCookieManagerType === ManagerTypes::INTERNAL_AGCOOKIECOMPLIANCE) {
if (method_exists($this, "isCookieCategoryEnabled")) { if (method_exists($this, "isCookieCategoryEnabled")) {
return $this->isCookieCategoryEnabled($sCookieID); return $this->isCookieCategoryEnabled($sCookieID);
} }
} }
// UserCentrics or consentmanager
if ( if (
$this->sCookieManagerType === Usercentrics::sModuleIncludationInternalName in_array
or $this->sCookieManagerType === Usercentrics::sExternalIncludationInternalName (
or $this->sCookieManagerType === ManagerTypes::CONSENTMANAGER $this->sCookieManagerType,
or $this->sCookieManagerType === ManagerTypes::COOKIEFIRST (oxNew(ManagerTypes::class)->scriptTagDeliveredByDefaultArray())
or $this->sCookieManagerType === ManagerTypes::COOKIEBOT )
or $this->sCookieManagerType === ManagerTypes::EXTERNAL_SERVICE
) )
{ {
// Always needs the script-tags delivered to the DOM. // Always needs the script-tags delivered to the DOM.
@ -141,16 +139,16 @@ class ViewConfig extends ViewConfig_parent
return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""'; return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""';
} }
if ($this->sCookieManagerType === ManagerTypes::CONSENTMANAGER) if ($this->sCookieManagerType === ManagerTypes::INTERNAL_CONSENTMANAGER)
{ {
return 'type="text/plain" class="cmplazyload" data-cmp-vendor="'.$sControlParameter.'"'; return 'type="text/plain" class="cmplazyload" data-cmp-vendor="'.$sControlParameter.'"';
} }
if ($this->sCookieManagerType === ManagerTypes::COOKIEFIRST){ if ($this->sCookieManagerType === ManagerTypes::INTERNAL_COOKIEFIRST){
return 'type="text/plain" data-cookiefirst-category="' . $sControlParameter .'"'; return 'type="text/plain" data-cookiefirst-category="' . $sControlParameter .'"';
} }
if ($this->sCookieManagerType === ManagerTypes::COOKIEBOT){ if ($this->sCookieManagerType === ManagerTypes::INTERNAL_COOKIEBOT){
return 'type="text/plain" data-cookieconsent="' . $sControlParameter .'"'; return 'type="text/plain" data-cookieconsent="' . $sControlParameter .'"';
} }
@ -210,9 +208,33 @@ class ViewConfig extends ViewConfig_parent
//'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown" //'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown"
]; ];
$dataLayer = $this->d3AdditionalGlobalAnalyticsVariables($dataLayer);
return json_encode([$dataLayer], JSON_PRETTY_PRINT); return json_encode([$dataLayer], JSON_PRETTY_PRINT);
} }
/**
* @param array $dataLayerGlobals
* @return array
*/
public function d3AdditionalGlobalAnalyticsVariables(array $dataLayerGlobals) :array
{
/** @var User $oUser */
$oUser = Registry::getSession()->getUser();
if ($oUser and $oUser->getFieldData('OXUSERNAME')){
$sUsername = $oUser->getFieldData('OXUSERNAME') ?: "";
$iCustNr = $oUser->getFieldData('OXCUSTNR') ?: "";
$iZipCode = $oUser->getFieldData('OXZIP') ?: "";
return array_merge($dataLayerGlobals, [
'custnr' => $iCustNr,
'email' => $sUsername,
'zipcode' => $iZipCode
]);
}
return $dataLayerGlobals;
}
public function isDebugModeOn() :bool public function isDebugModeOn() :bool
{ {
return $this->d3GetModuleConfigParam("_blEnableDebug")?: false; return $this->d3GetModuleConfigParam("_blEnableDebug")?: false;

View File

@ -45,12 +45,18 @@
"require": { "require": {
"php": "7.1 - 8.2", "php": "7.1 - 8.2",
"oxid-esales/oxideshop-ce": "^6.5.3", "oxid-esales/oxideshop-ce": "^6.5.3",
"google/apiclient":" ^2.0", "google/apiclient":" ^2.0"
},
"require-dev": {
"phpstan/phpstan": "^1.10" "phpstan/phpstan": "^1.10"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"D3\\GoogleAnalytics4\\": "../../../source/modules/d3/googleanalytics4" "D3\\GoogleAnalytics4\\": "../../../source/modules/d3/googleanalytics4"
} }
},
"scripts": {
"php-cs-fixer_audit": "./vendor/bin/php-cs-fixer list-files --config=./vendor/d3/googleanalytics4/.php-cs-fixer.php",
"php-cs-fixer_fix": "./vendor/bin/php-cs-fixer fix --config=./vendor/d3/googleanalytics4/.php-cs-fixer.php"
} }
} }

View File

@ -52,7 +52,7 @@ $aModule = [
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a> 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', 'thumbnail' => 'thumbnail.png',
'version' => '2.21.0', 'version' => '2.24.0.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)', 'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com', 'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/', 'url' => 'https://www.oxidmodule.com/',
@ -90,7 +90,7 @@ $aModule = [
// Event files that store the GA4 Event-Information // Event files that store the GA4 Event-Information
'event/add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/event/add_to_cart.tpl', 'event/add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/event/add_to_cart.tpl',
'event/view_item.tpl' => 'd3/googleanalytics4/Application/views/event/view_item.tpl', 'event/view_item.tpl' => 'd3/googleanalytics4/Application/views/event/view_item.tpl',
'event/view_item.tpl' => 'd3/googleanalytics4/Application/views/event/view_item.tpl', 'event/view_cart.tpl' => 'd3/googleanalytics4/Application/views/event/view_cart.tpl',
'event/begin_checkout.tpl' => 'd3/googleanalytics4/Application/views/event/begin_checkout.tpl', 'event/begin_checkout.tpl' => 'd3/googleanalytics4/Application/views/event/begin_checkout.tpl',
'event/add_payment_info.tpl' => 'd3/googleanalytics4/Application/views/event/add_payment_info.tpl', 'event/add_payment_info.tpl' => 'd3/googleanalytics4/Application/views/event/add_payment_info.tpl',
'event/purchase.tpl' => 'd3/googleanalytics4/Application/views/event/purchase.tpl', 'event/purchase.tpl' => 'd3/googleanalytics4/Application/views/event/purchase.tpl',