diff --git a/Application/Component/Widget/d3GtmStartWidget.php b/Application/Component/Widget/d3GtmStartWidget.php
new file mode 100644
index 0000000..92a7a79
--- /dev/null
+++ b/Application/Component/Widget/d3GtmStartWidget.php
@@ -0,0 +1,15 @@
+getPrice()}]
+[{assign var="gtmBasketObject" value=$oxcmp_basket}]
+[{assign var='gtmCartArticles' value=$gtmBasketObject->getBasketArticles()}]
+[{assign var="gtmPaymentObject" value=$oView->getPayment()}]
+
+[{block name="gtm_ga4_add_payment_info_block"}]
+ [{capture name="gtm_ga4_add_payment_info"}]
+ [{strip}]
+ dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
+ dataLayer.push({
+ 'event': 'add_payment_info',
+ 'eventLabel':'Checkout - Payment info',
+ 'payment_type':'[{$gtmPaymentObject->gtmGetSelectedPaymentName()}]',
+ 'ecommerce':
+ {
+ 'actionField': "Payment-Info",
+ 'currency': "[{$currency->name}]",
+ 'value': [{$gtmBasketPrice->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=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
+ [{assign var="gtmItemPriceObject" value=$basketitem->getPrice()}]
+ [{assign var="gtmBasketItem" value=$basketitem->getArticle()}]
+ [{assign var="gtmBasketItemCategory" value=$gtmBasketItem->getCategory()}]
+ {
+ 'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
+ 'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
+ 'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
+ [{if $gtmBasketItemCategory}]
+ 'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0, true)}]',
+ 'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1, true)}]',
+ 'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2, true)}]',
+ 'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
+ 'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
+ [{/if}]
+ 'price': [{$gtmItemPriceObject->getPrice()}],
+ '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}]
+ }[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
+ [{/foreach}]
+ ]
+ }[{if $oViewConf->isDebugModeOn()}],
+ 'debug_mode': 'true'
+ [{/if}]
+ });
+ [{/strip}]
+ [{/capture}]
+ [{oxscript add=$smarty.capture.gtm_ga4_add_payment_info}]
+ [{/block}]
\ No newline at end of file
diff --git a/Application/views/event/begin_checkout.tpl b/Application/views/event/begin_checkout.tpl
new file mode 100644
index 0000000..951d0e2
--- /dev/null
+++ b/Application/views/event/begin_checkout.tpl
@@ -0,0 +1,52 @@
+[{*$oxcmp_basket|get_class_methods|dumpvar*}]
+
+[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
+[{assign var="d3BasketObject" value=$oxcmp_basket}]
+[{assign var='gtmCartArticles' value=$d3BasketObject->getBasketArticles()}]
+[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
+
+[{block name="d3_ga4_begin_checkout_block"}]
+ [{capture name="d3_ga4_begin_checkout"}]
+ [{strip}]
+ dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
+ dataLayer.push({
+ 'event': 'begin_checkout',
+ 'eventLabel':'Begin of checkout',
+ 'ecommerce':
+ {
+ 'actionField': "Begin",
+ 'currency': "[{$gtmCurrency->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=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
+ [{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
+ [{assign var="gtmBasketItem" value=$basketitem->getArticle()}]
+ [{assign var="gtmBasketItemCategory" value=$gtmBasketItem->getCategory()}]
+ {
+ 'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
+ 'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
+ 'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
+ [{if $gtmBasketItemCategory}]
+ 'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0, true)}]',
+ 'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1, true)}]',
+ 'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2, true)}]',
+ 'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
+ 'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
+ [{/if}]
+ 'price': [{$d3oItemPrice->getPrice()}],
+ '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}]
+ }[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
+ [{/foreach}]
+ ]
+ }[{if $oViewConf->isDebugModeOn()}],
+ 'debug_mode': 'true'
+ [{/if}]
+ });
+ [{/strip}]
+ [{/capture}]
+ [{oxscript add=$smarty.capture.d3_ga4_begin_checkout}]
+[{/block}]
\ No newline at end of file
diff --git a/CHANGELOG.md b/CHANGELOG.md
index aa7cf0b..98bcbe8 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -6,6 +6,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## [unreleased](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.2...rel_2.x) - 2024-x
+## [2.21.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.20.1...2.21.0) - 2024-09-19
+### Fixed
+- missing parameters for widget.php call
+
+## [2.20.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.20.0...2.20.1) - 2024-09-11
+### Fixed
+- missing currency name in begin_checkout template
+## [2.20.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.19.0...2.20.0) - 2024-08-20
+### Added
+- new event "begin_checkout"
+- new event "add_payment_info"
+
## [2.19.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.18.2...2.19.0) - 2024-08-10
### Fixed
- usage of not yet existing function
diff --git a/IntelliSenseHelper.php b/IntelliSenseHelper.php
index 4666e9e..5b71e72 100644
--- a/IntelliSenseHelper.php
+++ b/IntelliSenseHelper.php
@@ -18,9 +18,14 @@ namespace D3\GoogleAnalytics4\Modules\Core{
}
namespace D3\GoogleAnalytics4\Modules\Application\Model{
+
+ use OxidEsales\Eshop\Application\Model\Payment;
+
class Category_parent extends \OxidEsales\Eshop\Application\Model\Category {}
class Basket_parent extends \OxidEsales\Eshop\Application\Model\Basket {}
class Manufacturer_parent extends \OxidEsales\Eshop\Application\Model\Manufacturer {}
+
+ class gtmPayment_parent extends Payment {}
}
namespace D3\GoogleAnalytics4\Modules\Application\Controller{
diff --git a/Modules/Application/Model/gtmPayment.php b/Modules/Application/Model/gtmPayment.php
new file mode 100644
index 0000000..b2baa61
--- /dev/null
+++ b/Modules/Application/Model/gtmPayment.php
@@ -0,0 +1,20 @@
+getFieldData('oxpayments__oxdesc')?: 'No payment name available';
+ }
+}
\ No newline at end of file
diff --git a/Modules/Core/WidgetControl.php b/Modules/Core/WidgetControl.php
new file mode 100644
index 0000000..a326a2b
--- /dev/null
+++ b/Modules/Core/WidgetControl.php
@@ -0,0 +1,43 @@
+ '2pistlaubiq58qtg3moudei0la',
+ 'lang' => '0',
+ 'actcontrol' => 'details',
+ 'anid' => '064471',
+ 'cl' => 'oxwarticledetails',
+ 'cnid' => '159dd0f2fb2bd6e24ace53a0f1913797',
+ 'listtype' => 'list',
+ 'nocookie' => '1',
+ 'oxwparent' => 'details',
+ 'sid' => '2pistlaubiq58qtg3moudei0la',
+ 'stoken' => 'A22D0F9E',
+ 'varselid' =>
+ array (
+ 0 => 'b842982bf522aa839bd88221f562fce8',
+ ),
+ )
+ */
+ $sScriptName = $_SERVER['SCRIPT_NAME'];
+ if($sScriptName !== '/widget.php')
+ {
+ return parent::getFrontendStartControllerKey();
+ }
+
+ $aParameter = $_GET;
+ if(is_null($aParameter['actcontrol']) and is_null($aParameter['oxwparent']))
+ {
+ return 'D3\GoogleAnalytics4\Application\Component\Widget\d3GtmStartWidget';
+ }
+
+ return parent::getFrontendStartControllerKey();
+ }
+}
\ No newline at end of file
diff --git a/metadata.php b/metadata.php
index 0f88d92..402be97 100755
--- a/metadata.php
+++ b/metadata.php
@@ -16,6 +16,7 @@ use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmStartController;
use D3\GoogleAnalytics4\Modules\Application\Controller\ThankYouController;
use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket;
use D3\GoogleAnalytics4\Modules\Application\Model\Category as Category;
+use D3\GoogleAnalytics4\Modules\Application\Model\gtmPayment as gtmPayment;
use D3\GoogleAnalytics4\Modules\Application\Model\Manufacturer as Manufacturer;
use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
use OxidEsales\Eshop\Application\Component\BasketComponent as OEBasketComponent;
@@ -33,12 +34,13 @@ use OxidEsales\Eshop\Application\Controller\ThankYouController as OEThankYouCont
use OxidEsales\Eshop\Application\Model\Basket as OEBasket;
use OxidEsales\Eshop\Application\Model\Category as OECategory;
use OxidEsales\Eshop\Application\Model\Manufacturer as OEManufacturer;
+use OxidEsales\Eshop\Application\Model\Payment as OEPayment;
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
$sMetadataVersion = '2.1';
-$aModule = [
- 'id' => Constants::OXID_MODULE_ID,
- 'title' => 'Google Analytics 4',
+$aModule = [
+ '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.
Hierfür stehen Ihnen verschiedene 'templates' zur verfügung,
@@ -49,135 +51,156 @@ $aModule = [