Compare commits

...

3 Commits

14 changed files with 45 additions and 14 deletions

View File

@ -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}]

View File

@ -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}]

View File

@ -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}]

View File

@ -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}]

View File

@ -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}]

View File

@ -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}]

View File

@ -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()}],

View File

@ -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)}]',

View File

@ -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)}]',

View File

@ -30,7 +30,7 @@
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
'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}]

View File

@ -20,7 +20,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)}]',

View File

@ -4,7 +4,14 @@ 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.22.0...rel_2.x) - 2024-x
### Added
- data layer doesn't contain prices if current user hasn't "show price" rights
## [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

View File

@ -207,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;

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>
",
'thumbnail' => 'thumbnail.png',
'version' => '2.22.0',
'version' => '2.23.0.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',