Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
9b8a5b9365 | |||
2ea16f2b62 | |||
b2a302fbb3 | |||
e347739bd3 | |||
3250f2bf91 | |||
14adccc4d5 | |||
9d4f51e574 | |||
31f7578aa4 | |||
05fbafea6e | |||
c0951277b8 | |||
28f04c8281 | |||
f7bef420aa | |||
c0c78ce63d |
@ -21,7 +21,7 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle
|
||||
$this->addTplParam('d3ViewObject', $this);
|
||||
$this->addTplParam('d3ViewConfObject', Registry::get(ViewConfig::class));
|
||||
$this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList());
|
||||
$this->addTplParam('d3CurrentCMP', oxNew(ManagerHandler::class)->getCurrManager());
|
||||
$this->addTplParam('d3CurrentCMP', oxNew(ManagerHandler::class)->getActManager());
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
@ -7,35 +7,6 @@ use OxidEsales\Eshop\Core\ViewConfig;
|
||||
|
||||
class ManagerHandler
|
||||
{
|
||||
/**
|
||||
* Gets current chosen Manager
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getCurrManager() :string
|
||||
{
|
||||
/** @var ManagerTypes $oManagerTypes */
|
||||
$oManagerTypes = oxNew(ManagerTypes::class);
|
||||
|
||||
/** @var ViewConfig $oViewConfig */
|
||||
$oViewConfig = oxNew(ViewConfig::class);
|
||||
|
||||
$aManagerList = $oManagerTypes->getManagerList();
|
||||
|
||||
if ($this->getModuleSettingExplicitManagerSelectValue()){
|
||||
return $this->getExplicitManager();
|
||||
}
|
||||
|
||||
foreach ($aManagerList as $shopModuleId => $publicCMPName){
|
||||
if ($oViewConfig->isModuleActive($shopModuleId)){
|
||||
$this->d3SaveShopConfVar($shopModuleId);
|
||||
return $shopModuleId;
|
||||
}
|
||||
}
|
||||
|
||||
return "";
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sParam
|
||||
* @return void
|
||||
@ -53,26 +24,8 @@ class ManagerHandler
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getModuleSettingExplicitManagerSelectValue() :string
|
||||
public function getActManager() :string
|
||||
{
|
||||
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER')?:"";
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function getExplicitManager() :string
|
||||
{
|
||||
$sPotentialManagerName = $this->getModuleSettingExplicitManagerSelectValue();
|
||||
|
||||
/** @var ManagerTypes $oManagerTypes */
|
||||
$oManagerTypes = oxNew(ManagerTypes::class);
|
||||
$sCMPName = $oManagerTypes->isManagerInList($sPotentialManagerName)
|
||||
? $sPotentialManagerName
|
||||
: "NONE";
|
||||
|
||||
$this->d3SaveShopConfVar($sCMPName);
|
||||
|
||||
return $sCMPName;
|
||||
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER')?:"";
|
||||
}
|
||||
}
|
@ -7,6 +7,7 @@ $aLang = array(
|
||||
'charset' => 'UTF-8',
|
||||
|
||||
'd3mxgoogleanalytics4' => 'Google Analytics 4',
|
||||
'd3mxd3modules' => 'Google Analytics 4',
|
||||
'd3mxgoogleanalytics4set' => 'Einstellungen',
|
||||
|
||||
// Base Translations
|
||||
|
@ -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}]
|
||||
|
@ -6,7 +6,6 @@
|
||||
[{capture name="d3_ga4_view_item"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
|
||||
dataLayer.push({
|
||||
'event': 'view_item',
|
||||
'eventLabel':'Product View',
|
||||
@ -28,7 +27,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)}]',
|
||||
|
@ -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}]
|
||||
|
@ -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)}]',
|
||||
|
19
CHANGELOG.md
19
CHANGELOG.md
@ -4,7 +4,24 @@ 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.23.0.2...rel_2.x) - 2025-x
|
||||
|
||||
## [2.23.0.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.23.0.1...2.23.0.2) - 2025-03-19
|
||||
### Fixed
|
||||
- reset of cmp-selection
|
||||
- over-engineered getter-methods
|
||||
|
||||
## [2.23.0.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.23.0.0...2.23.0.1) - 2025-02-19
|
||||
### Fixed
|
||||
- false metadata view_cart entry
|
||||
- missing menu-translation
|
||||
### 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
|
||||
|
@ -54,7 +54,7 @@ class ViewConfig extends ViewConfig_parent
|
||||
{
|
||||
/** @var ManagerHandler $oManagerHandler */
|
||||
$oManagerHandler = oxNew(ManagerHandler::class);
|
||||
$this->sCookieManagerType = $oManagerHandler->getCurrManager();
|
||||
$this->sCookieManagerType = $oManagerHandler->getActManager();
|
||||
}
|
||||
}
|
||||
|
||||
@ -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;
|
||||
|
@ -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.22.0',
|
||||
'version' => '2.23.0.2',
|
||||
'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