Compare commits
No commits in common. "1.10.0" and "1.9.0" have entirely different histories.
@ -1,53 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace D3\GoogleAnalytics4\Application\Model;
|
|
||||||
|
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
|
||||||
use OxidEsales\Eshop\Core\ViewConfig;
|
|
||||||
|
|
||||||
class ManagerHandler
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getCurrManager() :string
|
|
||||||
{
|
|
||||||
/** @var ManagerTypes $oManagerTypes */
|
|
||||||
$oManagerTypes = oxNew(ManagerTypes::class);
|
|
||||||
|
|
||||||
/** @var ViewConfig $oViewConfig */
|
|
||||||
$oViewConfig = oxNew(ViewConfig::class);
|
|
||||||
|
|
||||||
$aManagerList = $oManagerTypes->getManagerList();
|
|
||||||
|
|
||||||
foreach ($aManagerList as $managerName){
|
|
||||||
if ($oViewConfig->isModuleActive($managerName)){
|
|
||||||
return $managerName;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->getExplicitManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getModuleSettingExplicitManagerSelectValue() :string
|
|
||||||
{
|
|
||||||
return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_STD_MANAGER');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getExplicitManager() :string
|
|
||||||
{
|
|
||||||
$sPotentialManagerName = $this->getModuleSettingExplicitManagerSelectValue();
|
|
||||||
|
|
||||||
/** @var ManagerTypes $oManagerTypes */
|
|
||||||
$oManagerTypes = oxNew(ManagerTypes::class);
|
|
||||||
return $oManagerTypes->isManagerInList($sPotentialManagerName)
|
|
||||||
? $sPotentialManagerName
|
|
||||||
: "NONE";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,63 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace D3\GoogleAnalytics4\Application\Model;
|
|
||||||
|
|
||||||
class ManagerTypes
|
|
||||||
{
|
|
||||||
#ToDo: make own classes for each of the manager
|
|
||||||
|
|
||||||
|
|
||||||
const EXTERNAL_SERVICE = "externalService";
|
|
||||||
const NET_COOKIE_MANAGER = "net_cookie_manager";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Further information's:
|
|
||||||
* https://github.com/aggrosoft/oxid-cookie-compliance
|
|
||||||
*/
|
|
||||||
const AGCOOKIECOMPLIANCE = "agcookiecompliance";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Used the OXID Module.
|
|
||||||
*
|
|
||||||
* Further information's:
|
|
||||||
* https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html
|
|
||||||
*
|
|
||||||
* Usercentrics homepage:
|
|
||||||
* https://usercentrics.com
|
|
||||||
*/
|
|
||||||
const USERCENTRICS_MODULE = "oxps_usercentrics";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* manually included usercentrics script
|
|
||||||
*/
|
|
||||||
const USERCENTRICS_MANUALLY = "USERCENTRICS";
|
|
||||||
|
|
||||||
const CONSENTMANAGER = "CONSENTMANAGER";
|
|
||||||
|
|
||||||
const COOKIEFIRST = "COOKIEFIRST";
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return array
|
|
||||||
*/
|
|
||||||
public function getManagerList(): array
|
|
||||||
{
|
|
||||||
return [
|
|
||||||
"externalService" => self::EXTERNAL_SERVICE,
|
|
||||||
"agcookiecompliance" => self::AGCOOKIECOMPLIANCE,
|
|
||||||
"net_cookie_manager" => self::NET_COOKIE_MANAGER,
|
|
||||||
"oxps_usercentrics" => self::USERCENTRICS_MODULE,
|
|
||||||
"usercentrics" => self::USERCENTRICS_MANUALLY,
|
|
||||||
"consentmanager" => self::CONSENTMANAGER,
|
|
||||||
"cookiefirst" => self::COOKIEFIRST
|
|
||||||
];
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param string $sManager
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isManagerInList(string $sManager) :bool
|
|
||||||
{
|
|
||||||
return in_array($sManager, $this->getManagerList(), true);
|
|
||||||
}
|
|
||||||
}
|
|
@ -31,17 +31,10 @@ $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?',
|
||||||
'HELP_SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Mehr Informationen zu den genannten Coookie-Manager finden Sie auf den folgenden Home-Pages<br><br>
|
|
||||||
<a href="https://consentmanager.net/">Consentmanager</a><br>
|
|
||||||
<a href="https://usercentrics.com/">Usercentrics</a><br>
|
|
||||||
<a href="https://cookiefirst.com">Cookiefirst</a><br>
|
|
||||||
<hr>
|
|
||||||
Bei weiteren Fragen stehen wir gern zur VerfĂĽgung! Kontaktieren Sie uns einfach unter <a href="https://www.d3data.de/">https://www.d3data.de/</a>',
|
|
||||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Nutzen Sie eine der folgenden Einbindungen?<br>
|
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER' => 'Nutzen Sie eine der folgenden Einbindungen?<br>
|
||||||
Dann wählen Sie bitte die zutreffende aus.',
|
Dann wählen Sie bitte die zutreffende aus.',
|
||||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_NONE' => '---',
|
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_NONE' => '---',
|
||||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_CONSENTMANAGER' => 'consentmanager',
|
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_CONSENTMANAGER' => 'consentmanager',
|
||||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_USERCENTRICS' => 'usercentrics',
|
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_USERCENTRICS' => 'usercentrics',
|
||||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_COOKIEFIRST' => 'cookiefirst',
|
|
||||||
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
|
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
|
||||||
];
|
];
|
||||||
|
@ -4,22 +4,28 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
[{if $oViewConf->D3blShowGtmScript()}]
|
[{if $oViewConf->D3blShowGtmScript()}]
|
||||||
[{if $oViewConf->getGtmContainerId()}]
|
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
||||||
[{strip}]
|
<!-- Google Tag Manager -->
|
||||||
<!-- Google Tag Manager -->
|
<script [{$oViewConf->getGtmScriptAttributes()}]>
|
||||||
<script [{$oViewConf->getGtmScriptAttributes()}]>
|
(function (w, d, s, l, i) {
|
||||||
(function (w, d, s, l, i) {
|
w[l] = w[l] || [];
|
||||||
w[l] = w[l] || [];
|
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
|
||||||
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
|
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
||||||
var f = d.getElementsByTagName(s)[0], j = d.createElement(s), dl = l != 'dataLayer' ? '&l=' + l : '';
|
j.async = true;
|
||||||
j.async = true;
|
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
||||||
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
f.parentNode.insertBefore(j, f);
|
||||||
f.parentNode.insertBefore(j, f);
|
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
|
||||||
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
|
</script>
|
||||||
</script>
|
<!-- End Google Tag Manager -->
|
||||||
<!-- End Google Tag Manager -->
|
|
||||||
[{/strip}]
|
[{if $oViewConf->getTopActionClassName() === "alist" }]
|
||||||
|
[{* include file="ga4_view_item_list.tpl" gtmCategory=$oView->getActiveCategory() gtmProducts=$oView->getArticleList() listtype=$oView->getListType() *}]
|
||||||
|
[{elseif $oViewConf->getTopActionClassName() === "details" }]
|
||||||
|
[{* include file="ga4_view_item.tpl" gtmProduct=$oView->getProduct() *}]
|
||||||
|
[{elseif $oViewConf->getTopActionClassName() === "search" }]
|
||||||
|
[{elseif $oViewConf->getTopActionClassName() === "basket" }]
|
||||||
|
[{/if}]
|
||||||
|
[{/strip}][{/if}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
[{/if}]
|
|
||||||
|
|
||||||
[{$smarty.block.parent}]
|
[{$smarty.block.parent}]
|
33
Application/views/blocks/checkout_s1.tpl
Normal file
33
Application/views/blocks/checkout_s1.tpl
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
[{$smarty.block.parent}]
|
||||||
|
|
||||||
|
[{*$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}]
|
||||||
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
|
dataLayer.push({
|
||||||
|
'event': 'view_cart',
|
||||||
|
'eventLabel':'Checkout Step 1',
|
||||||
|
'ecommerce': {
|
||||||
|
'actionField': "step: 1",
|
||||||
|
'currency': "[{$currency->name}]",
|
||||||
|
'value': [{$d3BasketPrice->getPrice()}],
|
||||||
|
'items': [
|
||||||
|
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
||||||
|
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
|
||||||
|
{
|
||||||
|
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
|
||||||
|
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
|
||||||
|
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
|
||||||
|
'price': [{$d3oItemPrice->getPrice()}],
|
||||||
|
'quantity':[{$basketitem->getAmount()}],
|
||||||
|
'position':[{$smarty.foreach.gtmCartContents.index}]
|
||||||
|
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
|
||||||
|
[{/foreach}]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
[{/capture}][{/strip}]
|
||||||
|
[{oxscript add=$d3_ga4_view_cart}]
|
36
Application/views/blocks/checkout_s5.tpl
Normal file
36
Application/views/blocks/checkout_s5.tpl
Normal file
@ -0,0 +1,36 @@
|
|||||||
|
[{$smarty.block.parent}]
|
||||||
|
|
||||||
|
[{strip}]
|
||||||
|
<script>
|
||||||
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
|
[{assign var="_gtmOrder" value=$oView->getOrder()}]
|
||||||
|
[{assign var="_gtmArticles" value=$_gtmOrder->getOrderArticles()}]
|
||||||
|
|
||||||
|
dataLayer.push({
|
||||||
|
'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")}],
|
||||||
|
'currency': '[{$_gtmOrder->getFieldData('oxcurrency')}]',
|
||||||
|
'items':
|
||||||
|
[
|
||||||
|
[{foreach from=$_gtmArticles item="d3BasketArticle" name="gtmArticles"}]
|
||||||
|
[{assign var="d3oArticlePrice" value=$d3BasketArticle->getPrice()}]
|
||||||
|
{
|
||||||
|
'id': '[{$d3BasketArticle->getFieldData("oxartnum")}]',
|
||||||
|
'name': '[{$d3BasketArticle->getFieldData("oxtitle")}]',
|
||||||
|
'variant': '[{$d3BasketArticle->getFieldData("oxselvariant")}]',
|
||||||
|
'price': [{$d3oArticlePrice->getPrice()}],
|
||||||
|
'quantity': [{$d3BasketArticle->getFieldData("oxamount")}],
|
||||||
|
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
||||||
|
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
||||||
|
[{/foreach}]
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})
|
||||||
|
</script>
|
||||||
|
[{/strip}]
|
@ -1,49 +0,0 @@
|
|||||||
[{$smarty.block.parent}]
|
|
||||||
|
|
||||||
[{strip}]
|
|
||||||
<script>
|
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
|
||||||
[{assign var="gtmOrder" value=$oView->getOrder()}]
|
|
||||||
[{assign var="gtmBasket" value=$oView->getBasket()}]
|
|
||||||
[{assign var="gtmArticles" value=$gtmOrder->getOrderArticles()}]
|
|
||||||
[{assign var="gtmOrderVouchers" value=$gtmOrder->getVoucherNrList()}]
|
|
||||||
|
|
||||||
dataLayer.push({
|
|
||||||
'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")}],
|
|
||||||
'currency': '[{$gtmOrder->getFieldData('oxcurrency')}]',
|
|
||||||
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
|
||||||
'paymentType': '[{$gtmBasket->getPaymentOnPaymentId()}]',
|
|
||||||
'items': [
|
|
||||||
[{foreach from=$gtmArticles item="gtmBasketItem" name="gtmArticles"}]
|
|
||||||
[{assign var="gtmPurchaseItemPriceObject" value=$gtmBasketItem->getPrice()}]
|
|
||||||
[{assign var="gtmPurchaseItem" value=$gtmBasketItem->getArticle()}]
|
|
||||||
[{assign var="gtmPurchaseItemCategory" value=$gtmPurchaseItem->getCategory()}]
|
|
||||||
|
|
||||||
{
|
|
||||||
'item_id': '[{$gtmBasketItem->getFieldData("oxartnum")}]',
|
|
||||||
'item_name': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
|
||||||
'affiliation': '[{$gtmBasketItem->getFieldData("oxtitle")}]',
|
|
||||||
'coupon': '[{foreach from=$gtmOrderVouchers item="gtmOrderVoucher" name="gtmOrderVoucherIteration"}][{$gtmOrderVoucher}][{if !$smarty.foreach.gtmOrderVoucherIteration.last}], [{/if}][{/foreach}]',
|
|
||||||
'item_variant': '[{$gtmBasketItem->getFieldData("oxselvariant")}]',
|
|
||||||
'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0)}]',
|
|
||||||
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1)}]',
|
|
||||||
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2)}]',
|
|
||||||
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3)}]',
|
|
||||||
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
|
|
||||||
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
|
|
||||||
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
|
|
||||||
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
|
||||||
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
|
||||||
[{/foreach}]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
})
|
|
||||||
</script>
|
|
||||||
[{/strip}]
|
|
@ -1,42 +0,0 @@
|
|||||||
[{$smarty.block.parent}]
|
|
||||||
|
|
||||||
[{*$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}]
|
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
|
||||||
dataLayer.push({
|
|
||||||
'event': 'view_cart',
|
|
||||||
'eventLabel':'Checkout Step 1',
|
|
||||||
'ecommerce': {
|
|
||||||
'actionField': "step: 1",
|
|
||||||
'currency': "[{$currency->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')}]',
|
|
||||||
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0)}]',
|
|
||||||
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1)}]',
|
|
||||||
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2)}]',
|
|
||||||
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3)}]',
|
|
||||||
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
|
|
||||||
'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}]
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
[{/capture}][{/strip}]
|
|
||||||
[{oxscript add=$d3_ga4_view_cart}]
|
|
@ -5,7 +5,6 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
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_item',
|
'event': 'view_item',
|
||||||
'eventLabel':'Product View',
|
'eventLabel':'Product View',
|
||||||
@ -16,12 +15,8 @@
|
|||||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
'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_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
||||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
|
||||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
|
||||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
|
||||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
|
||||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
|
||||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
'price': [{$d3PriceObject->getPrice()}]
|
'price': [{$d3PriceObject->getPrice()}]
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,8 @@
|
|||||||
$("#toBasket").click(function(event) {
|
$("#toBasket").click(function(event) {
|
||||||
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. */
|
||||||
|
|
||||||
|
let itemCategories = '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]no category[{/if}]'.split('/');
|
||||||
|
|
||||||
[{*** Debug cases ***}]
|
[{*** Debug cases ***}]
|
||||||
[{*event.preventDefault();*}]
|
[{*event.preventDefault();*}]
|
||||||
|
|
||||||
@ -30,11 +32,10 @@
|
|||||||
'price': [{$d3PriceObject->getPrice()}],
|
'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': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
'item_category': itemCategories[0] || 'no category',
|
||||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
'item_category_2':itemCategories[1] || '',
|
||||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
'item_category_3':itemCategories[2] || '',
|
||||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
'item_category_4':itemCategories[3] || '',
|
||||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
|
||||||
'quantity': iArtQuantity
|
'quantity': iArtQuantity
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
8
Application/views/ga4/view_search_result.tpl → Application/views/ga4/search.tpl
Normal file → Executable file
8
Application/views/ga4/view_search_result.tpl → Application/views/ga4/search.tpl
Normal file → Executable file
@ -15,17 +15,13 @@
|
|||||||
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
[{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': [{$d3PriceObject->getPrice()}],
|
'price': [{$d3PriceObject->getPrice()}],
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
||||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
|
||||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
|
||||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
|
||||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
|
||||||
'quantity': 1
|
'quantity': 1
|
||||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||||
[{/foreach}]
|
[{/foreach}]
|
@ -1,6 +1,5 @@
|
|||||||
[{$smarty.block.parent}]
|
[{$smarty.block.parent}]
|
||||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||||
[{assign var="gtmCategory" value=$oView->getActiveCategory()}]
|
|
||||||
|
|
||||||
[{assign var="breadCrumb" value=''}]
|
[{assign var="breadCrumb" value=''}]
|
||||||
|
|
||||||
@ -13,8 +12,8 @@
|
|||||||
'event':'view_item_list',
|
'event':'view_item_list',
|
||||||
'event_name': 'view_item_list',
|
'event_name': 'view_item_list',
|
||||||
'ecommerce': {
|
'ecommerce': {
|
||||||
'item_list_id': '[{$oView->getCategoryId()}]',
|
'item_list_id': '[{$oView->getCategoryId()}]',
|
||||||
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
|
'item_list_name': '[{foreach from=$oView->getBreadCrumb() item=sCrum}][{if $sCrum.title }][{$breadCrumb|cat:$sCrum.title|cat:" > "}][{/if}][{/foreach}]',
|
||||||
'items': [
|
'items': [
|
||||||
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||||
@ -25,10 +24,7 @@
|
|||||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||||
'price': [{$d3PriceObject->getPrice()}],
|
'price': [{$d3PriceObject->getPrice()}],
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0)}]',
|
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
||||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1)}]',
|
|
||||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2)}]',
|
|
||||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3)}]',
|
|
||||||
'quantity': 1
|
'quantity': 1
|
||||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||||
[{/foreach}]
|
[{/foreach}]
|
||||||
|
14
CHANGELOG.md
14
CHANGELOG.md
@ -4,20 +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/),
|
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).
|
||||||
|
|
||||||
## [1.10.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.9.0...1.10.0) - 2023-06-27
|
|
||||||
### Added
|
|
||||||
- Following Entries to dedicated event-templates
|
|
||||||
- coupon
|
|
||||||
- paymentType
|
|
||||||
- item_list_name
|
|
||||||
- item_category
|
|
||||||
- Method to get the in order used Payment-Name
|
|
||||||
- Method to get the current Article Category
|
|
||||||
### Changed
|
|
||||||
- cookieManager handling
|
|
||||||
- general template cleanup
|
|
||||||
- renaming the template to a more intuitive name
|
|
||||||
|
|
||||||
## [1.9.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.8.0...1.9.0) - 2023-06-19
|
## [1.9.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.8.0...1.9.0) - 2023-06-19
|
||||||
### Changed
|
### Changed
|
||||||
- add_to_cart event template-structure
|
- add_to_cart event template-structure
|
||||||
|
@ -15,9 +15,4 @@
|
|||||||
|
|
||||||
namespace D3\GoogleAnalytics4\Modules\Core{
|
namespace D3\GoogleAnalytics4\Modules\Core{
|
||||||
class ViewConfig_parent extends \OxidEsales\Eshop\Core\ViewConfig{}
|
class ViewConfig_parent extends \OxidEsales\Eshop\Core\ViewConfig{}
|
||||||
}
|
|
||||||
|
|
||||||
namespace D3\GoogleAnalytics4\Modules\Application\Model{
|
|
||||||
class Category_parent extends \OxidEsales\Eshop\Application\Model\Category {}
|
|
||||||
class Basket_parent extends \OxidEsales\Eshop\Application\Model\Basket {}
|
|
||||||
}
|
}
|
@ -1,23 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
|
||||||
|
|
||||||
use OxidEsales\Eshop\Application\Model\Payment;
|
|
||||||
|
|
||||||
class Basket extends Basket_parent
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
public function getPaymentOnPaymentId() :string
|
|
||||||
{
|
|
||||||
if ($this->getPaymentId()){
|
|
||||||
$oPayment = oxNew(Payment::class);
|
|
||||||
if ($oPayment->load($this->getPaymentId())){
|
|
||||||
return $oPayment->getFieldData('oxdesc');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return "couldn't load payment!";
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,44 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
|
||||||
|
|
||||||
class Category extends Category_parent
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* @param int $indexOfArray
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getSplitCategoryArray(int $indexOfArray = -1) :string
|
|
||||||
{
|
|
||||||
if ($indexOfArray > -1){
|
|
||||||
$splitCatArray =
|
|
||||||
array_values(
|
|
||||||
array_filter(
|
|
||||||
explode(
|
|
||||||
'/',
|
|
||||||
trim(
|
|
||||||
parse_url(
|
|
||||||
$this->getLink(),
|
|
||||||
5
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
if ($splitCatArray[$indexOfArray]){
|
|
||||||
return $splitCatArray[$indexOfArray];
|
|
||||||
}else{
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return
|
|
||||||
trim(
|
|
||||||
parse_url(
|
|
||||||
$this->getLink(),
|
|
||||||
5
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
}
|
|
@ -12,8 +12,6 @@
|
|||||||
|
|
||||||
namespace D3\GoogleAnalytics4\Modules\Core;
|
namespace D3\GoogleAnalytics4\Modules\Core;
|
||||||
|
|
||||||
use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
|
|
||||||
use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
|
|
||||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||||
use OxidEsales\Eshop\Core\Config;
|
use OxidEsales\Eshop\Core\Config;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
@ -35,22 +33,53 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return void
|
* @return mixed
|
||||||
*/
|
*/
|
||||||
public function defineCookieManagerType() :void
|
public function getModuleSettingExplicitManagerSelectValue()
|
||||||
|
{
|
||||||
|
return Registry::getConfig()->getConfigParam('d3_gtm_settings_HAS_STD_MANAGER');
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return false|mixed
|
||||||
|
*/
|
||||||
|
public function getExplicitManager()
|
||||||
|
{
|
||||||
|
$sManagerName = $this->getModuleSettingExplicitManagerSelectValue();
|
||||||
|
return $sManagerName === "NONE" ? false : $sManagerName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getCookieManagerType()
|
||||||
{
|
{
|
||||||
if ($this->sCookieManagerType === null)
|
if ($this->sCookieManagerType === null)
|
||||||
{
|
{
|
||||||
/** @var ManagerHandler $oManagerHandler */
|
$this->sCookieManagerType = false;
|
||||||
$oManagerHandler = oxNew(ManagerHandler::class);
|
|
||||||
$this->sCookieManagerType = $oManagerHandler->getCurrManager();
|
$allowedManagerTypes = [
|
||||||
|
'net_cookie_manager',
|
||||||
|
'agcookiecompliance',
|
||||||
|
'oxps_usercentrics'
|
||||||
|
];
|
||||||
|
|
||||||
|
foreach ($allowedManagerTypes as $type) {
|
||||||
|
if ($this->isModuleActive($type)) {
|
||||||
|
$this->sCookieManagerType = $type;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($this->sCookieManagerType === false and $this->getExplicitManager()){
|
||||||
|
return "externalService";
|
||||||
|
}
|
||||||
|
|
||||||
|
return $this->sCookieManagerType;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function shallUseOwnCookieManager() :bool
|
public function shallUseOwnCookieManager()
|
||||||
{
|
{
|
||||||
return (bool) Registry::getConfig()->getConfigParam('d3_gtm_settings_hasOwnCookieManager');
|
return (bool) Registry::getConfig()->getConfigParam('d3_gtm_settings_hasOwnCookieManager');
|
||||||
}
|
}
|
||||||
@ -64,43 +93,33 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
$oConfig = Registry::getConfig();
|
$oConfig = Registry::getConfig();
|
||||||
|
|
||||||
// No Cookie Manager in use
|
// No Cookie Manager in use
|
||||||
if (!$this->shallUseOwnCookieManager()) {
|
if (false === $this->shallUseOwnCookieManager()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->defineCookieManagerType();
|
$sCookieID = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||||
|
|
||||||
$sCookieID = trim($oConfig->getConfigParam('d3_gtm_settings_cookieName'));
|
|
||||||
|
|
||||||
// Netensio Cookie Manager
|
// Netensio Cookie Manager
|
||||||
if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) {
|
if ($this->getCookieManagerType() == "net_cookie_manager") {
|
||||||
$oSession = Registry::getSession();
|
$oSession = Registry::getSession();
|
||||||
$aCookies = $oSession->getVariable("aCookieSel");
|
$aCookies = $oSession->getVariable("aCookieSel");
|
||||||
|
|
||||||
return (is_array($aCookies) && array_key_exists($sCookieID, $aCookies) && $aCookies[$sCookieID] == "1");
|
return (!is_null($aCookies) && is_array($aCookies) && array_key_exists($sCookieID, $aCookies) && $aCookies[$sCookieID] == "1");
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggrosoft Cookie Consent
|
// Aggrosoft Cookie Consent
|
||||||
if ($this->sCookieManagerType === ManagerTypes::AGCOOKIECOMPLIANCE) {
|
if ($this->getCookieManagerType() == "agcookiecompliance") {
|
||||||
if (method_exists($this, "isCookieCategoryEnabled")) {
|
if (method_exists($this, "isCookieCategoryEnabled")) {
|
||||||
return $this->isCookieCategoryEnabled($sCookieID);
|
return $this->isCookieCategoryEnabled($sCookieID);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// UserCentrics or consentmanager
|
// UserCentrics or consentmanager
|
||||||
if (
|
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getCookieManagerType() === 'externalService') {
|
||||||
$this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE
|
|
||||||
or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY
|
|
||||||
or $this->sCookieManagerType === ManagerTypes::CONSENTMANAGER
|
|
||||||
or $this->sCookieManagerType === ManagerTypes::COOKIEFIRST
|
|
||||||
or $this->sCookieManagerType === ManagerTypes::EXTERNAL_SERVICE
|
|
||||||
)
|
|
||||||
{
|
|
||||||
// Always needs the script-tags delivered to the DOM.
|
// Always needs the script-tags delivered to the DOM.
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Cookie Manager not (yet) supported
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,26 +128,25 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
* This is especially important for UserCentrics.
|
* This is especially important for UserCentrics.
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public function getGtmScriptAttributes() :string
|
public function getGtmScriptAttributes()
|
||||||
{
|
{
|
||||||
$sCookieId = trim(Registry::getConfig()->getConfigParam('d3_gtm_settings_cookieName'));
|
$oConfig = Registry::getConfig();
|
||||||
|
|
||||||
if (false === $this->shallUseOwnCookieManager()){
|
if (false === $this->shallUseOwnCookieManager()){
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getExplicitManager() === 'USERCENTRICS') {
|
||||||
$this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE
|
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||||
or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY
|
|
||||||
)
|
|
||||||
{
|
|
||||||
if ($sCookieId) {
|
if ($sCookieId) {
|
||||||
return 'data-usercentrics="' . $sCookieId . '" type="text/plain" async=""';
|
return 'data-usercentrics="' . $sCookieId . '" type="text/plain" async=""';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->sCookieManagerType === ManagerTypes::CONSENTMANAGER)
|
if ($this->getCookieManagerType() === "externalService" and $this->getExplicitManager() === 'CONSENTMANAGER') {
|
||||||
{
|
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||||
|
|
||||||
if ($sCookieId) {
|
if ($sCookieId) {
|
||||||
return 'async
|
return 'async
|
||||||
type="text/plain"
|
type="text/plain"
|
||||||
@ -139,10 +157,6 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->sCookieManagerType === ManagerTypes::COOKIEFIRST){
|
|
||||||
return 'type="text/plain" data-cookiefirst-category="' . $sCookieId .'"';
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -23,16 +23,16 @@ Dieses Paket erfordert einen mit Composer installierten OXID eShop in einer in d
|
|||||||
Ă–ffnen Sie eine Kommandozeile und navigieren Sie zum Stammverzeichnis des Shops (Elternverzeichnis von source und vendor). FĂĽhren Sie den folgenden Befehl aus. Passen Sie die Pfadangaben an Ihre Installationsumgebung an.
|
Ă–ffnen Sie eine Kommandozeile und navigieren Sie zum Stammverzeichnis des Shops (Elternverzeichnis von source und vendor). FĂĽhren Sie den folgenden Befehl aus. Passen Sie die Pfadangaben an Ihre Installationsumgebung an.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
php composer require d3/google-analytics4:^2
|
php composer require d3/google-analytics4:^1
|
||||||
```
|
```
|
||||||
|
|
||||||
Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code auszuführen.
|
Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code auszuführen.
|
||||||
|
|
||||||
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||||
|
|
||||||
### Wichtig!
|
> ### Wichtig!
|
||||||
Bitte stellen Sie sicher, dass die nötigen Template-Blöcke im OXID-Shop zur Verfügung stehen.
|
> Bitte stellen Sie sicher, dass die nötigen Blöcke im OXID-Shop zur Verfügung stehen.
|
||||||
Lesen Sie mehr in der [technischen Doku](./Docs/README.md) unter "Blöcke"!
|
> Lesen Sie mehr in der [technischen Doku](./Docs/README.md) unter "Blöcke"!
|
||||||
|
|
||||||
## Verwendung
|
## Verwendung
|
||||||
### Grundfunktionalität
|
### Grundfunktionalität
|
||||||
|
110
composer.json
110
composer.json
@ -1,56 +1,56 @@
|
|||||||
{
|
{
|
||||||
"name": "d3/google-analytics4",
|
"name": "d3/google-analytics4",
|
||||||
"description": "Google Tag Manager with new Google Analytics 4 for OXID eShop v6",
|
"description": "Google Tag Manager with new Google Analytics 4 for OXID eShop v6",
|
||||||
"type": "oxideshop-module",
|
"type": "oxideshop-module",
|
||||||
"keywords": [
|
"keywords": [
|
||||||
"oxid",
|
"oxid",
|
||||||
"modules",
|
"modules",
|
||||||
"eShop",
|
"eShop",
|
||||||
"d3",
|
"d3",
|
||||||
"google",
|
"google",
|
||||||
"ga4",
|
"ga4",
|
||||||
"googleanalytics",
|
"googleanalytics",
|
||||||
"gtm",
|
"gtm",
|
||||||
"configuration"
|
"configuration"
|
||||||
],
|
],
|
||||||
"homepage": "https://www.d3data.de",
|
"homepage": "https://www.d3data.de",
|
||||||
"license": [
|
"license": [
|
||||||
"GPL-3.0"
|
"GPL-3.0"
|
||||||
],
|
],
|
||||||
"authors": [
|
"authors": [
|
||||||
{
|
{
|
||||||
"name": "Marat Bedoev",
|
"name": "Marat Bedoev",
|
||||||
"email": "hello@mb-dev.pro"
|
"email": "hello@mb-dev.pro"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"name": "D3 Data Development (Inh. Thomas Dartsch)",
|
"name": "D3 Data Development (Inh. Thomas Dartsch)",
|
||||||
"email": "info@shopmodule.com",
|
"email": "info@shopmodule.com",
|
||||||
"homepage": "https://www.d3data.de"
|
"homepage": "https://www.d3data.de"
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"support": {
|
"support": {
|
||||||
"email": "support@shopmodule.com"
|
"email": "support@shopmodule.com"
|
||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"oxideshop": {
|
"oxideshop": {
|
||||||
"blacklist-filter": [
|
"blacklist-filter": [
|
||||||
"*.md",
|
"*.md",
|
||||||
"composer.json",
|
"composer.json",
|
||||||
".php-cs-fixer.php",
|
".php-cs-fixer.php",
|
||||||
"*.xml",
|
"*.xml",
|
||||||
"*.neon"
|
"*.neon"
|
||||||
],
|
],
|
||||||
"target-directory": "d3/googleanalytics4"
|
"target-directory": "d3/googleanalytics4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1",
|
"php": ">=7.1",
|
||||||
"oxid-esales/oxideshop-ce": "v6.0 - 6.3",
|
"oxid-esales/oxideshop-ce": "v6.0 - 6.3",
|
||||||
"google/apiclient":" ^2.0"
|
"google/apiclient":" ^2.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
"psr-4": {
|
"psr-4": {
|
||||||
"D3\\GoogleAnalytics4\\": "../../../source/modules/d3/googleanalytics4"
|
"D3\\GoogleAnalytics4\\": "../../../source/modules/d3/googleanalytics4"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
26
metadata.php
26
metadata.php
@ -1,10 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket;
|
|
||||||
use D3\GoogleAnalytics4\Modules\Application\Model\Category as Category;
|
|
||||||
use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
|
use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
|
||||||
use OxidEsales\Eshop\Application\Model\Basket as OEBasket;
|
|
||||||
use OxidEsales\Eshop\Application\Model\Category as OECategory;
|
|
||||||
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
|
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
|
||||||
|
|
||||||
$sMetadataVersion = '2.1';
|
$sMetadataVersion = '2.1';
|
||||||
@ -22,16 +17,19 @@ $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' => '1.10.0',
|
'version' => '1.9.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/',
|
||||||
'extend' => [
|
'extend' => [
|
||||||
OEViewConfig::class => ViewConfig::class,
|
OEViewConfig::class => ViewConfig::class
|
||||||
OECategory::class => Category::class,
|
],
|
||||||
OEBasket::class => Basket::class
|
'templates' => [
|
||||||
|
// GA4 events
|
||||||
|
'ga4_add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/ga4/add_to_cart.tpl',
|
||||||
|
'ga4_search.tpl' => 'd3/googleanalytics4/Application/views/ga4/search.tpl',
|
||||||
|
'ga4_view_item_list.tpl' => 'd3/googleanalytics4/Application/views/ga4/view_item_list.tpl',
|
||||||
],
|
],
|
||||||
'templates' => [],
|
|
||||||
'blocks' => [
|
'blocks' => [
|
||||||
// tag manager js
|
// tag manager js
|
||||||
[
|
[
|
||||||
@ -57,12 +55,12 @@ $aModule = [
|
|||||||
[
|
[
|
||||||
'template' => 'page/checkout/basket.tpl',
|
'template' => 'page/checkout/basket.tpl',
|
||||||
'block' => 'checkout_basket_main',
|
'block' => 'checkout_basket_main',
|
||||||
'file' => '/Application/views/blocks/view_cart.tpl'
|
'file' => '/Application/views/blocks/checkout_s1.tpl'
|
||||||
],
|
],
|
||||||
[
|
[
|
||||||
'template' => 'page/checkout/thankyou.tpl',
|
'template' => 'page/checkout/thankyou.tpl',
|
||||||
'block' => 'checkout_thankyou_main',
|
'block' => 'checkout_thankyou_main',
|
||||||
'file' => '/Application/views/blocks/purchase.tpl'
|
'file' => '/Application/views/blocks/checkout_s5.tpl'
|
||||||
],
|
],
|
||||||
// Lists
|
// Lists
|
||||||
// view_item_list
|
// view_item_list
|
||||||
@ -76,7 +74,7 @@ $aModule = [
|
|||||||
[
|
[
|
||||||
'template' => 'page/search/search.tpl',
|
'template' => 'page/search/search.tpl',
|
||||||
'block' => 'search_results',
|
'block' => 'search_results',
|
||||||
'file' => '/Application/views/ga4/view_search_result.tpl',
|
'file' => '/Application/views/ga4/search.tpl',
|
||||||
'position' => 150
|
'position' => 150
|
||||||
],
|
],
|
||||||
// add_to_cart
|
// add_to_cart
|
||||||
@ -128,7 +126,7 @@ $aModule = [
|
|||||||
'name' => 'd3_gtm_settings_HAS_STD_MANAGER',
|
'name' => 'd3_gtm_settings_HAS_STD_MANAGER',
|
||||||
'type' => 'select',
|
'type' => 'select',
|
||||||
'value' => 'none',
|
'value' => 'none',
|
||||||
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST',
|
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS',
|
||||||
],
|
],
|
||||||
]
|
]
|
||||||
];
|
];
|
Loading…
Reference in New Issue
Block a user