Compare commits
15 Commits
Author | SHA1 | Date |
---|---|---|
MaxBUhe | 000c49c56b | |
MaxBUhe | 002cc69d2a | |
MaxBUhe | af78809ae5 | |
MaxBUhe | d531ba648b | |
MaxBUhe | a0c650fca3 | |
MaxBUhe | af341a984b | |
MaxBUhe | 122dd4cf53 | |
MaxBUhe | 6d155d310b | |
Christoph Staeblein | 6e62f39b71 | |
MaxBUhe | 616f31ecba | |
MaxBuhe01 | 718b60e12c | |
MaxBUhe | 9cb3a54824 | |
MaxBuhe01 | 1c0d55bdc3 | |
MaxBuhe01 | 7c1f99e678 | |
MaxBUhe | 126e746651 |
|
@ -31,5 +31,8 @@ $aLang = [
|
||||||
// for cookie manager settings
|
// for cookie manager settings
|
||||||
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
|
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
|
||||||
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?',
|
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?',
|
||||||
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
|
'SHOP_MODULE_d3_gtm_settings_HAS_CONSENTMANAGER' => 'Nutzen Sie die Consentmanager-Einbindung?',
|
||||||
|
'SHOP_MODULE_d3_gtm_settings_HAS_CONSENTMANAGER_NO' => 'Nein',
|
||||||
|
'SHOP_MODULE_d3_gtm_settings_HAS_CONSENTMANAGER_YES' => 'Ja',
|
||||||
|
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
|
||||||
];
|
];
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
|
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
|
||||||
|
|
||||||
|
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||||
|
|
||||||
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
||||||
[{strip}][{capture assign=d3_ga4_view_cart}]
|
[{strip}][{capture assign=d3_ga4_view_cart}]
|
||||||
let iPrice = "[{oxprice price=$oxcmp_basket->getPrice()}]";
|
|
||||||
|
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
dataLayer.push({
|
dataLayer.push({
|
||||||
'event': 'view_cart',
|
'event': 'view_cart',
|
||||||
|
@ -13,15 +13,15 @@
|
||||||
'ecommerce': {
|
'ecommerce': {
|
||||||
'actionField': "step: 1",
|
'actionField': "step: 1",
|
||||||
'currency': "[{$currency->name}]",
|
'currency': "[{$currency->name}]",
|
||||||
'value': iPrice.replace("€", ""),
|
'value': [{$d3BasketPrice->getPrice()}],
|
||||||
'items': [
|
'items': [
|
||||||
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
||||||
[{assign var='_price' value=$basketitem->getUnitPrice()}]
|
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
|
||||||
{
|
{
|
||||||
'item_id': '[{$gtmCartArticles[$basketindex]->oxarticles__oxartnum->value}]',
|
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
|
||||||
'item_name': '[{$gtmCartArticles[$basketindex]->oxarticles__oxtitle->value}]',
|
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
|
||||||
'item_variant': '[{$gtmCartArticles[$basketindex]->oxarticles__oxvarselect->value}]',
|
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
|
||||||
'price': [{$_price->getPrice()}],
|
'price': [{$d3oItemPrice->getPrice()}],
|
||||||
'quantity':[{$basketitem->getAmount()}],
|
'quantity':[{$basketitem->getAmount()}],
|
||||||
'position':[{$smarty.foreach.gtmCartContents.index}]
|
'position':[{$smarty.foreach.gtmCartContents.index}]
|
||||||
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
||||||
|
|
|
@ -10,21 +10,22 @@
|
||||||
'event': 'purchase',
|
'event': 'purchase',
|
||||||
'eventLabel':'Checkout Step 5',
|
'eventLabel':'Checkout Step 5',
|
||||||
'ecommerce': {
|
'ecommerce': {
|
||||||
'transaction_id': '[{$_gtmOrder->oxorder__oxordernr->value}]',
|
'transaction_id': '[{$_gtmOrder->getFieldData("oxordernr")}]',
|
||||||
'affiliation': '[{$oxcmp_shop->oxshops__oxname->value}]',
|
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
|
||||||
'value': '[{$_gtmOrder->oxorder__oxtotalordersum->value}]',
|
'value': [{$_gtmOrder->getTotalOrderSum()}],
|
||||||
'tax': '[{math equation="x+y" x=$_gtmOrder->oxorder__oxartvatprice1->value y=$_gtmOrder->oxorder__oxartvatprice2->value }]',
|
'tax': [{math equation="x+y" x=$_gtmOrder->getFieldData("oxartvatprice1") y=$_gtmOrder->getFieldData("oxartvatprice2") }],
|
||||||
'shipping': '[{$_gtmOrder->oxorder__oxdelcost->value}]',
|
'shipping': [{$_gtmOrder->getFieldData("oxdelcost")}],
|
||||||
'currency': '[{$_gtmOrder->getFieldData('oxcurrency')}]',
|
'currency': '[{$_gtmOrder->getFieldData('oxcurrency')}]',
|
||||||
'items':
|
'items':
|
||||||
[
|
[
|
||||||
[{foreach from=$_gtmArticles item="_gtmArticle" name="gtmArticles"}]
|
[{foreach from=$_gtmArticles item="d3BasketArticle" name="gtmArticles"}]
|
||||||
|
[{assign var="d3oArticlePrice" value=$d3BasketArticle->getPrice()}]
|
||||||
{
|
{
|
||||||
'id': '[{$_gtmArticle->oxorderarticles__oxartnum->value}]',
|
'id': '[{$d3BasketArticle->getFieldData("oxartnum")}]',
|
||||||
'name': '[{$_gtmArticle->oxorderarticles__oxtitle->value}]',
|
'name': '[{$d3BasketArticle->getFieldData("oxtitle")}]',
|
||||||
'variant': '[{$_gtmArticle->oxorderarticles__oxselvariant->value}]',
|
'variant': '[{$d3BasketArticle->getFieldData("oxselvariant")}]',
|
||||||
'price': [{$_gtmArticle->oxorderarticles__oxprice->value}],
|
'price': [{$d3oArticlePrice->getPrice()}],
|
||||||
'quantity': [{$_gtmArticle->oxorderarticles__oxamount->value}],
|
'quantity': [{$d3BasketArticle->getFieldData("oxamount")}],
|
||||||
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
||||||
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
||||||
[{/foreach}]
|
[{/foreach}]
|
||||||
|
|
|
@ -12,12 +12,13 @@
|
||||||
'currency': '[{$currency->name}]',
|
'currency': '[{$currency->name}]',
|
||||||
'items': [
|
'items': [
|
||||||
{
|
{
|
||||||
'item_name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||||
'item_id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
|
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
||||||
'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
|
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
||||||
'price': [{$gtmProduct->oxarticles__oxprice->value}]
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
|
'price': [{$d3PriceObject->getPrice()}]
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
[{$smarty.block.parent}]
|
[{$smarty.block.parent}]
|
||||||
|
|
||||||
[{*$gtmProduct|get_class_methods|dumpvar*}]
|
[{assign var="d3ProductObject" value=$oView->getProduct()}]
|
||||||
|
[{assign var="d3PriceObject" value=$d3ProductObject->getPrice()}]
|
||||||
|
|
||||||
[{capture assign=d3_ga4_add_to_cart}]
|
[{capture assign=d3_ga4_add_to_cart}]
|
||||||
[{block name="d3_ga4_add_to_basket"}]
|
[{block name="d3_ga4_add_to_basket"}]
|
||||||
|
@ -17,23 +18,18 @@
|
||||||
'eventLabel': 'add_to_cart',
|
'eventLabel': 'add_to_cart',
|
||||||
'ecommerce': {
|
'ecommerce': {
|
||||||
'currency': "[{$currency->name}]",
|
'currency': "[{$currency->name}]",
|
||||||
'value': iArtQuantity*[{$gtmProduct->getFieldData('oxprice')}],
|
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
|
||||||
'items': [
|
'items': [
|
||||||
{
|
{
|
||||||
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
|
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
|
||||||
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
|
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
|
||||||
'price': '[{$gtmProduct->getFieldData('oxprice')}]',
|
'price': [{$d3PriceObject->getPrice()}],
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
'item_variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]',
|
'item_variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]',
|
||||||
'item_category': itemCategories[0] || 'no category',
|
'item_category': itemCategories[0] || 'no category',
|
||||||
'item_category_2':itemCategories[1] || '',
|
'item_category_2':itemCategories[1] || '',
|
||||||
'item_category_3':itemCategories[2] || '',
|
'item_category_3':itemCategories[2] || '',
|
||||||
'item_category_4':itemCategories[3] || '',
|
'item_category_4':itemCategories[3] || '',
|
||||||
[{if false}]
|
|
||||||
'item_list_name': 'Search Results', // If associated with a list selection.
|
|
||||||
'item_list_id': 'SR123', // If associated with a list selection.
|
|
||||||
'index': 1, // If associated with a list selection.
|
|
||||||
[{/if}]
|
|
||||||
'quantity': iArtQuantity
|
'quantity': iArtQuantity
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
@ -13,12 +13,13 @@
|
||||||
'search_term': '[{$searchparamforhtml}]',
|
'search_term': '[{$searchparamforhtml}]',
|
||||||
'items': [
|
'items': [
|
||||||
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||||
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||||
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
|
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
|
||||||
{
|
{
|
||||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||||
'price': [{$gtmProduct->oxarticles__oxprice->value|default:'0'}],
|
'price': [{$d3PriceObject->getPrice()}],
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
||||||
'quantity': 1
|
'quantity': 1
|
||||||
|
|
|
@ -1,34 +1,36 @@
|
||||||
[{assign var="gtmProducts" value=$products}]
|
[{$smarty.block.parent}]
|
||||||
|
[{assign var="gtmProducts" value=$products}]
|
||||||
[{assign var="breadCrumb" value=''}]
|
|
||||||
|
[{assign var="breadCrumb" value=''}]
|
||||||
[{if $gtmProducts|@count}]
|
|
||||||
[{strip}]
|
[{if $gtmProducts|@count}]
|
||||||
<script>
|
[{strip}]
|
||||||
/* ga4 */
|
<script>
|
||||||
dataLayer.push({ecommerce: null});
|
/* ga4 */
|
||||||
dataLayer.push({
|
dataLayer.push({ecommerce: null});
|
||||||
'event':'view_item_list',
|
dataLayer.push({
|
||||||
'event_name': 'view_item_list',
|
'event':'view_item_list',
|
||||||
'ecommerce': {
|
'event_name': 'view_item_list',
|
||||||
'item_list_id': '[{$oView->getCategoryId()}]',
|
'ecommerce': {
|
||||||
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
|
'item_list_id': '[{$oView->getCategoryId()}]',
|
||||||
'items': [
|
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
|
||||||
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
'items': [
|
||||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||||
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
{
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
|
||||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
{
|
||||||
'price': [{$gtmProduct->oxarticles__oxprice->value|default:'0'}],
|
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||||
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
'price': [{$d3PriceObject->getPrice()}],
|
||||||
'quantity': 1
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
||||||
[{/foreach}]
|
'quantity': 1
|
||||||
]
|
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||||
}
|
[{/foreach}]
|
||||||
});
|
]
|
||||||
</script>
|
}
|
||||||
[{/strip}]
|
});
|
||||||
|
</script>
|
||||||
|
[{/strip}]
|
||||||
[{/if}]
|
[{/if}]
|
22
CHANGELOG.md
22
CHANGELOG.md
|
@ -4,6 +4,15 @@ 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).
|
||||||
|
|
||||||
|
## [2.5.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.4.0...2.5.0) - 2023-05-23
|
||||||
|
### Added
|
||||||
|
- additional settings to explicitly indicate that consentmanager is used
|
||||||
|
### Fixed
|
||||||
|
- unnecessary converting of int to str
|
||||||
|
- missing PriceObject-bug
|
||||||
|
### Changed
|
||||||
|
- genuine code cleanup
|
||||||
|
|
||||||
## [2.4.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.3.3...2.4.0) - 2023-05-02
|
## [2.4.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.3.3...2.4.0) - 2023-05-02
|
||||||
### Added
|
### Added
|
||||||
- "OXID Cookie Management powered by usercentrics" compatibility
|
- "OXID Cookie Management powered by usercentrics" compatibility
|
||||||
|
@ -45,6 +54,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Added
|
### Added
|
||||||
- using of ContainerFactory in ViewConfig
|
- using of ContainerFactory in ViewConfig
|
||||||
|
|
||||||
|
## [1.4.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.3.1...1.4.0) - 2023-05-02
|
||||||
|
### Added
|
||||||
|
- "OXID Cookie Management powered by usercentrics" compatibility
|
||||||
|
- usercentrics defined script attributes
|
||||||
|
- cookie-manager evaluation
|
||||||
|
### Changed
|
||||||
|
- genuine clean up of base-js-files
|
||||||
|
|
||||||
## [1.3.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2.1...1.3.1) - 2023-03-17
|
## [1.3.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2.1...1.3.1) - 2023-03-17
|
||||||
### Added
|
### Added
|
||||||
- Aggrosoft-Cookie-Consent compatibility
|
- Aggrosoft-Cookie-Consent compatibility
|
||||||
|
@ -53,7 +70,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
|
|
||||||
## [1.2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2...1.2.1) - 2023-02-22
|
## [1.2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2...1.2.1) - 2023-02-22
|
||||||
### Fixed
|
### Fixed
|
||||||
- price formatting view_cart
|
- price formatting in view_cart
|
||||||
|
|
||||||
## [1.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...1.2) - 2023-02-01
|
## [1.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...1.2) - 2023-02-01
|
||||||
### Added
|
### Added
|
||||||
|
@ -67,7 +84,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||||
### Changed
|
### Changed
|
||||||
- switched price formatting
|
- switched price formatting
|
||||||
|
|
||||||
|
## [1.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.0...1.0) - 2023-01-20
|
||||||
## [1.0](https://git.d3data.de/D3Public/GoogleAnalytics4/releases/tag/1.0) - 2023-01-20
|
|
||||||
### Added
|
### Added
|
||||||
- publication of app features
|
- publication of app features
|
|
@ -13,6 +13,7 @@
|
||||||
namespace D3\GoogleAnalytics4\Modules\Core;
|
namespace D3\GoogleAnalytics4\Modules\Core;
|
||||||
|
|
||||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||||
|
use OxidEsales\Eshop\Core\Config;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
|
||||||
|
@ -36,6 +37,11 @@ class ViewConfig extends ViewConfig_parent
|
||||||
return $this->sContainerId;
|
return $this->sContainerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getModuleConsentmanagerSettingSelectValue() :bool
|
||||||
|
{
|
||||||
|
return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_CONSENTMANAGER') === 'YES';
|
||||||
|
}
|
||||||
|
|
||||||
public function getCookieManagerType()
|
public function getCookieManagerType()
|
||||||
{
|
{
|
||||||
if ($this->sCookieManagerType === null)
|
if ($this->sCookieManagerType === null)
|
||||||
|
@ -55,6 +61,11 @@ class ViewConfig extends ViewConfig_parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->sCookieManagerType === false and $this->getModuleConsentmanagerSettingSelectValue()){
|
||||||
|
return "consentmanager";
|
||||||
|
}
|
||||||
|
|
||||||
return $this->sCookieManagerType;
|
return $this->sCookieManagerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +74,8 @@ class ViewConfig extends ViewConfig_parent
|
||||||
*/
|
*/
|
||||||
public function D3blShowGtmScript()
|
public function D3blShowGtmScript()
|
||||||
{
|
{
|
||||||
$oConfig = $this->getConfig();
|
/** @var Config $oConfig */
|
||||||
|
$oConfig = Registry::getConfig();
|
||||||
|
|
||||||
// No Cookie Manager in use
|
// No Cookie Manager in use
|
||||||
if (!$oConfig->getConfigParam('d3_gtm_settings_hasOwnCookieManager')) {
|
if (!$oConfig->getConfigParam('d3_gtm_settings_hasOwnCookieManager')) {
|
||||||
|
@ -88,7 +100,7 @@ class ViewConfig extends ViewConfig_parent
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserCentrics
|
// UserCentrics
|
||||||
if ($this->getCookieManagerType() == "oxps_usercentrics") {
|
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getCookieManagerType() === 'consentmanager') {
|
||||||
// Always needs the script-tags delivered to the DOM.
|
// Always needs the script-tags delivered to the DOM.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -104,8 +116,9 @@ class ViewConfig extends ViewConfig_parent
|
||||||
*/
|
*/
|
||||||
public function getGtmScriptAttributes()
|
public function getGtmScriptAttributes()
|
||||||
{
|
{
|
||||||
|
$oConfig = Registry::getConfig();
|
||||||
|
|
||||||
if ($this->getCookieManagerType() == "oxps_usercentrics") {
|
if ($this->getCookieManagerType() == "oxps_usercentrics") {
|
||||||
$oConfig = $this->getConfig();
|
|
||||||
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||||
|
|
||||||
if ($sCookieId) {
|
if ($sCookieId) {
|
||||||
|
@ -113,6 +126,19 @@ class ViewConfig extends ViewConfig_parent
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->getCookieManagerType() == "consentmanager") {
|
||||||
|
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||||
|
|
||||||
|
if ($sCookieId) {
|
||||||
|
return 'async
|
||||||
|
type="text/plain"
|
||||||
|
data-cmp-src="https://www.googletagmanager.com/gtm.js?id='.$this->getGtmContainerId().'"
|
||||||
|
class="cmplazyload"
|
||||||
|
data-cmp-vendor="s905"
|
||||||
|
';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
34
metadata.php
34
metadata.php
|
@ -17,7 +17,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.4.0',
|
'version' => '2.5.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/',
|
||||||
|
@ -43,18 +43,6 @@ $aModule = [
|
||||||
'block' => 'theme_svg_icons',
|
'block' => 'theme_svg_icons',
|
||||||
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
|
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
|
||||||
],
|
],
|
||||||
// checkout
|
|
||||||
// view_cart
|
|
||||||
[
|
|
||||||
'template' => 'page/checkout/basket.tpl',
|
|
||||||
'block' => 'checkout_basket_main',
|
|
||||||
'file' => '/Application/views/blocks/checkout_s1.tpl'
|
|
||||||
],
|
|
||||||
[
|
|
||||||
'template' => 'page/checkout/thankyou.tpl',
|
|
||||||
'block' => 'checkout_thankyou_main',
|
|
||||||
'file' => '/Application/views/blocks/checkout_s5.tpl'
|
|
||||||
],
|
|
||||||
// details
|
// details
|
||||||
[
|
[
|
||||||
'template' => 'page/details/inc/productmain.tpl',
|
'template' => 'page/details/inc/productmain.tpl',
|
||||||
|
@ -62,11 +50,22 @@ $aModule = [
|
||||||
'file' => '/Application/views/blocks/view_item.tpl',
|
'file' => '/Application/views/blocks/view_item.tpl',
|
||||||
'position' => 150
|
'position' => 150
|
||||||
],
|
],
|
||||||
|
// checkout
|
||||||
|
[
|
||||||
|
'template' => 'page/checkout/basket.tpl',
|
||||||
|
'block' => 'checkout_basket_main',
|
||||||
|
'file' => '/Application/views/blocks/checkout_s1.tpl'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'template' => 'page/checkout/thankyou.tpl',
|
||||||
|
'block' => 'checkout_thankyou_main',
|
||||||
|
'file' => '/Application/views/blocks/checkout_s5.tpl'
|
||||||
|
],
|
||||||
// Lists
|
// Lists
|
||||||
// view_item_list
|
// view_item_list
|
||||||
[
|
[
|
||||||
'template' => 'widget/product/list.tpl',
|
'template' => 'widget/product/list.tpl',
|
||||||
'block' => 'd3Ga4_view_item_list',
|
'block' => 'widget_product_list',
|
||||||
'file' => '/Application/views/ga4/view_item_list.tpl',
|
'file' => '/Application/views/ga4/view_item_list.tpl',
|
||||||
'position' => 150
|
'position' => 150
|
||||||
],
|
],
|
||||||
|
@ -121,5 +120,12 @@ $aModule = [
|
||||||
'value' => 'example',
|
'value' => 'example',
|
||||||
'position' => 999
|
'position' => 999
|
||||||
],
|
],
|
||||||
|
[
|
||||||
|
'group' => 'd3_gtm_settings_cookiemanager',
|
||||||
|
'name' => 'd3_gtm_settings_HAS_CONSENTMANAGER',
|
||||||
|
'type' => 'select',
|
||||||
|
'value' => 'none',
|
||||||
|
'constraints' => 'NO|YES',
|
||||||
|
],
|
||||||
]
|
]
|
||||||
];
|
];
|
Loading…
Reference in New Issue