Compare commits

..

No commits in common. "2.5.0" and "2.4.0" have entirely different histories.
2.5.0 ... 2.4.0

10 changed files with 86 additions and 138 deletions

View File

@ -31,8 +31,5 @@ $aLang = [
// for cookie manager settings
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?',
'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',
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
];

View File

@ -2,10 +2,10 @@
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
[{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': 'view_cart',
@ -13,15 +13,15 @@
'ecommerce': {
'actionField': "step: 1",
'currency': "[{$currency->name}]",
'value': [{$d3BasketPrice->getPrice()}],
'value': iPrice.replace("€", ""),
'items': [
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
[{assign var='_price' value=$basketitem->getUnitPrice()}]
{
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
'price': [{$d3oItemPrice->getPrice()}],
'item_id': '[{$gtmCartArticles[$basketindex]->oxarticles__oxartnum->value}]',
'item_name': '[{$gtmCartArticles[$basketindex]->oxarticles__oxtitle->value}]',
'item_variant': '[{$gtmCartArticles[$basketindex]->oxarticles__oxvarselect->value}]',
'price': [{$_price->getPrice()}],
'quantity':[{$basketitem->getAmount()}],
'position':[{$smarty.foreach.gtmCartContents.index}]
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]

View File

@ -10,22 +10,21 @@
'event': 'purchase',
'eventLabel':'Checkout Step 5',
'ecommerce': {
'transaction_id': '[{$_gtmOrder->getFieldData("oxordernr")}]',
'affiliation': '[{$oxcmp_shop->getFieldData("oxname")}]',
'value': [{$_gtmOrder->getTotalOrderSum()}],
'tax': [{math equation="x+y" x=$_gtmOrder->getFieldData("oxartvatprice1") y=$_gtmOrder->getFieldData("oxartvatprice2") }],
'shipping': [{$_gtmOrder->getFieldData("oxdelcost")}],
'transaction_id': '[{$_gtmOrder->oxorder__oxordernr->value}]',
'affiliation': '[{$oxcmp_shop->oxshops__oxname->value}]',
'value': '[{$_gtmOrder->oxorder__oxtotalordersum->value}]',
'tax': '[{math equation="x+y" x=$_gtmOrder->oxorder__oxartvatprice1->value y=$_gtmOrder->oxorder__oxartvatprice2->value }]',
'shipping': '[{$_gtmOrder->oxorder__oxdelcost->value}]',
'currency': '[{$_gtmOrder->getFieldData('oxcurrency')}]',
'items':
[
[{foreach from=$_gtmArticles item="d3BasketArticle" name="gtmArticles"}]
[{assign var="d3oArticlePrice" value=$d3BasketArticle->getPrice()}]
[{foreach from=$_gtmArticles item="_gtmArticle" name="gtmArticles"}]
{
'id': '[{$d3BasketArticle->getFieldData("oxartnum")}]',
'name': '[{$d3BasketArticle->getFieldData("oxtitle")}]',
'variant': '[{$d3BasketArticle->getFieldData("oxselvariant")}]',
'price': [{$d3oArticlePrice->getPrice()}],
'quantity': [{$d3BasketArticle->getFieldData("oxamount")}],
'id': '[{$_gtmArticle->oxorderarticles__oxartnum->value}]',
'name': '[{$_gtmArticle->oxorderarticles__oxtitle->value}]',
'variant': '[{$_gtmArticle->oxorderarticles__oxselvariant->value}]',
'price': [{$_gtmArticle->oxorderarticles__oxprice->value}],
'quantity': [{$_gtmArticle->oxorderarticles__oxamount->value}],
'position': [{$smarty.foreach.gtmArticles.iteration}]
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
[{/foreach}]

View File

@ -12,13 +12,12 @@
'currency': '[{$currency->name}]',
'items': [
{
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
'item_id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
'price': [{$d3PriceObject->getPrice()}]
'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
'price': [{$gtmProduct->oxarticles__oxprice->value}]
}
]
}

View File

@ -1,7 +1,6 @@
[{$smarty.block.parent}]
[{assign var="d3ProductObject" value=$oView->getProduct()}]
[{assign var="d3PriceObject" value=$d3ProductObject->getPrice()}]
[{*$gtmProduct|get_class_methods|dumpvar*}]
[{capture assign=d3_ga4_add_to_cart}]
[{block name="d3_ga4_add_to_basket"}]
@ -18,18 +17,23 @@
'eventLabel': 'add_to_cart',
'ecommerce': {
'currency': "[{$currency->name}]",
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
'value': iArtQuantity*[{$gtmProduct->getFieldData('oxprice')}],
'items': [
{
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
'price': [{$d3PriceObject->getPrice()}],
'price': '[{$gtmProduct->getFieldData('oxprice')}]',
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]',
'item_category': itemCategories[0] || 'no category',
'item_category_2':itemCategories[1] || '',
'item_category_3':itemCategories[2] || '',
'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
}
]

View File

@ -13,13 +13,12 @@
'search_term': '[{$searchparamforhtml}]',
'items': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$d3PriceObject->getPrice()}],
'price': [{$gtmProduct->oxarticles__oxprice->value|default:'0'}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'quantity': 1

View File

@ -1,36 +1,34 @@
[{$smarty.block.parent}]
[{assign var="gtmProducts" value=$products}]
[{assign var="breadCrumb" value=''}]
[{if $gtmProducts|@count}]
[{strip}]
<script>
/* ga4 */
dataLayer.push({ecommerce: null});
dataLayer.push({
'event':'view_item_list',
'event_name': 'view_item_list',
'ecommerce': {
'item_list_id': '[{$oView->getCategoryId()}]',
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
'items': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$d3PriceObject->getPrice()}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'quantity': 1
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
[{/foreach}]
]
}
});
</script>
[{/strip}]
[{assign var="gtmProducts" value=$products}]
[{assign var="breadCrumb" value=''}]
[{if $gtmProducts|@count}]
[{strip}]
<script>
/* ga4 */
dataLayer.push({ecommerce: null});
dataLayer.push({
'event':'view_item_list',
'event_name': 'view_item_list',
'ecommerce': {
'item_list_id': '[{$oView->getCategoryId()}]',
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
'items': [
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{if !$gtmCategory}][{assign var="gtmCategory" value=$gtmProduct->getCategory()}][{/if}]
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'price': [{$gtmProduct->oxarticles__oxprice->value|default:'0'}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'quantity': 1
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
[{/foreach}]
]
}
});
</script>
[{/strip}]
[{/if}]

View File

@ -4,15 +4,6 @@ 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).
## [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
### Added
- "OXID Cookie Management powered by usercentrics" compatibility
@ -54,14 +45,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- 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
### Added
- Aggrosoft-Cookie-Consent compatibility
@ -70,7 +53,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
### Fixed
- price formatting in view_cart
- price formatting view_cart
## [1.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...1.2) - 2023-02-01
### Added
@ -84,6 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- 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
- publication of app features

View File

@ -13,7 +13,6 @@
namespace D3\GoogleAnalytics4\Modules\Core;
use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
@ -37,11 +36,6 @@ class ViewConfig extends ViewConfig_parent
return $this->sContainerId;
}
public function getModuleConsentmanagerSettingSelectValue() :bool
{
return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_CONSENTMANAGER') === 'YES';
}
public function getCookieManagerType()
{
if ($this->sCookieManagerType === null)
@ -61,11 +55,6 @@ class ViewConfig extends ViewConfig_parent
}
}
}
if ($this->sCookieManagerType === false and $this->getModuleConsentmanagerSettingSelectValue()){
return "consentmanager";
}
return $this->sCookieManagerType;
}
@ -74,8 +63,7 @@ class ViewConfig extends ViewConfig_parent
*/
public function D3blShowGtmScript()
{
/** @var Config $oConfig */
$oConfig = Registry::getConfig();
$oConfig = $this->getConfig();
// No Cookie Manager in use
if (!$oConfig->getConfigParam('d3_gtm_settings_hasOwnCookieManager')) {
@ -100,7 +88,7 @@ class ViewConfig extends ViewConfig_parent
}
// UserCentrics
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getCookieManagerType() === 'consentmanager') {
if ($this->getCookieManagerType() == "oxps_usercentrics") {
// Always needs the script-tags delivered to the DOM.
return true;
}
@ -116,9 +104,8 @@ class ViewConfig extends ViewConfig_parent
*/
public function getGtmScriptAttributes()
{
$oConfig = Registry::getConfig();
if ($this->getCookieManagerType() == "oxps_usercentrics") {
$oConfig = $this->getConfig();
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
if ($sCookieId) {
@ -126,19 +113,6 @@ 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 "";
}

View File

@ -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>
",
'thumbnail' => 'thumbnail.png',
'version' => '2.5.0',
'version' => '2.4.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',
@ -43,6 +43,18 @@ $aModule = [
'block' => 'theme_svg_icons',
'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
[
'template' => 'page/details/inc/productmain.tpl',
@ -50,22 +62,11 @@ $aModule = [
'file' => '/Application/views/blocks/view_item.tpl',
'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
// view_item_list
[
'template' => 'widget/product/list.tpl',
'block' => 'widget_product_list',
'block' => 'd3Ga4_view_item_list',
'file' => '/Application/views/ga4/view_item_list.tpl',
'position' => 150
],
@ -120,12 +121,5 @@ $aModule = [
'value' => 'example',
'position' => 999
],
[
'group' => 'd3_gtm_settings_cookiemanager',
'name' => 'd3_gtm_settings_HAS_CONSENTMANAGER',
'type' => 'select',
'value' => 'none',
'constraints' => 'NO|YES',
],
]
];