Compare commits
11 Commits
master
...
dev_2.x__f
Author | SHA1 | Date | |
---|---|---|---|
9d4f51e574 | |||
31f7578aa4 | |||
05fbafea6e | |||
c0951277b8 | |||
28f04c8281 | |||
f7bef420aa | |||
c0c78ce63d | |||
2ec373c95f | |||
6fcb9f8b84 | |||
53b3c878ce | |||
65b618e25c |
@ -7,19 +7,25 @@ use D3\GoogleAnalytics4\Application\Model\CMP\Usercentrics;
|
||||
class ManagerTypes
|
||||
{
|
||||
const EXTERNAL_SERVICE = "eigener Service";
|
||||
const INTERNAL_EXTERNAL_SERVICE = "externalService";
|
||||
const NET_COOKIE_MANAGER = "Netensio Cookie Manager";
|
||||
const INTERNAL_NET_COOKIE_MANAGER = "net_cookie_manager";
|
||||
|
||||
/**
|
||||
* Further information's:
|
||||
* https://github.com/aggrosoft/oxid-cookie-compliance
|
||||
*/
|
||||
const AGCOOKIECOMPLIANCE = "Aggrosoft Cookie Compliance";
|
||||
const INTERNAL_AGCOOKIECOMPLIANCE = "agcookiecompliance";
|
||||
|
||||
const CONSENTMANAGER = "Consentmanager";
|
||||
const INTERNAL_CONSENTMANAGER = "cmconsentmanager";
|
||||
|
||||
const COOKIEFIRST = "Cookiefirst";
|
||||
const INTERNAL_COOKIEFIRST = "cookiefirst";
|
||||
|
||||
const COOKIEBOT = "Cookiebot";
|
||||
const INTERNAL_COOKIEBOT = "cookiebot";
|
||||
|
||||
/**
|
||||
* @return array
|
||||
@ -27,14 +33,14 @@ class ManagerTypes
|
||||
public function getManagerList(): array
|
||||
{
|
||||
return [
|
||||
"externalService" => self::EXTERNAL_SERVICE,
|
||||
"agcookiecompliance" => self::AGCOOKIECOMPLIANCE,
|
||||
"net_cookie_manager" => self::NET_COOKIE_MANAGER,
|
||||
self::INTERNAL_EXTERNAL_SERVICE => self::EXTERNAL_SERVICE,
|
||||
self::INTERNAL_AGCOOKIECOMPLIANCE => self::AGCOOKIECOMPLIANCE,
|
||||
self::INTERNAL_NET_COOKIE_MANAGER => self::NET_COOKIE_MANAGER,
|
||||
Usercentrics::sModuleIncludationInternalName => Usercentrics::sModuleIncludationPublicName,
|
||||
Usercentrics::sExternalIncludationInternalName => Usercentrics::sExternalIncludationPublicName,
|
||||
"cmconsentmanager" => self::CONSENTMANAGER,
|
||||
"cookiefirst" => self::COOKIEFIRST,
|
||||
"cookiebot" => self::COOKIEBOT,
|
||||
self::INTERNAL_CONSENTMANAGER => self::CONSENTMANAGER,
|
||||
self::INTERNAL_COOKIEFIRST => self::COOKIEFIRST,
|
||||
self::INTERNAL_COOKIEBOT => self::COOKIEBOT,
|
||||
];
|
||||
}
|
||||
|
||||
@ -46,4 +52,21 @@ class ManagerTypes
|
||||
{
|
||||
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
|
||||
];
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ $aLang = array(
|
||||
'charset' => 'UTF-8',
|
||||
|
||||
'd3mxgoogleanalytics4' => 'Google Analytics 4',
|
||||
'd3mxd3modules' => 'Google Analytics 4',
|
||||
'd3mxgoogleanalytics4set' => 'Einstellungen',
|
||||
|
||||
// Base Translations
|
||||
|
@ -80,7 +80,6 @@
|
||||
[{oxmultilang ident="D3CMP"}]
|
||||
</label>
|
||||
<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]"}]
|
||||
<option value="[{$sInternalName}]" [{if $sInternalName === $d3CurrentCMP}]SELECTED[{/if}]>[{$sPublicName}]</option>
|
||||
[{/foreach}]
|
||||
|
@ -1,3 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/purchase.tpl"}]
|
||||
[{include file="event/purchase.tpl"}]
|
||||
|
@ -36,7 +36,7 @@
|
||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||
[{/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}]',
|
||||
'quantity': [{$basketitem->getAmount()}],
|
||||
'position': [{$smarty.foreach.gtmCartContents.index}]
|
||||
|
@ -37,7 +37,7 @@
|
||||
{
|
||||
'item_id': '[{$oGtmProduct->getFieldData('oxartnum')}]',
|
||||
'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_variant': '[{if $oGtmProduct->getFieldData('oxvarselect')}][{$oGtmProduct->getFieldData('oxvarselect')}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
|
@ -35,7 +35,7 @@
|
||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||
[{/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}]',
|
||||
'quantity': [{$basketitem->getAmount()}],
|
||||
'position': [{$smarty.foreach.gtmCartContents.index}]
|
||||
|
@ -40,7 +40,7 @@
|
||||
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
|
||||
[{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$gtmPurchaseItemPriceObject->getPrice()}],[{/oxhasrights}]
|
||||
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
|
||||
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
||||
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
||||
|
@ -28,7 +28,7 @@
|
||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||
[{/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}]',
|
||||
'quantity': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]',
|
||||
'position': [{$smarty.foreach.gtmRemovedItems.index}]
|
||||
|
@ -33,7 +33,7 @@
|
||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||
[{/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}]',
|
||||
'quantity': [{$basketitem->getAmount()}],
|
||||
'position': [{$smarty.foreach.gtmCartContents.index}]
|
||||
|
@ -28,7 +28,7 @@
|
||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||
'price': [{$d3PriceObject->getPrice()}]
|
||||
[{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3PriceObject->getPrice()}][{/oxhasrights}]
|
||||
}
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
|
@ -22,7 +22,7 @@
|
||||
{
|
||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
[{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3PriceObject->getPrice()}],[{/oxhasrights}]
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
|
@ -18,7 +18,7 @@
|
||||
{
|
||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
[{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3PriceObject->getPrice()}],[{/oxhasrights}]
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
|
48
Application/views/ga4/remove_from_cart.tpl
Normal file
48
Application/views/ga4/remove_from_cart.tpl
Normal file
@ -0,0 +1,48 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{block name="d3_ga4_remove_from_cart_block"}]
|
||||
[{if $hasBeenReloaded}]
|
||||
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||
[{capture assign=d3_ga4_remove_from_cart}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'isRemoveFromCart': true,
|
||||
'event': 'remove_from_cart',
|
||||
'eventLabel':'remove_from_cart',
|
||||
'ecommerce': {
|
||||
'actionField': "step: 1",
|
||||
'currency': "[{$currency->name}]",
|
||||
'value': [{$d3BasketPrice->getPrice()}],
|
||||
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
|
||||
'items': [
|
||||
[{foreach from=$toRemoveArticles->getArray() name=gtmRemovedItems item=rmItem key=rmItemindex}]
|
||||
[{assign var="d3oItemPrice" value=$rmItem->getPrice()}]
|
||||
[{assign var="gtmBasketItemCategory" value=$rmItem->getCategory()}]
|
||||
{
|
||||
'item_id': '[{$rmItem->getFieldData('oxartnum')}]',
|
||||
'item_name': '[{$rmItem->getFieldData('oxtitle')}]',
|
||||
'item_variant': '[{$rmItem->getFieldData('oxvarselect')}]',
|
||||
[{if $gtmBasketItemCategory}]
|
||||
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0)}]',
|
||||
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]',
|
||||
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]',
|
||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
|
||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
[{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}]',
|
||||
'quantity': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]',
|
||||
'position': [{$smarty.foreach.gtmRemovedItems.index}]
|
||||
}[{if !$smarty.foreach.gtmRemovedItems.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_remove_from_cart}]
|
||||
[{/if}]
|
||||
[{/block}]
|
44
Application/views/ga4/view_search_result.tpl
Normal file
44
Application/views/ga4/view_search_result.tpl
Normal file
@ -0,0 +1,44 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||
|
||||
[{block name="d3_ga4_view_search_result_block"}]
|
||||
[{if $gtmProducts}]
|
||||
[{capture assign=d3_ga4_view_search_result}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'event': 'view_search_result',
|
||||
'eventLabel':'view_search_result[{if $oViewConf->isDebugModeOn()}]_test[{/if}]',
|
||||
'ecommerce': {
|
||||
'search_term': '[{$searchparamforhtml}]',
|
||||
'items': [
|
||||
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||
{
|
||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||
[{oxhasrights ident="SHOWARTICLEPRICE"}]'price': [{$d3PriceObject->getPrice()}],[{/oxhasrights}]
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'quantity': 1
|
||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_view_search_result}]
|
||||
[{/if}]
|
||||
[{/block}]
|
20
CHANGELOG.md
20
CHANGELOG.md
@ -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/),
|
||||
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
|
||||
### Fixed
|
||||
|
@ -17,9 +17,8 @@ use D3\GoogleAnalytics4\Application\Model\Constants;
|
||||
use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
|
||||
use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
|
||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||
use OxidEsales\Eshop\Application\Model\User;
|
||||
use OxidEsales\Eshop\Core\Config;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Application\Model\User;use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
@ -58,6 +57,7 @@ class ViewConfig extends ViewConfig_parent
|
||||
$this->sCookieManagerType = $oManagerHandler->getCurrManager();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
@ -88,7 +88,7 @@ class ViewConfig extends ViewConfig_parent
|
||||
$sCookieID = trim($this->d3GetModuleConfigParam('_sControlParameter'));
|
||||
|
||||
// Netensio Cookie Manager
|
||||
if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) {
|
||||
if ($this->sCookieManagerType === ManagerTypes::INTERNAL_NET_COOKIE_MANAGER) {
|
||||
$oSession = Registry::getSession();
|
||||
$aCookies = $oSession->getVariable("aCookieSel");
|
||||
|
||||
@ -96,26 +96,25 @@ class ViewConfig extends ViewConfig_parent
|
||||
}
|
||||
|
||||
// Aggrosoft Cookie Consent
|
||||
if ($this->sCookieManagerType === ManagerTypes::AGCOOKIECOMPLIANCE) {
|
||||
if ($this->sCookieManagerType === ManagerTypes::INTERNAL_AGCOOKIECOMPLIANCE) {
|
||||
if (method_exists($this, "isCookieCategoryEnabled")) {
|
||||
return $this->isCookieCategoryEnabled($sCookieID);
|
||||
}
|
||||
}
|
||||
|
||||
// UserCentrics or consentmanager
|
||||
|
||||
if (
|
||||
$this->sCookieManagerType === Usercentrics::sModuleIncludationInternalName
|
||||
or $this->sCookieManagerType === Usercentrics::sExternalIncludationInternalName
|
||||
or $this->sCookieManagerType === ManagerTypes::CONSENTMANAGER
|
||||
or $this->sCookieManagerType === ManagerTypes::COOKIEFIRST
|
||||
or $this->sCookieManagerType === ManagerTypes::COOKIEBOT
|
||||
or $this->sCookieManagerType === ManagerTypes::EXTERNAL_SERVICE
|
||||
in_array
|
||||
(
|
||||
$this->sCookieManagerType,
|
||||
(oxNew(ManagerTypes::class)->scriptTagDeliveredByDefaultArray())
|
||||
)
|
||||
)
|
||||
{
|
||||
// Always needs the script-tags delivered to the DOM.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Cookie Manager not (yet) supported
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -140,16 +139,16 @@ class ViewConfig extends ViewConfig_parent
|
||||
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.'"';
|
||||
}
|
||||
|
||||
if ($this->sCookieManagerType === ManagerTypes::COOKIEFIRST){
|
||||
if ($this->sCookieManagerType === ManagerTypes::INTERNAL_COOKIEFIRST){
|
||||
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 .'"';
|
||||
}
|
||||
|
||||
@ -208,10 +207,34 @@ class ViewConfig extends ViewConfig_parent
|
||||
'sessionid' => session_id(),
|
||||
//'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown"
|
||||
];
|
||||
|
||||
$dataLayer = $this->d3AdditionalGlobalAnalyticsVariables($dataLayer);
|
||||
|
||||
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
|
||||
{
|
||||
return $this->d3GetModuleConfigParam("_blEnableDebug")?: false;
|
||||
|
@ -45,12 +45,18 @@
|
||||
"require": {
|
||||
"php": "7.1 - 8.2",
|
||||
"oxid-esales/oxideshop-ce": "^6.5.3",
|
||||
"google/apiclient":" ^2.0",
|
||||
"google/apiclient":" ^2.0"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpstan/phpstan": "^1.10"
|
||||
},
|
||||
"autoload": {
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"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"
|
||||
}
|
||||
}
|
@ -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>
|
||||
",
|
||||
'thumbnail' => 'thumbnail.png',
|
||||
'version' => '2.21.0',
|
||||
'version' => '2.24.0.0',
|
||||
'author' => 'Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
@ -90,7 +90,7 @@ $aModule = [
|
||||
// Event files that store the GA4 Event-Information
|
||||
'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_cart.tpl' => 'd3/googleanalytics4/Application/views/event/view_cart.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/purchase.tpl' => 'd3/googleanalytics4/Application/views/event/purchase.tpl',
|
||||
|
Loading…
x
Reference in New Issue
Block a user