Compare commits
177 Commits
Author | SHA1 | Date | |
---|---|---|---|
b3f2446a7d | |||
ce1614996a | |||
ec2d43ff3c | |||
c32c66322f | |||
8079eee236 | |||
00c0bd2497 | |||
76eeb0d5bd | |||
0baa44e5d7 | |||
a38dcb8e45 | |||
1ae5a9d926 | |||
938d1514a6 | |||
9a48d32c3b | |||
bc8876367c | |||
9410495a58 | |||
05df5ef100 | |||
59ef1d0625 | |||
e4969f2cbd | |||
13ef2bef7b | |||
59f0e37cce | |||
bcf38a6e11 | |||
31b3474cfd | |||
1a641de8fc | |||
268cf6f6da | |||
5d5b3459cd | |||
1c1080923b | |||
007e83909b | |||
ed5fcc6011 | |||
22ea5a1ce2 | |||
229cf3695f | |||
a990834da4 | |||
6047f72edf | |||
e2564f613a | |||
9ea5408e44 | |||
ab6b7f7454 | |||
a88fa570a8 | |||
81aab10c4e | |||
5ac3385b53 | |||
5c98d99d80 | |||
19553fcee2 | |||
da2966626e | |||
6fcee0671f | |||
bb513e6ded | |||
f64eb35763 | |||
36b3aa9ef2 | |||
b2d8d597fd | |||
36ac641233 | |||
ef4e4625cd | |||
84a9aba764 | |||
99af4cdfa9 | |||
eb2c7f73b9 | |||
7d12dd68a7 | |||
565f47b1ff | |||
7c6b0215a5 | |||
84e3895db8 | |||
1e479503a7 | |||
575e35ffbc | |||
2e6acbe675 | |||
aae6c43786 | |||
17840d33b1 | |||
a49c29d7aa | |||
e90aba2c55 | |||
ea6b63fd2f | |||
6b18c50b42 | |||
443b456a0d | |||
216c53fa90 | |||
9e7b4653ea | |||
7b1241ab97 | |||
5355b0a7ad | |||
0f15df8364 | |||
71b743ddcc | |||
c0206f741f | |||
22bec30621 | |||
49bfd5be09 | |||
6002540268 | |||
cc89303595 | |||
7062d935f4 | |||
9f1deab099 | |||
2cc0368633 | |||
432ba54c84 | |||
8b344ffb85 | |||
0009926313 | |||
50be757355 | |||
b0a1c20419 | |||
54fcbf88c9 | |||
0ae67c823b | |||
ab4232fb4a | |||
60f61f4bab | |||
a93b1cf582 | |||
0ec765955e | |||
d505d8530a | |||
fd79710158 | |||
d2ef663dd3 | |||
fec30b1109 | |||
5c53d83f32 | |||
8a7c25fad9 | |||
429069e0cf | |||
50f9fbca23 | |||
cb18feba82 | |||
47b8622018 | |||
92a91d0194 | |||
226a80f138 | |||
5dd7b51fb5 | |||
7b82476e8b | |||
bfc2ca8ad6 | |||
e48b21022c | |||
b4bf91660e | |||
3f59d1f210 | |||
5ed924e840 | |||
3d62993dfc | |||
679a49823c | |||
106fea9c91 | |||
d4ef0f35f9 | |||
c17ae1cef5 | |||
13132e6da0 | |||
5c478124bc | |||
12613357b3 | |||
95e0cab68c | |||
1d194d445a | |||
bf3fee5ce5 | |||
3c280a3adb | |||
6217524828 | |||
5ef600ff2a | |||
a40d922f42 | |||
dae5f66f81 | |||
32e08a88ca | |||
347e551194 | |||
000c49c56b | |||
002cc69d2a | |||
af78809ae5 | |||
d531ba648b | |||
a0c650fca3 | |||
af341a984b | |||
122dd4cf53 | |||
27798703b0 | |||
8eb734be8a | |||
616f31ecba | |||
527eec1355 | |||
1966d3008e | |||
bd51b37159 | |||
718b60e12c | |||
d4df87bfff | |||
63007e9b02 | |||
5fe656988c | |||
9cb3a54824 | |||
2f6fd8a31c | |||
8f9ed021d6 | |||
0ef3d3373a | |||
fd2b4a5bbe | |||
1c0d55bdc3 | |||
7c1f99e678 | |||
126e746651 | |||
1c45a16356 | |||
1589f202a9 | |||
55bd7b7fb4 | |||
3c1e6a11ff | |||
9ac78a0d43 | |||
e2bcb34051 | |||
4ea0c19d7b | |||
56740f1f10 | |||
daed30a585 | |||
48d411ac3f | |||
b530366cb8 | |||
975d07056a | |||
24bf113d30 | |||
ca6a810fa3 | |||
62b382eadf | |||
45d8e45137 | |||
70f2308575 | |||
6eb15ec080 | |||
d722c46a74 | |||
d847a34e99 | |||
7b55d1d57c | |||
a25be1069c | |||
5200232a32 | |||
bcd785774b | |||
5ba613df30 | |||
a1dc0a6a58 |
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
.idea
|
11
Application/Model/Constants.php
Normal file
11
Application/Model/Constants.php
Normal file
@ -0,0 +1,11 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Application\Model;
|
||||
|
||||
|
||||
class Constants
|
||||
{
|
||||
public const OXID_MODULE_ID = 'd3googleanalytics4';
|
||||
}
|
53
Application/Model/ManagerHandler.php
Normal file
53
Application/Model/ManagerHandler.php
Normal file
@ -0,0 +1,53 @@
|
||||
<?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";
|
||||
}
|
||||
}
|
66
Application/Model/ManagerTypes.php
Normal file
66
Application/Model/ManagerTypes.php
Normal file
@ -0,0 +1,66 @@
|
||||
<?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";
|
||||
|
||||
const COOKIEBOT = "COOKIEBOT";
|
||||
|
||||
/**
|
||||
* @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,
|
||||
"cookiebot" => self::COOKIEBOT,
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* @param string $sManager
|
||||
* @return bool
|
||||
*/
|
||||
public function isManagerInList(string $sManager) :bool
|
||||
{
|
||||
return in_array($sManager, $this->getManagerList(), true);
|
||||
}
|
||||
}
|
@ -27,14 +27,78 @@ $aLang = [
|
||||
'SHOP_MODULE_d3_gtm_blGA4enab' => 'GA4 Aktivieren',
|
||||
'SHOP_MODULE_d3_gtm_blUAenabled' => 'UA Aktivieren',
|
||||
'SHOP_MODULE_d3_gtm_blEnableDebug' => 'Debug-Modus aktivieren',
|
||||
'SHOP_MODULE_GROUP_d3_gtm_settings_serversidetagging' => 'Server-Side tagging',
|
||||
'SHOP_MODULE_d3_gtm_settings_serversidetagging_js' => 'Servercontainer Ausführender-Code',
|
||||
'HELP_SHOP_MODULE_d3_gtm_settings_serversidetagging_js' => 'Diese Domain wird im <strong>aktiven</strong>-code ausgefüht. Das heißt,
|
||||
dass es sich hierbei um das HTML-Tag <code>script</code> handelt.
|
||||
Dieses kümmert sich darum, dass die, im data_layer
|
||||
zusammengefassten Daten an den GTM weitergeleitet werden.<br>
|
||||
<br>
|
||||
<h4>Folgend eine Darstellung, was genau ausgetauscht wird</h4>
|
||||
<pre>
|
||||
<code>
|
||||
Vorher:
|
||||
https://www.googletagmanager.com/gtm.js?id=
|
||||
|
||||
Nachher:
|
||||
{Domain}?id=
|
||||
</code>
|
||||
</pre>
|
||||
Die Conatiner-ID wird weiterhin im Punkt "Einstellung" eingetragen!
|
||||
',
|
||||
'SHOP_MODULE_d3_gtm_settings_serversidetagging_nojs' => 'Servercontainer NICHT Ausführender-Code<br><br>
|
||||
"Serverseitiges Tagging ist eine neue Möglichkeit, mit Google Tag Manager Ihre Anwendung geräteübergreifend zu verwalten.<br>
|
||||
Servercontainer verwenden dasselbe Tag-, Trigger- und Variablenmodell, das Sie gewohnt sind.<br>
|
||||
Außerdem bieten sie neue Tools, mit denen Sie Nutzeraktivitäten überall messen können." <br>
|
||||
<br>
|
||||
- Quelle <a href="https://developers.google.com/tag-platform/tag-manager/server-side/intro">Developers-Google Server-Side tagging</a><br>
|
||||
<br>
|
||||
<strong>Verändern Sie die Werte nur, wenn Sie Server-Side tagging verwenden wollen!</strong>
|
||||
',
|
||||
'HELP_SHOP_MODULE_d3_gtm_settings_serversidetagging_nojs' => 'Diese Domain wird im <strong>passiven</strong>-code ausgefüht. Das heißt,
|
||||
dass es sich hierbei um das HTML-Tag <code>noscript</code> handelt.
|
||||
Dieses wird ausgeführt, wenn aus einem bestimmten Grund
|
||||
das Javascript nicht ausgeführt wird.<br>
|
||||
( keine Cookies erlaubt, JavaScript-Unterbindung, ... )
|
||||
<br>
|
||||
<h4>Folgend eine Darstellung, was genau ausgetauscht wird</h4>
|
||||
<pre>
|
||||
<code>
|
||||
Vorher:
|
||||
src="https://www.googletagmanager.com/ns.html?id={Container-ID}"
|
||||
|
||||
Nachher:
|
||||
src="{Domain}?id={Container-ID}"
|
||||
</code>
|
||||
</pre>
|
||||
Die Conatiner-ID wird weiterhin im Punkt "Einstellung" eingetragen!
|
||||
',
|
||||
|
||||
// for cookie manager settings
|
||||
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
|
||||
'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>
|
||||
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_CONSENTMANAGER' => 'consentmanager',
|
||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_USERCENTRICS' => 'usercentrics',
|
||||
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
|
||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_COOKIEFIRST' => 'cookiefirst',
|
||||
'SHOP_MODULE_d3_gtm_settings_HAS_STD_MANAGER_COOKIEBOT' => 'Cookiebot',
|
||||
'SHOP_MODULE_d3_gtm_settings_controlParameter' => 'Steuerungsparameter',
|
||||
'HELP_SHOP_MODULE_d3_gtm_settings_controlParameter' => 'Nähere infos zum <a target="_blank" href="https://git.d3data.de/D3Public/GoogleAnalytics4/src/branch/master/Docs">"<strong>Steuerungsparameter</strong>"</a><hr>
|
||||
<strong>Beachte:</strong><br>
|
||||
Sofern Sie die <a target="_blank" href="https://consentmanager.net" style="color: blue">consentmanager</a> CMP verwenden,
|
||||
bitte ich Sie, gründlichst, die Hinweise der <a target="_blank" href="https://git.d3data.de/D3Public/GoogleAnalytics4/src/branch/master/Docs/CMP/consentmanager.md">Moduldokumentation/Consentmanager</a> zu lesen.
|
||||
',
|
||||
'SHOP_MODULE_d3_gtm_blActivateConsentMode' => "Google Consent Mode 'Default Values' aktivieren",
|
||||
'HELP_SHOP_MODULE_d3_gtm_blActivateConsentMode' => 'Diese Einstellung ist zu aktivieren, wenn Sie den Google-Consent-Mode ( Einwilligungsmodus ) verwenden wollen.
|
||||
<hr>
|
||||
"Im Einwilligungsmodus können Sie Google über den Cookie- oder App-ID-Einwilligungsstatus Ihrer Nutzer informieren.
|
||||
Mit Tags wird das Verhalten angepasst. Dabei werden die Einstellungen der Nutzer berücksichtigt." ~ <a href="https://support.google.com/google-ads/answer/10000067">Google Einwilligungsmodus</a>',
|
||||
];
|
||||
|
@ -3,29 +3,42 @@
|
||||
var dataLayer = [{$oViewConf->getGtmDataLayer()}] || [];
|
||||
</script>
|
||||
|
||||
[{if $oViewConf->D3blShowGtmScript()}]
|
||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
||||
<!-- Google Tag Manager -->
|
||||
<script [{$oViewConf->getGtmScriptAttributes()}]>
|
||||
(function (w, d, s, l, i) {
|
||||
w[l] = w[l] || [];
|
||||
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 : '';
|
||||
j.async = true;
|
||||
j.src = 'https://www.googletagmanager.com/gtm.js?id=' + i + dl;
|
||||
f.parentNode.insertBefore(j, f);
|
||||
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
|
||||
</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
[{assign var="d3GtmContainerIdString" value=$oViewConf->getGtmContainerId()}]
|
||||
|
||||
[{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 $oViewConf->D3blShowGtmScript()}]
|
||||
[{if $d3GtmContainerIdString}]
|
||||
[{strip}]
|
||||
|
||||
[{if $oViewConf->isGtmConsentModeSetActivated()}]
|
||||
<script>
|
||||
function gtag() {
|
||||
dataLayer.push(arguments);
|
||||
}
|
||||
|
||||
gtag("consent", "default", {
|
||||
ad_user_data: "denied",
|
||||
ad_personalization: "denied",
|
||||
ad_storage: "denied",
|
||||
analytics_storage: "denied",
|
||||
wait_for_update: 2000
|
||||
});
|
||||
</script>
|
||||
[{/if}]
|
||||
|
||||
<!-- Google Tag Manager -->
|
||||
<script [{$oViewConf->getGtmScriptAttributes()}]>
|
||||
(function (w, d, s, l, i) {
|
||||
w[l] = w[l] || [];
|
||||
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 : '';
|
||||
j.async = true;
|
||||
j.src = '[{$oViewConf->getServerSidetaggingJsDomain()}]?id=' + i + dl;
|
||||
f.parentNode.insertBefore(j, f);
|
||||
})(window, document, 'script', 'dataLayer', '[{$d3GtmContainerIdString}]');
|
||||
</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
[{/strip}]
|
||||
[{/if}]
|
||||
[{/if}]
|
||||
|
||||
[{$smarty.block.parent}]
|
@ -1,8 +1,8 @@
|
||||
[{if $oViewConf->D3blShowGtmScript() && !$oViewConf->getCookieManagerType()}]
|
||||
[{if $oViewConf->D3blShowGtmScript()}]
|
||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript>
|
||||
<iframe src="https://www.googletagmanager.com/ns.html?id=[{$oViewConf->getGtmContainerId()}]"
|
||||
<iframe src="[{$oViewConf->getServerSidetaggingNoJsDomain()}]?id=[{$oViewConf->getGtmContainerId()}]"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe>
|
||||
</noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
|
@ -1,33 +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()}],
|
||||
'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}]
|
@ -1,36 +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="_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}]
|
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
3
Application/views/blocks/page_list_listbody.tpl
Normal file
3
Application/views/blocks/page_list_listbody.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
3
Application/views/blocks/purchase.tpl
Normal file
3
Application/views/blocks/purchase.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/purchase.tpl"}]
|
3
Application/views/blocks/remove_from_cart.tpl
Normal file
3
Application/views/blocks/remove_from_cart.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/remove_from_cart.tpl"}]
|
3
Application/views/blocks/start_welcome_text.tpl
Normal file
3
Application/views/blocks/start_welcome_text.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
3
Application/views/blocks/view_cart.tpl
Normal file
3
Application/views/blocks/view_cart.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/view_cart.tpl"}]
|
@ -1,26 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
[{assign var="gtmProduct" value=$oView->getProduct()}]
|
||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||
|
||||
<script>
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'event': 'view_item',
|
||||
'eventLabel':'Product View',
|
||||
'ecommerce': {
|
||||
'currency': '[{$currency->name}]',
|
||||
'items': [
|
||||
{
|
||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||
'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()}]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
[{include file="event/view_item.tpl"}]
|
||||
|
3
Application/views/blocks/view_item_list.tpl
Normal file
3
Application/views/blocks/view_item_list.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/view_item_list.tpl"}]
|
3
Application/views/blocks/view_search_result.tpl
Normal file
3
Application/views/blocks/view_search_result.tpl
Normal file
@ -0,0 +1,3 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{include file="event/view_search_result.tpl"}]
|
61
Application/views/event/add_to_cart.tpl
Normal file
61
Application/views/event/add_to_cart.tpl
Normal file
@ -0,0 +1,61 @@
|
||||
|
||||
[{if $d3CmpBasket->getAddToBasketDecision() && $d3CmpBasket->d3GtmRequestedArticleLoadedByAnid() !== null}]
|
||||
[{assign var="oGtmProduct" value=$d3CmpBasket->d3GtmRequestedArticleLoadedByAnid()}]
|
||||
[{assign var="oGtmAmountArticlesAdded" value=$d3CmpBasket->getD3GtmAddToCartAmountArticles()}]
|
||||
[{*$smarty.block.parent*}]
|
||||
[{* variable $oGtmProduct is passed from parent tempalte *}]
|
||||
[{assign var="d3PriceObject" value=$oGtmProduct->getPrice()}]
|
||||
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
|
||||
[{assign var="gtmManufacturer" value=$oGtmProduct->getManufacturer()}]
|
||||
[{assign var="gtmCategory" value=$oGtmProduct->getCategory()}]
|
||||
|
||||
[{block name="d3_ga4_add_to_cart_list_block"}]
|
||||
[{capture name="d3_ga4_add_to_cart_listtpl"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
|
||||
[{*** Debug cases ***}]
|
||||
[{*event.preventDefault();*}]
|
||||
|
||||
let iArtQuantity = $("[{$htmlIdAmountOfArticles}]").val();
|
||||
let iArtQuantityAdded = [{$oGtmAmountArticlesAdded}];
|
||||
|
||||
if(!iArtQuantity && (iArtQuantityAdded === 1)){
|
||||
iArtQuantity = 1;
|
||||
}else{
|
||||
iArtQuantity = iArtQuantityAdded;
|
||||
}
|
||||
|
||||
dataLayer.push({
|
||||
'isAddToBasket': true,
|
||||
'event':'add_to_cart',
|
||||
'eventLabel': 'add_to_cart',
|
||||
'ecommerce': {
|
||||
'currency': "[{$currency->name}]",
|
||||
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
|
||||
'items': [
|
||||
{
|
||||
'item_id': '[{$oGtmProduct->getFieldData('oxartnum')}]',
|
||||
'item_name': '[{$oGtmProduct->getFieldData('oxtitle')}]',
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
'item_variant': '[{if $oGtmProduct->getFieldData('oxvarselect')}][{$oGtmProduct->getFieldData('oxvarselect')}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'quantity': iArtQuantity
|
||||
}
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_add_to_cart_listtpl}]
|
||||
[{/block}]
|
||||
[{/if}]
|
56
Application/views/event/purchase.tpl
Normal file
56
Application/views/event/purchase.tpl
Normal file
@ -0,0 +1,56 @@
|
||||
[{block name="d3_ga4_purchase_block"}]
|
||||
[{capture name="d3_ga4_purchase"}]
|
||||
[{strip}]
|
||||
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")}]',
|
||||
[{if $gtmPurchaseItemCategory}]
|
||||
'item_category': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4': '[{$gtmPurchaseItemCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name': '[{$gtmPurchaseItemCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'price': [{$gtmPurchaseItemPriceObject->getPrice()}],
|
||||
'quantity': [{$gtmBasketItem->getFieldData("oxamount")}],
|
||||
'position': [{$smarty.foreach.gtmArticles.iteration}]
|
||||
}[{if !$smarty.foreach.gtmArticles.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
})
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_purchase}]
|
||||
[{/block}]
|
46
Application/views/event/remove_from_cart.tpl
Normal file
46
Application/views/event/remove_from_cart.tpl
Normal file
@ -0,0 +1,46 @@
|
||||
[{block name="d3_ga4_remove_from_cart_block"}]
|
||||
[{if $hasBeenReloaded}]
|
||||
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||
[{capture name="d3_ga4_remove_from_cart"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'isRemoveFromCart': true,
|
||||
'event': 'remove_from_cart',
|
||||
'eventLabel':'remove_from_cart',
|
||||
'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=$toRemoveArticles->getArray() name=gtmRemovedItems item=rmItem key=rmItemindex}]
|
||||
[{assign var="d3oItemPrice" value=$rmItem->getPrice()}]
|
||||
[{assign var="gtmBasketItemCategory" value=$rmItem->getCategory()}]
|
||||
{
|
||||
'item_id': '[{$rmItem->getFieldData('oxartnum')}]',
|
||||
'item_name': '[{$rmItem->getFieldData('oxtitle')}]',
|
||||
'item_variant': '[{$rmItem->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': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]',
|
||||
'position': [{$smarty.foreach.gtmRemovedItems.index}]
|
||||
}[{if !$smarty.foreach.gtmRemovedItems.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_remove_from_cart}]
|
||||
[{/if}]
|
||||
[{/block}]
|
50
Application/views/event/view_cart.tpl
Normal file
50
Application/views/event/view_cart.tpl
Normal file
@ -0,0 +1,50 @@
|
||||
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
|
||||
|
||||
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
|
||||
|
||||
[{block name="d3_ga4_view_cart_block"}]
|
||||
[{capture name="d3_ga4_view_cart"}]
|
||||
[{strip}]
|
||||
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')}]',
|
||||
[{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_view_cart}]
|
||||
[{/block}]
|
41
Application/views/event/view_item.tpl
Normal file
41
Application/views/event/view_item.tpl
Normal file
@ -0,0 +1,41 @@
|
||||
[{assign var="gtmProduct" value=$oView->getProduct()}]
|
||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||
|
||||
[{block name="d3_ga4_view_item_block"}]
|
||||
[{capture name="d3_ga4_view_item"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
|
||||
dataLayer.push({
|
||||
'event': 'view_item',
|
||||
'eventLabel':'Product View',
|
||||
'ecommerce':
|
||||
{
|
||||
'currency': '[{$currency->name}]',
|
||||
'items':
|
||||
[
|
||||
{
|
||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
'item_variant': '[{if $gtmProduct->getFieldData("oxvarselect")}][{$gtmProduct->getFieldData("oxvarselect")}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||
'price': [{$d3PriceObject->getPrice()}]
|
||||
}
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_view_item}]
|
||||
[{/block}]
|
45
Application/views/event/view_item_list.tpl
Normal file
45
Application/views/event/view_item_list.tpl
Normal file
@ -0,0 +1,45 @@
|
||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||
[{assign var="gtmCategory" value=$oView->getActiveCategory()}]
|
||||
|
||||
[{assign var="breadCrumb" value=''}]
|
||||
|
||||
[{block name="d3_ga4_view_item_list_block"}]
|
||||
[{if $gtmProducts|@count}]
|
||||
[{capture name="d3_ga4_view_item_list"}]
|
||||
[{strip}]
|
||||
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}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
|
||||
[{/if}]
|
||||
'quantity': 1
|
||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_view_item_list}]
|
||||
[{/if}]
|
||||
[{/block}]
|
44
Application/views/event/view_search_result.tpl
Normal file
44
Application/views/event/view_search_result.tpl
Normal file
@ -0,0 +1,44 @@
|
||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||
|
||||
[{block name="d3_ga4_view_search_result_block"}]
|
||||
[{if $gtmProducts}]
|
||||
[{capture name="d3_ga4_view_search_result"}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'event': 'view_search_result',
|
||||
'eventLabel':'view_search_result[{if $oViewConf->isDebugModeOn()}]_test[{/if}]',
|
||||
'ecommerce': {
|
||||
'search_term': '[{$searchparamforhtml}]',
|
||||
'items': [
|
||||
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||
{
|
||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'item_category': '[{$gtmCategory->getSplitCategoryArray(0, true)}]',
|
||||
'item_category_2':'[{$gtmCategory->getSplitCategoryArray(1, true)}]',
|
||||
'item_category_3':'[{$gtmCategory->getSplitCategoryArray(2, true)}]',
|
||||
'item_category_4':'[{$gtmCategory->getSplitCategoryArray(3, true)}]',
|
||||
'item_list_name':'[{$gtmCategory->getSplitCategoryArray()}]',
|
||||
[{/if}]
|
||||
'quantity': 1
|
||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$smarty.capture.d3_ga4_view_search_result}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
@ -1,56 +0,0 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{assign var="d3ProductObject" value=$oView->getProduct()}]
|
||||
[{assign var="d3PriceObject" value=$d3ProductObject->getPrice()}]
|
||||
|
||||
[{capture assign=d3_ga4_add_to_cart}]
|
||||
[{block name="d3_ga4_add_to_basket"}]
|
||||
$("#toBasket").click(function(event) {
|
||||
|
||||
[{*** Debug cases ***}]
|
||||
[{*event.preventDefault();*}]
|
||||
|
||||
let iArtQuantity = $("#amountToBasket").val();
|
||||
|
||||
dataLayer.push({
|
||||
'isAddToBasket': true,
|
||||
'event':'add_to_cart',
|
||||
'eventLabel': 'add_to_cart',
|
||||
'ecommerce': {
|
||||
'currency': "[{$currency->name}]",
|
||||
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
|
||||
'items': [
|
||||
{
|
||||
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
|
||||
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
'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] || '',
|
||||
'quantity': iArtQuantity
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
});
|
||||
[{/block}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_add_to_cart}]
|
||||
|
||||
[{strip}]
|
||||
[{* variable $gtmProduct is passed from parent tempalte *}]
|
||||
|
||||
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
|
||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||
|
||||
<script>
|
||||
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('/');
|
||||
|
||||
</script>
|
||||
[{/strip}]
|
48
Application/views/ga4/remove_from_cart.tpl
Normal file
48
Application/views/ga4/remove_from_cart.tpl
Normal file
@ -0,0 +1,48 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{block name="d3_ga4_remove_from_cart_block"}]
|
||||
[{if $hasBeenReloaded}]
|
||||
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
|
||||
[{capture assign=d3_ga4_remove_from_cart}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'isRemoveFromCart': true,
|
||||
'event': 'remove_from_cart',
|
||||
'eventLabel':'remove_from_cart',
|
||||
'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=$toRemoveArticles->getArray() name=gtmRemovedItems item=rmItem key=rmItemindex}]
|
||||
[{assign var="d3oItemPrice" value=$rmItem->getPrice()}]
|
||||
[{assign var="gtmBasketItemCategory" value=$rmItem->getCategory()}]
|
||||
{
|
||||
'item_id': '[{$rmItem->getFieldData('oxartnum')}]',
|
||||
'item_name': '[{$rmItem->getFieldData('oxtitle')}]',
|
||||
'item_variant': '[{$rmItem->getFieldData('oxvarselect')}]',
|
||||
[{if $gtmBasketItemCategory}]
|
||||
'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()}]',
|
||||
[{/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': '[{$rmItem->getFieldData('d3AmountThatGotRemoved')}]',
|
||||
'position': [{$smarty.foreach.gtmRemovedItems.index}]
|
||||
}[{if !$smarty.foreach.gtmRemovedItems.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_remove_from_cart}]
|
||||
[{/if}]
|
||||
[{/block}]
|
@ -1,33 +0,0 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||
|
||||
[{if $gtmProducts|@count}]
|
||||
[{strip}]
|
||||
<script>
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'event': 'view_search_result',
|
||||
'eventLabel':'view_search_result',
|
||||
'ecommerce': {
|
||||
'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()}],
|
||||
'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}]
|
@ -1,36 +0,0 @@
|
||||
[{$smarty.block.parent}]
|
||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||
|
||||
[{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}]
|
||||
[{/if}]
|
44
Application/views/ga4/view_search_result.tpl
Normal file
44
Application/views/ga4/view_search_result.tpl
Normal file
@ -0,0 +1,44 @@
|
||||
[{$smarty.block.parent}]
|
||||
|
||||
[{assign var="gtmProducts" value=$oView->getArticleList()}]
|
||||
|
||||
[{block name="d3_ga4_view_search_result_block"}]
|
||||
[{if $gtmProducts}]
|
||||
[{capture assign=d3_ga4_view_search_result}]
|
||||
[{strip}]
|
||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||
dataLayer.push({
|
||||
'event': 'view_search_result',
|
||||
'eventLabel':'view_search_result[{if $oViewConf->isDebugModeOn()}]_test[{/if}]',
|
||||
'ecommerce': {
|
||||
'search_term': '[{$searchparamforhtml}]',
|
||||
'items': [
|
||||
[{foreach from=$gtmProducts name="gtmProducts" item="gtmProduct"}]
|
||||
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
|
||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||
{
|
||||
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
|
||||
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
|
||||
'price': [{$d3PriceObject->getPrice()}],
|
||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||
[{if $gtmCategory}]
|
||||
'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()}]',
|
||||
[{/if}]
|
||||
'quantity': 1
|
||||
}[{if !$smarty.foreach.gtmProducts.last}],[{/if}]
|
||||
[{/foreach}]
|
||||
]
|
||||
}[{if $oViewConf->isDebugModeOn()}],
|
||||
'debug_mode': 'true'
|
||||
[{/if}]
|
||||
});
|
||||
[{/strip}]
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_view_search_result}]
|
||||
[{/if}]
|
||||
[{/block}]
|
18
Application/views/tpl/page/account/d3gtmnoticelist.tpl
Normal file
18
Application/views/tpl/page/account/d3gtmnoticelist.tpl
Normal file
@ -0,0 +1,18 @@
|
||||
[{capture append="oxidBlock_content"}]
|
||||
[{assign var="template_title" value="MY_WISH_LIST"|oxmultilangassign}]
|
||||
<h1 class="page-header">[{oxmultilang ident="MY_WISH_LIST"}]</h1>
|
||||
|
||||
[{if $oView->getNoticeProductList()}]
|
||||
[{include file="widget/product/list.tpl" type="line" listId="noticelistProductList" title="" products=$oView->getNoticeProductList() removeFunction="tonoticelist" owishid=$oxcmp_user->oxuser__oxid->value}]
|
||||
[{else}]
|
||||
<p class="alert alert-info">[{oxmultilang ident="WISH_LIST_EMPTY"}]</p>
|
||||
[{/if}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
||||
|
||||
[{insert name="oxid_tracker" title=$template_title}]
|
||||
[{/capture}]
|
||||
[{capture append="oxidBlock_sidebar"}]
|
||||
[{include file="page/account/inc/account_menu.tpl" active_link="noticelist"}]
|
||||
[{/capture}]
|
||||
[{include file="layout/page.tpl" sidebar="Left"}]
|
@ -0,0 +1,32 @@
|
||||
[{capture append="oxidBlock_content"}]
|
||||
[{assign var="template_title" value="LISTMANIA"|oxmultilangassign}]
|
||||
[{assign var="_actvrecommlist" value=$oView->getActiveRecommList()}]
|
||||
|
||||
<h1 class="page-header">[{oxmultilang ident="LISTMANIA"}]</h1>
|
||||
|
||||
[{if $oView->isSavedList()}]
|
||||
[{assign var="_statusMessage" value="LISTMANIA_LIST_SAVED"|oxmultilangassign}]
|
||||
[{include file="message/success.tpl" statusMessage=$_statusMessage}]
|
||||
[{/if}]
|
||||
|
||||
[{block name="account_redommendationlist_content"}]
|
||||
|
||||
[{include file="form/recommendation_edit.tpl" actvrecommlist=$_actvrecommlist}]
|
||||
|
||||
<hr>
|
||||
|
||||
[{if !$oView->getActiveRecommList()}]
|
||||
[{assign var="blEdit" value=true}]
|
||||
[{include file="page/recommendations/inc/list.tpl"}]
|
||||
[{/if}]
|
||||
[{/block}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
||||
|
||||
[{insert name="oxid_tracker" title=$template_title}]
|
||||
[{/capture}]
|
||||
[{capture append="oxidBlock_sidebar"}]
|
||||
[{include file="page/account/inc/account_menu.tpl" active_link="recommendationlist"}]
|
||||
[{/capture}]
|
||||
[{include file="layout/page.tpl" sidebar="Left"}]
|
||||
|
44
Application/views/tpl/page/account/d3gtmwishlist.tpl
Normal file
44
Application/views/tpl/page/account/d3gtmwishlist.tpl
Normal file
@ -0,0 +1,44 @@
|
||||
[{capture append="oxidBlock_content"}]
|
||||
[{assign var="template_title" value="MY_GIFT_REGISTRY"|oxmultilangassign}]
|
||||
[{if !$oView->getWishListUsers() && $oView->getWishListSearchParam()}]
|
||||
[{assign var="_statusMessage" value="MESSAGE_SORRY_NO_GIFT_REGISTRY"|oxmultilangassign}]
|
||||
[{include file="message/error.tpl" statusMessage=$_statusMessage}]
|
||||
[{/if}]
|
||||
[{assign var="editval" value=$oView->getEnteredData()}]
|
||||
[{if $oView->isWishListEmailSent()}]
|
||||
[{assign var="_statusMessage" value="GIFT_REGISTRY_SENT_SUCCESSFULLY"|oxmultilangassign:$editval->rec_email}]
|
||||
[{include file="message/notice.tpl" statusMessage=$_statusMessage}]
|
||||
[{/if}]
|
||||
|
||||
<h1 class="page-header">[{$oView->getTitle()}]</h1>
|
||||
|
||||
<div class="wishlist-search">
|
||||
[{include file="form/wishlist_search.tpl" searchClass="account_wishlist"}]
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<div class="wishlist">
|
||||
[{if $oView->getWishList()}]
|
||||
[{include file="form/wishlist_publish.tpl"}]
|
||||
<hr>
|
||||
[{include file="form/wishlist_suggest.tpl"}]
|
||||
[{/if}]
|
||||
</div>
|
||||
|
||||
[{if $oView->getWishList()}]
|
||||
[{include file="widget/product/list.tpl" type="line" listId="wishlistProductList" title="" products=$oView->getWishProductList() removeFunction="towishlist" toBasketFunction="tobasket" owishid=$oxcmp_user->oxuser__oxid->value}]
|
||||
[{else}]
|
||||
<p class="alert alert-info">
|
||||
[{oxmultilang ident="GIFT_REGISTRY_EMPTY"}]
|
||||
</p>
|
||||
[{/if}]
|
||||
|
||||
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
|
||||
|
||||
[{insert name="oxid_tracker" title=$template_title}]
|
||||
[{/capture}]
|
||||
[{capture append="oxidBlock_sidebar"}]
|
||||
[{include file="page/account/inc/account_menu.tpl" active_link="wishlist"}]
|
||||
[{/capture}]
|
||||
[{include file="layout/page.tpl" sidebar="Left"}]
|
214
CHANGELOG.md
214
CHANGELOG.md
@ -4,6 +4,220 @@ 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.17.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.0...2.17.1) - 2024-04-10
|
||||
### Fixed
|
||||
- second call of getGtmContainerId() ( returned false )
|
||||
|
||||
## [2.17.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.16.0...2.17.0) - 2024-04-10
|
||||
### Added
|
||||
- Google-Analytics default values
|
||||
- default values switch ( admin module settings )
|
||||
- translations
|
||||
|
||||
## Changed
|
||||
- centralized metadata-id
|
||||
|
||||
## [2.16.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.15.0...2.16.0) - 2024-03-20
|
||||
### Added
|
||||
- ( Google ) Server-Side tagging usability
|
||||
|
||||
## [2.15.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.14.0...2.15.0) - 2024-02-05
|
||||
### Fixed
|
||||
- missing Component-ArticleDetails extension, missing ManufacturerListController extension
|
||||
|
||||
## [2.14.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.13.1...2.14.0) - 2023-01-22
|
||||
### Added
|
||||
- add_to_cart Event to several new shop-pages (landing-page, Account, category article-list, start)
|
||||
- PHPStan code-cleanup
|
||||
### Changed
|
||||
- template structure
|
||||
- code cleanup
|
||||
|
||||
## [2.13.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.13.0...2.13.1) - 2023-01-03
|
||||
### Fixed
|
||||
- error on array-count at zero entries
|
||||
|
||||
## [2.13.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.12.0...2.13.0) - 2023-09-13
|
||||
### Added
|
||||
- extended Docs
|
||||
### Changed
|
||||
- control-param name
|
||||
- control-param function
|
||||
- adjusted check for set control-param
|
||||
- consentmanager-script-adjustments
|
||||
|
||||
## [2.12.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.11.1...2.12.0) - 2023-09-07
|
||||
### Added
|
||||
- cookiebot functionality
|
||||
|
||||
## [2.11.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.10.1...2.11.0) - 2023-08-23
|
||||
### Added
|
||||
- manufacturer extension
|
||||
- working debug_mode
|
||||
### Changed
|
||||
- check for 'article has been removed'
|
||||
- general template cleanup
|
||||
|
||||
## [2.10.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.10.0...2.10.1) - 2023-08-03
|
||||
### Added
|
||||
- missing param to identify the event
|
||||
|
||||
## [2.10.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.9.2...2.10.0) - 2023-08-02
|
||||
### Added
|
||||
- new Event "remove_from_cart"
|
||||
|
||||
## [2.9.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.9.1...2.9.2) - 2023-06-29
|
||||
### Fixed
|
||||
- wrong variable for category-object check
|
||||
|
||||
## [2.9.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.9.0...2.9.1) - 2023-06-27
|
||||
### Fixed
|
||||
- deny method call on no category
|
||||
|
||||
## [2.9.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.8.0...2.9.0) - 2023-06-27
|
||||
### Added
|
||||
- Cookiefirst usability
|
||||
|
||||
## [2.8.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.7.0...2.8.0) - 2023-06-23
|
||||
### Added
|
||||
- Method to get the in order used Payment-Name
|
||||
- Method to get the current Article Category
|
||||
- Following Entries to dedicated event-templates
|
||||
- coupon
|
||||
- paymentType
|
||||
- item_list_name
|
||||
- item_category
|
||||
### Changed
|
||||
- all used template-files have a more dedicated name
|
||||
- general code cleanup
|
||||
|
||||
## [2.7.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.6.0...2.7.0) - 2023-06-19
|
||||
### Changed
|
||||
- add_to_cart event template-structure
|
||||
|
||||
## [2.6.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.5.0...2.6.0) - 2023-05-31
|
||||
### Added
|
||||
- add settings to explicit choose an external service (usercentrics/ consentmanager)
|
||||
- position to block-extension
|
||||
- extended instructions to check for in readme
|
||||
### Fixed
|
||||
- usercentrics script
|
||||
- missing right articleList-getter
|
||||
### Changed
|
||||
- view_item_list-template block extension
|
||||
- cookieManager handling
|
||||
### Removed
|
||||
- additional check for cookieManagerType
|
||||
|
||||
## [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
|
||||
- usercentrics defined script attributes
|
||||
- cookie-manager evaluation
|
||||
### Changed
|
||||
- genuine clean up of base-js-files
|
||||
|
||||
## [2.3.3](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.3.2...2.3.3) - 2023-03-20
|
||||
### Fixed
|
||||
- metadata file path for view_item
|
||||
|
||||
## [2.3.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.2.2...2.3.2) - 2023-03-17
|
||||
### Added
|
||||
- Aggrosoft-Cookie-Consent compatibility
|
||||
### Fixed
|
||||
- wrong function for pageview on thankyou page
|
||||
### Deleted
|
||||
- unused files
|
||||
|
||||
## [2.2.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.2.1...2.2.2) - 2023-02-22
|
||||
### Fixed
|
||||
- price formatting in view_cart
|
||||
|
||||
## [2.2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.1.1...2.2.1) - 2023-02-21
|
||||
### Added
|
||||
- cookie handling
|
||||
|
||||
## [2.1.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.1...2.1.1) - 2023-01-27
|
||||
### Fixed
|
||||
- add missing class import
|
||||
|
||||
## [2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.0...2.1) - 2023-01-27
|
||||
### Added
|
||||
- block section for add_to_basket js
|
||||
- template block order positions
|
||||
|
||||
## [2.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...2.0) - 2023-01-20
|
||||
### Added
|
||||
- using of ContainerFactory in ViewConfig
|
||||
|
||||
## [1.15.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.14.0...1.15.0) - 2024-01-25
|
||||
### Fixed
|
||||
- missing Component-ArticleDetails extension, missing ManufacturerListController extension
|
||||
|
||||
## [1.14.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.13.0...1.14.0) - 2024-01-03
|
||||
### Added
|
||||
- add_to_cart Event to several new shop-pages (landing-page, Account, category article-list, start)
|
||||
- PHPStan code-cleanup
|
||||
### Changed
|
||||
- template structure
|
||||
- code cleanup
|
||||
|
||||
## [1.13.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.12.0...1.13.0) - 2023-09-13
|
||||
### Added
|
||||
- extended Docs
|
||||
### Changed
|
||||
- control-param name
|
||||
- control-param function
|
||||
- adjusted check for set control-param
|
||||
- consentmanager-script-adjustments
|
||||
|
||||
## [1.12.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.11.1...1.12.0) - 2023-09-07
|
||||
### Added
|
||||
- cookiebot functionality
|
||||
|
||||
## [1.11.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.11.0...1.11.1) - 2023-08-17
|
||||
### Fixed
|
||||
- metadata class entry
|
||||
|
||||
## [1.11.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.10.0...1.11.0) - 2023-08-16
|
||||
### Added
|
||||
- remove_from_cart
|
||||
- auto debug_mode setter
|
||||
- manufacturer extension for breadcrumb
|
||||
### Changed
|
||||
- general template cleanup
|
||||
|
||||
## [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
|
||||
### Changed
|
||||
- add_to_cart event template-structure
|
||||
|
||||
## [1.8.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.7.0...1.8.0) - 2023-05-31
|
||||
### Fixed
|
||||
- bug in explicit manager selection
|
||||
|
||||
## [1.7.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.6.0...1.7.0) - 2023-05-31
|
||||
### Added
|
||||
- extended call to read the technical documentation
|
||||
|
18
Docs/CMP/consentmanager.md
Normal file
18
Docs/CMP/consentmanager.md
Normal file
@ -0,0 +1,18 @@
|
||||
# Consentmanager
|
||||
## 1. Steuerungsparameter
|
||||
Tragen Sie hier die gewünschte ID des zu prüfenden Anbieters (Vendor-ID) ein.<br>
|
||||
Diese ID finden Sie in Ihrem Consentmanager-Dashboard, links, unter "CMP > Anbieter".
|
||||
|
||||
Nähere Informationen hierzu suchen Sie bitte auf der offiziellen Webseite von [app.consentmanager](https://help.consentmanager.de/books/cmp/page/4-configuring-vendors-and-cookies).
|
||||
|
||||
## 2. Gebräuchliche ID's
|
||||
- s26 (Google Analytics/ GA/ GA4)
|
||||
- s905 (Google Tag Manager/ GTM)
|
||||
|
||||
## 3. Einrichtung GTM
|
||||
Die von Ihnen eingetragene ID muss oder ist schlussendlich die ID, auf die im GTM-Umfeld geprüft wird.
|
||||
Das heißt, dass sich die Eintragung nach GTM, oder umgekehrt, richtet.
|
||||
|
||||
### Unterstützung benötigt?
|
||||
Kein Problem!
|
||||
Kontaktieren Sie uns gern unter [d3data.de](https://www.d3data.de)
|
@ -1,36 +1,16 @@
|
||||
# Technische Doku
|
||||
## GA4 Events / Customizing
|
||||
Für alle implementierten GA4 Events existieren Templates unter `source/modules/d3/googleanalytics4/Application/views/ga4/`, dabei entspricht der Dateiname dem Eventnamen in GA4.
|
||||
Für alle implementierten GA4 Events existieren Templates unter `source/modules/d3/googleanalytics4/Application/views/event/`, dabei entspricht der Dateiname dem Eventnamen in GA4.
|
||||
Die Einbindung dieser Event-Templates erfolgt über TPL-Blöcke unter `source/modules/d3/googleanalytics4/Application/views/blocks/`.
|
||||
*Hinweis: nicht alle templates sind bereits gefüllt. Wünschen Sie die Implementierung eines unausgefüllten templates?
|
||||
Kommen Sie auf uns zu unter https://www.d3data.de/
|
||||
|
||||
## Blöcke
|
||||
Für den geregelten Ablauf sind folgende Blöcke nötig:
|
||||
- Suchergebnisse
|
||||
- Blockname: search_results
|
||||
- Datei: page/search/search.tpl
|
||||
- GA4 Event: view_search_results
|
||||
- Artikelliste
|
||||
- Blockname: page_list_productlist (muss hinzugefügt werden)
|
||||
- Datei: page/list/list.tpl
|
||||
- GA4 Event: view_item_list
|
||||
- Detailseite
|
||||
- Blockname: details_productmain_title
|
||||
- Datei: page/details/inc/productmain.tpl
|
||||
- GA4 Event: view_item
|
||||
- dem WK hinzufügen (button)
|
||||
- Blockname: details_productmain_tobasket
|
||||
- Datei: page/details/inc/productmain.tpl
|
||||
- GA4 Event: add_to_cart
|
||||
- Warenkorb
|
||||
- Blockname: checkout_basket_main
|
||||
- Datei: page/checkout/basket.tpl
|
||||
- GA4 Event: view_cart
|
||||
- abgeschlossener Kauf
|
||||
- Blockname: checkout_thankyou_main
|
||||
- Datei: page/checkout/thankyou.tpl
|
||||
- GA4 Event: purchase
|
||||
## Steuerungsparameter
|
||||
Tragen Sie hier im Normalfall die ID des zu prüfenden Cookies ein.
|
||||
In bestimmten Fällen, müssen Sie hier alternative Werte eintragen. Diese Fälle sind bedingt
|
||||
nach der gewählten CMP (Consent Manager Platform).
|
||||
|
||||
> nähere Infos unter [CMP](#consent-manager-platform-cmp)
|
||||
|
||||
## Verfügbare Datalayer Variablen
|
||||
Für die einfachste Übersicht der enthaltenen Daten empfehle ich den Vorschau-Modus vom Google Tag Manager.
|
||||
@ -50,6 +30,9 @@ Dann tragen Sie in den Folgeeinstellungen unter "Cookie Manager Einstellungen",
|
||||
die Cookie-ID des zugehörigen Cookies ein.
|
||||
Aktivieren Sie anschließend diese Weiche. Setzen Sie den Haken bei "Eigenen Cookie Manager nutzen?".
|
||||
|
||||
## Consent Manager Platform (CMP)
|
||||
- [Consentmanager](https://git.d3data.de/D3Public/GoogleAnalytics4/src/branch/master/Docs/CMP/consentmanager.md)
|
||||
|
||||
### Unterstützung für
|
||||
- [aggrosoft - oxid-cookie-compliance](https://github.com/aggrosoft/oxid-cookie-compliance)
|
||||
- https://github.com/aggrosoft/oxid-cookie-compliance
|
||||
@ -65,4 +48,18 @@ Aktivieren Sie anschließend diese Weiche. Setzen Sie den Haken bei "Eigenen Coo
|
||||
- [OXID Cookie Management powered by usercentrics](https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html)
|
||||
- In der Usercentrics-Verwaltung die Services "Google Analytics" und "Google Tag Manager" anlegen
|
||||
- Den Service ```Google Tag Manager``` in den Moduleinstellungen des 'Google Analytics 4' unter
|
||||
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
||||
Google Tag Manager eintragen
|
||||
|
||||
- [Consent Management Provider](https://www.consentmanager.net/)
|
||||
- In der Consentmanager-Oberfläche den Anbieter "Google Tag Manager" mit der ID s905 hinzufügen
|
||||
- Im Frontend, im consentmanager-Pop-up nach dem 'Google Tag Manager' suchen
|
||||
- kleines Fragezeichen neben den Namen anklicken und ganz runter scrollen
|
||||
- prüfen, ob ein Cookie vorgegeben ist
|
||||
- sonst, in der Consentmanager-Oberfläche Cookie-Liste entsprechendes Cookie suchen und im Admin unter
|
||||
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
||||
|
||||
- [Cookiefirst](https://cookiefirst.com)
|
||||
- im Cookiefirst-Hub das jeweilige Cookie finden underen zugeordnete Kategorie kopieren
|
||||
- die kopierte Kategory wird nun in den Einstellungen des Moduls hinterlegt:
|
||||
```Erweiterungen > Module > Google Analytics 4 > Einstell. > Cookie Manager Einstellungen > Steuerungsparameter (vormals CookieID)```
|
||||
- **Wichtig!** bei Nutzung des Consent-Managers von Google, muss zwangsläufig die Einstellung "Cookie manager Nutzen?" __ausgeschalten!__ werden
|
@ -16,3 +16,53 @@
|
||||
namespace D3\GoogleAnalytics4\Modules\Core{
|
||||
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 {}
|
||||
class Manufacturer_parent extends \OxidEsales\Eshop\Application\Model\Manufacturer {}
|
||||
}
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller{
|
||||
|
||||
use OxidEsales\Eshop\Application\Controller\AccountNoticeListController;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountRecommlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountWishlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\Admin\ManufacturerController;
|
||||
use OxidEsales\Eshop\Application\Controller\ArticleListController;
|
||||
use OxidEsales\Eshop\Application\Controller\SearchController;
|
||||
use OxidEsales\Eshop\Application\Controller\StartController;
|
||||
|
||||
class BasketController_parent extends \OxidEsales\Eshop\Application\Controller\BasketController {}
|
||||
class ThankYouController_parent extends \OxidEsales\Eshop\Application\Controller\ThankYouController {}
|
||||
|
||||
class ArticleListController_AddToCartHelpMethods_parent extends ArticleListController {}
|
||||
|
||||
class ArticleDetailsController_parent extends \OxidEsales\Eshop\Application\Controller\ArticleDetailsController {}
|
||||
|
||||
class d3GtmAccountNoticeListController_parent extends AccountNoticeListController {}
|
||||
|
||||
class d3GtmAccountRecommlistController_parent extends AccountRecommlistController {}
|
||||
|
||||
class d3GtmAccountWishlistController_parent extends AccountWishlistController {}
|
||||
|
||||
class d3GtmStartController_parent extends StartController {}
|
||||
|
||||
class d3GtmSearchController_parent extends SearchController {}
|
||||
|
||||
class d3GtmManufacturerListController_parent extends ManufacturerController {}
|
||||
}
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Component{
|
||||
|
||||
use OxidEsales\Eshop\Application\Component\BasketComponent;
|
||||
|
||||
class d3GtmBasketComponentExtension_parent extends BasketComponent {}
|
||||
}
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget{
|
||||
|
||||
use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails;
|
||||
|
||||
class d3GtmWidgetArticleDetails_parent extends ArticleDetails {}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget;
|
||||
|
||||
|
||||
class d3GtmWidgetArticleDetails extends d3GtmWidgetArticleDetails_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,77 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Component;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Article;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
|
||||
class d3GtmBasketComponentExtension extends d3GtmBasketComponentExtension_parent
|
||||
{
|
||||
/**
|
||||
* @param $sProductId
|
||||
* @param $dAmount
|
||||
* @param $aSel
|
||||
* @param $aPersParam
|
||||
* @param $blOverride
|
||||
* @return mixed|string
|
||||
* @throws \Exception
|
||||
*/
|
||||
public function toBasket($sProductId = null, $dAmount = null, $aSel = null, $aPersParam = null, $blOverride = false)
|
||||
{
|
||||
$return = parent::toBasket($sProductId, $dAmount, $aSel, $aPersParam, $blOverride);
|
||||
|
||||
Registry::getSession()->setVariable('d3GtmAddToBasketTrigger', true);
|
||||
|
||||
$iAmountArticlesAddedToCart = (int) Registry::getRequest()->getRequestEscapedParameter('am');
|
||||
|
||||
if ($iAmountArticlesAddedToCart){
|
||||
Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', $iAmountArticlesAddedToCart);
|
||||
}else{
|
||||
Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', 1);
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return int
|
||||
*/
|
||||
public function getD3GtmAddToCartAmountArticles() :int
|
||||
{
|
||||
$iAmount = Registry::getSession()->getVariable('d3GtmAddToCartAmountArticles');
|
||||
|
||||
Registry::getSession()->deleteVariable('d3GtmAddToCartAmountArticles');
|
||||
|
||||
return (int) $iAmount;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function getAddToBasketDecision() :bool
|
||||
{
|
||||
$decision = Registry::getSession()->getVariable('d3GtmAddToBasketTrigger');
|
||||
|
||||
Registry::getSession()->setVariable('d3GtmAddToBasketTrigger', false);
|
||||
|
||||
return (bool) $decision;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Article|null
|
||||
*/
|
||||
public function d3GtmRequestedArticleLoadedByAnid()
|
||||
{
|
||||
$sAnid = Registry::getRequest()->getRequestEscapedParameter('anid');
|
||||
|
||||
$oArticle = null;
|
||||
|
||||
if ($sAnid){
|
||||
/** @var Article $oArticle */
|
||||
$oArticle = oxNew(Article::class);
|
||||
$oArticle->load($sAnid);
|
||||
}
|
||||
|
||||
return $oArticle;
|
||||
}
|
||||
}
|
15
Modules/Application/Controller/ArticleDetailsController.php
Normal file
15
Modules/Application/Controller/ArticleDetailsController.php
Normal file
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class ArticleDetailsController extends ArticleDetailsController_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class ArticleListController_AddToCartHelpMethods extends ArticleListController_AddToCartHelpMethods_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$render = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $render;
|
||||
}
|
||||
}
|
123
Modules/Application/Controller/BasketController.php
Normal file
123
Modules/Application/Controller/BasketController.php
Normal file
@ -0,0 +1,123 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
use OxidEsales\Eshop\Application\Component\BasketComponent;
|
||||
use OxidEsales\Eshop\Application\Model\Article;
|
||||
use OxidEsales\Eshop\Application\Model\ArticleList;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use oxSystemComponentException;
|
||||
|
||||
class BasketController extends BasketController_parent
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->d3GA4getRemovedArticlesListObject();
|
||||
|
||||
return $return;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
* @throws oxSystemComponentException
|
||||
*/
|
||||
public function d3GA4getRemovedArticlesListObject() :void
|
||||
{
|
||||
$this->addTplParam('hasBeenReloaded', false);
|
||||
// collecting items to add
|
||||
$aProducts = Registry::getRequest()->getRequestEscapedParameter('aproducts');
|
||||
|
||||
// collecting specified item
|
||||
$sProductId = Registry::getRequest()->getRequestEscapedParameter('aid');
|
||||
if ($sProductId) {
|
||||
// additionally fetching current product info
|
||||
$dAmount = Registry::getRequest()->getRequestEscapedParameter('am');
|
||||
|
||||
// select lists
|
||||
$aSel = Registry::getRequest()->getRequestEscapedParameter('sel');
|
||||
|
||||
/** @var BasketComponent $oBasketComponent */
|
||||
$oBasketComponent = $this->getComponent('oxcmp_basket');
|
||||
|
||||
$aPersParam = $oBasketComponent->__call('getPersistedParameters', []);
|
||||
|
||||
$sBasketItemId = Registry::getRequest()->getRequestEscapedParameter('bindex');
|
||||
|
||||
$aProducts[$sProductId] = [
|
||||
'am' => $dAmount,
|
||||
'sel' => $aSel,
|
||||
'persparam' => $aPersParam,
|
||||
'basketitemid' => $sBasketItemId
|
||||
];
|
||||
}
|
||||
|
||||
if (is_array($aProducts) && count($aProducts)) {
|
||||
$toRemoveArticleIdList = [];
|
||||
$artIdOnArtAmountList = [];
|
||||
|
||||
if ($this->isArticleRemovedState($aProducts)) {
|
||||
//setting amount to 0 if removing article from basket
|
||||
foreach ($aProducts as $sProductId => $aProduct) {
|
||||
if ((isset($aProduct['remove']) && $aProduct['remove']) or intval($aProduct['am']) === 0) {
|
||||
if (!in_array($aProduct, $toRemoveArticleIdList)) {
|
||||
$toRemoveArticleIdList[] = $aProduct['aid'];
|
||||
$artIdOnArtAmountList[$aProduct['aid']] = $aProduct['am'];
|
||||
}
|
||||
|
||||
$aProducts[$sProductId]['am'] = 0;
|
||||
#for GA4 Event
|
||||
$this->addTplParam('hasBeenReloaded', true);
|
||||
} else {
|
||||
unset($aProducts[$sProductId]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$oArtList = oxNew(ArticleList::class);
|
||||
$oArtList->loadIds($toRemoveArticleIdList);
|
||||
|
||||
#dumpVar($this->getBasketArticles());
|
||||
|
||||
/** @var Article $item */
|
||||
foreach ($oArtList->getArray() as $item){
|
||||
foreach ($artIdOnArtAmountList as $artId => $artAmount){
|
||||
if ($item->getId() === $artId){
|
||||
$item->assign(['d3AmountThatGotRemoved' => $artAmount]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->addTplParam('toRemoveArticles', $oArtList);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @return bool
|
||||
*
|
||||
* checks, if we're in the short state of "an Article has been removed"
|
||||
* We check by looking for the "'removeBtn' is not null", as a sign for it has been triggered/ clicked
|
||||
* if that doesn't work, we check if there's an Article in the Products array, that has "'am' = 0"
|
||||
* Which also shows we're in that state rn
|
||||
*/
|
||||
protected function isArticleRemovedState(array $productsArray) :bool
|
||||
{
|
||||
if (Registry::getRequest()->getRequestEscapedParameter('removeBtn')
|
||||
or Registry::getRequest()->getRequestEscapedParameter('updateBtn')
|
||||
){
|
||||
return true;
|
||||
}else{
|
||||
foreach ($productsArray as $aProduct) {
|
||||
if (intval($aProduct['am']) === 0) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
25
Modules/Application/Controller/ThankYouController.php
Normal file
25
Modules/Application/Controller/ThankYouController.php
Normal file
@ -0,0 +1,25 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Country;
|
||||
use OxidEsales\Eshop\Application\Model\Order;
|
||||
|
||||
class ThankYouController extends ThankYouController_parent
|
||||
{
|
||||
/**
|
||||
* @return Country
|
||||
*/
|
||||
public function d3GAGetUserCountry()
|
||||
{
|
||||
/** @var Order $oOrder */
|
||||
$oOrder = $this->getOrder();
|
||||
$sCountryId = $oOrder->getFieldData('oxbillcountryid');
|
||||
|
||||
/** @var Country $oCountry */
|
||||
$oCountry = oxNew(Country::class);
|
||||
$oCountry->load($sCountryId);
|
||||
|
||||
return $oCountry;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class d3GtmAccountNoticeListController extends d3GtmAccountNoticeListController_parent
|
||||
{
|
||||
protected $_sThisTemplate = 'page/account/d3gtmnoticelist.tpl';
|
||||
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class d3GtmAccountRecommlistController extends d3GtmAccountRecommlistController_parent
|
||||
{
|
||||
protected $_sThisTemplate = 'page/account/d3gtmrecommendationlist.tpl';
|
||||
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,17 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class d3GtmAccountWishlistController extends d3GtmAccountWishlistController_parent
|
||||
{
|
||||
protected $_sThisTemplate = 'page/account/d3gtmwishlist.tpl';
|
||||
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
|
||||
class d3GtmManufacturerListController extends d3GtmManufacturerListController_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
23
Modules/Application/Controller/d3GtmSearchController.php
Normal file
23
Modules/Application/Controller/d3GtmSearchController.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
|
||||
class d3GtmSearchController extends d3GtmSearchController_parent
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
if (false === in_array('oxcmp_basket', $this->getComponents())){
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
19
Modules/Application/Controller/d3GtmStartController.php
Normal file
19
Modules/Application/Controller/d3GtmStartController.php
Normal file
@ -0,0 +1,19 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Controller;
|
||||
|
||||
class d3GtmStartController extends d3GtmStartController_parent
|
||||
{
|
||||
public function render()
|
||||
{
|
||||
$return = parent::render();
|
||||
|
||||
if (false === in_array('oxcmp_basket', $this->getComponents())){
|
||||
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
|
||||
}
|
||||
|
||||
return $return;
|
||||
}
|
||||
}
|
23
Modules/Application/Model/Basket.php
Normal file
23
Modules/Application/Model/Basket.php
Normal file
@ -0,0 +1,23 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
||||
|
||||
use OxidEsales\Eshop\Application\Model\Payment;
|
||||
|
||||
class Basket extends Basket_parent
|
||||
{
|
||||
/**
|
||||
* @return string
|
||||
*/
|
||||
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!";
|
||||
}
|
||||
}
|
44
Modules/Application/Model/Category.php
Normal file
44
Modules/Application/Model/Category.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
||||
|
||||
class Category extends Category_parent
|
||||
{
|
||||
/**
|
||||
* @param int $indexOfArray
|
||||
* @return string
|
||||
*/
|
||||
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
|
||||
{
|
||||
if ($bShallTakeStd){
|
||||
$splitCatArray =
|
||||
array_values(
|
||||
array_filter(
|
||||
explode(
|
||||
'/',
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
|
||||
return $splitCatArray[$indexOfArray];
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
44
Modules/Application/Model/Manufacturer.php
Normal file
44
Modules/Application/Model/Manufacturer.php
Normal file
@ -0,0 +1,44 @@
|
||||
<?php
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Application\Model;
|
||||
|
||||
class Manufacturer extends Manufacturer_parent
|
||||
{
|
||||
/**
|
||||
* @param int $indexOfArray
|
||||
* @return string
|
||||
*/
|
||||
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
|
||||
{
|
||||
if ($bShallTakeStd){
|
||||
$splitCatArray =
|
||||
array_values(
|
||||
array_filter(
|
||||
explode(
|
||||
'/',
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
|
||||
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
|
||||
return $splitCatArray[$indexOfArray];
|
||||
}else{
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
return
|
||||
trim(
|
||||
parse_url(
|
||||
$this->getLink(),
|
||||
5
|
||||
)
|
||||
);
|
||||
}
|
||||
}
|
@ -12,9 +12,16 @@
|
||||
|
||||
namespace D3\GoogleAnalytics4\Modules\Core;
|
||||
|
||||
use D3\GoogleAnalytics4\Application\Model\Constants;
|
||||
use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
|
||||
use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
|
||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||
use OxidEsales\Eshop\Core\Config;
|
||||
use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\Eshop\Application\Model\User;use OxidEsales\Eshop\Core\Registry;
|
||||
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
|
||||
use Psr\Container\ContainerExceptionInterface;
|
||||
use Psr\Container\NotFoundExceptionInterface;
|
||||
|
||||
class ViewConfig extends ViewConfig_parent
|
||||
{
|
||||
@ -27,54 +34,33 @@ class ViewConfig extends ViewConfig_parent
|
||||
{
|
||||
if ($this->sContainerId === null)
|
||||
{
|
||||
|
||||
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_sContainerID');
|
||||
$this->sContainerId = ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_sContainerID', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
return $this->sContainerId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return mixed
|
||||
* @return 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()
|
||||
public function defineCookieManagerType() :void
|
||||
{
|
||||
if ($this->sCookieManagerType === null)
|
||||
{
|
||||
$this->sCookieManagerType = false;
|
||||
|
||||
$allowedManagerTypes = [
|
||||
'net_cookie_manager',
|
||||
'agcookiecompliance',
|
||||
'oxps_usercentrics'
|
||||
];
|
||||
|
||||
foreach ($allowedManagerTypes as $type) {
|
||||
if ($this->isModuleActive($type)) {
|
||||
$this->sCookieManagerType = $type;
|
||||
break;
|
||||
}
|
||||
}
|
||||
/** @var ManagerHandler $oManagerHandler */
|
||||
$oManagerHandler = oxNew(ManagerHandler::class);
|
||||
$this->sCookieManagerType = $oManagerHandler->getCurrManager();
|
||||
}
|
||||
}
|
||||
|
||||
if ($this->sCookieManagerType === false and $this->getExplicitManager()){
|
||||
return "externalService";
|
||||
}
|
||||
|
||||
return $this->sCookieManagerType;
|
||||
/**
|
||||
* @return bool
|
||||
*/
|
||||
public function shallUseOwnCookieManager() :bool
|
||||
{
|
||||
return (bool) Registry::getConfig()->getConfigParam('d3_gtm_settings_hasOwnCookieManager');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -86,29 +72,39 @@ class ViewConfig extends ViewConfig_parent
|
||||
$oConfig = Registry::getConfig();
|
||||
|
||||
// No Cookie Manager in use
|
||||
if (!$oConfig->getConfigParam('d3_gtm_settings_hasOwnCookieManager')) {
|
||||
if (!$this->shallUseOwnCookieManager()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$sCookieID = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||
$this->defineCookieManagerType();
|
||||
|
||||
$sCookieID = trim($oConfig->getConfigParam('d3_gtm_settings_controlParameter'));
|
||||
|
||||
// Netensio Cookie Manager
|
||||
if ($this->getCookieManagerType() == "net_cookie_manager") {
|
||||
if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) {
|
||||
$oSession = Registry::getSession();
|
||||
$aCookies = $oSession->getVariable("aCookieSel");
|
||||
|
||||
return (!is_null($aCookies) && is_array($aCookies) && array_key_exists($sCookieID, $aCookies) && $aCookies[$sCookieID] == "1");
|
||||
return (is_array($aCookies) && array_key_exists($sCookieID, $aCookies) && $aCookies[$sCookieID] == "1");
|
||||
}
|
||||
|
||||
// Aggrosoft Cookie Consent
|
||||
if ($this->getCookieManagerType() == "agcookiecompliance") {
|
||||
if ($this->sCookieManagerType === ManagerTypes::AGCOOKIECOMPLIANCE) {
|
||||
if (method_exists($this, "isCookieCategoryEnabled")) {
|
||||
return $this->isCookieCategoryEnabled($sCookieID);
|
||||
}
|
||||
}
|
||||
|
||||
// UserCentrics or consentmanager
|
||||
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getCookieManagerType() === 'externalService') {
|
||||
if (
|
||||
$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::COOKIEBOT
|
||||
or $this->sCookieManagerType === ManagerTypes::EXTERNAL_SERVICE
|
||||
)
|
||||
{
|
||||
// Always needs the script-tags delivered to the DOM.
|
||||
return true;
|
||||
}
|
||||
@ -122,29 +118,33 @@ class ViewConfig extends ViewConfig_parent
|
||||
* This is especially important for UserCentrics.
|
||||
* @return string
|
||||
*/
|
||||
public function getGtmScriptAttributes()
|
||||
public function getGtmScriptAttributes() :string
|
||||
{
|
||||
$oConfig = Registry::getConfig();
|
||||
$sControlParameter = trim(Registry::getConfig()->getConfigParam('d3_gtm_settings_controlParameter'));
|
||||
|
||||
if ($this->getCookieManagerType() === "oxps_usercentrics" or $this->getExplicitManager() === 'USERCENTRICS') {
|
||||
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||
|
||||
if ($sCookieId) {
|
||||
return 'data-usercentrics="' . $sCookieId . '" type="text/plain" async=""';
|
||||
}
|
||||
if (false === $this->shallUseOwnCookieManager() or ($sControlParameter === '')){
|
||||
return "";
|
||||
}
|
||||
|
||||
if ($this->getCookieManagerType() === "externalService" and $this->getExplicitManager() === 'CONSENTMANAGER') {
|
||||
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||
if (
|
||||
$this->sCookieManagerType === ManagerTypes::USERCENTRICS_MODULE
|
||||
or $this->sCookieManagerType === ManagerTypes::USERCENTRICS_MANUALLY
|
||||
)
|
||||
{
|
||||
return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""';
|
||||
}
|
||||
|
||||
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"
|
||||
';
|
||||
}
|
||||
if ($this->sCookieManagerType === ManagerTypes::CONSENTMANAGER)
|
||||
{
|
||||
return 'type="text/plain" class="cmplazyload" data-cmp-vendor="'.$sControlParameter.'"';
|
||||
}
|
||||
|
||||
if ($this->sCookieManagerType === ManagerTypes::COOKIEFIRST){
|
||||
return 'type="text/plain" data-cookiefirst-category="' . $sControlParameter .'"';
|
||||
}
|
||||
|
||||
if ($this->sCookieManagerType === ManagerTypes::COOKIEBOT){
|
||||
return 'type="text/plain" data-cookieconsent="' . $sControlParameter .'"';
|
||||
}
|
||||
|
||||
return "";
|
||||
@ -152,23 +152,38 @@ class ViewConfig extends ViewConfig_parent
|
||||
|
||||
private $blGA4enabled = null;
|
||||
|
||||
/**
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function isGA4enabled()
|
||||
{
|
||||
if ($this->blGA4enabled === null)
|
||||
{
|
||||
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_blEnableGA4');
|
||||
$this->sContainerId = ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_blEnableGA4', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
|
||||
return $this->blGA4enabled;
|
||||
}
|
||||
|
||||
public function isGtmConsentModeSetActivated() :bool
|
||||
{
|
||||
return $this->sContainerId = ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_blActivateConsentMode', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
|
||||
public function getGtmDataLayer()
|
||||
{
|
||||
if (!$this->getGtmContainerId()) return "[]";
|
||||
|
||||
$oConfig = Registry::getConfig();
|
||||
$oView = $oConfig->getTopActiveView();
|
||||
/** @var FrontendController $oShop */
|
||||
/** @var User|false|null $oUser */
|
||||
$oUser = $oConfig->getUser();
|
||||
|
||||
$cl = $this->getTopActiveClassName();
|
||||
@ -191,17 +206,48 @@ class ViewConfig extends ViewConfig_parent
|
||||
'title' => $oView->getTitle(),
|
||||
'cl' => $cl,
|
||||
],
|
||||
'userid' => ($oUser ? $oUser->getId() : false),
|
||||
'sessionid' => session_id() ?? false,
|
||||
'userid' => $oUser instanceof User ? $oUser->getId() : false,
|
||||
'sessionid' => session_id(),
|
||||
//'httpref' => $_SERVER["HTTP_REFERER"] ?? "unknown"
|
||||
];
|
||||
|
||||
return json_encode([$dataLayer], JSON_PRETTY_PRINT);
|
||||
}
|
||||
|
||||
public function isDebugModeOn() :bool
|
||||
{
|
||||
return Registry::getConfig()->getConfigParam('d3_gtm_blEnableDebug');
|
||||
}
|
||||
|
||||
public function isPromotionList($listId)
|
||||
{
|
||||
$oConfig = Registry::getConfig();
|
||||
$aPromotionListIds = $oConfig->getConfigParam("") ?? ['bargainItems', 'newItems', 'topBox', 'alsoBought', 'accessories', 'cross'];
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getServerSidetaggingJsDomain() :string
|
||||
{
|
||||
return ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_settings_serversidetagging_js', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return string
|
||||
* @throws ContainerExceptionInterface
|
||||
* @throws NotFoundExceptionInterface
|
||||
*/
|
||||
public function getServerSidetaggingNoJsDomain() :string
|
||||
{
|
||||
return ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('d3_gtm_settings_serversidetagging_nojs', Constants::OXID_MODULE_ID);
|
||||
}
|
||||
}
|
@ -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.
|
||||
|
||||
```bash
|
||||
php composer require d3/google-analytics4:^1
|
||||
php composer require d3/google-analytics4:^2
|
||||
```
|
||||
|
||||
Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code auszuführen.
|
||||
|
||||
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||
|
||||
> ### Wichtig!
|
||||
> 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"!
|
||||
### Wichtig!
|
||||
Bitte stellen Sie sicher, dass die nötigen Template-Blöcke im OXID-Shop zur Verfügung stehen.
|
||||
Lesen Sie mehr in der [technischen Doku](./Docs/README.md) unter "Blöcke"!
|
||||
|
||||
## Verwendung
|
||||
### Grundfunktionalität
|
||||
|
@ -45,9 +45,9 @@
|
||||
},
|
||||
"require": {
|
||||
"php": ">=7.1",
|
||||
"oxid-esales/oxideshop-ce": "v6.0 - 6.3",
|
||||
"google/apiclient":" ^2.0"
|
||||
},
|
||||
"oxid-esales/oxideshop-ce": "^6.5",
|
||||
"google/apiclient":" ^2.0",
|
||||
"phpstan/phpstan": "^1.10" },
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"D3\\GoogleAnalytics4\\": "../../../source/modules/d3/googleanalytics4"
|
||||
|
133
metadata.php
133
metadata.php
@ -1,10 +1,42 @@
|
||||
<?php
|
||||
|
||||
use D3\GoogleAnalytics4\Application\Model\Constants as Constants;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Component\d3GtmBasketComponentExtension;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Component\Widget\d3GtmWidgetArticleDetails as d3GtmWidgetArticleDetails;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\ArticleDetailsController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\ArticleListController_AddToCartHelpMethods;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\BasketController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountNoticeListController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountRecommlistController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmAccountWishlistController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmManufacturerListController as d3GtmManufacturerListController;
|
||||
use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmSearchController;
|
||||
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\Manufacturer as Manufacturer;
|
||||
use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
|
||||
use OxidEsales\Eshop\Application\Component\BasketComponent as OEBasketComponent;
|
||||
use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails as OEArticleDetails;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountNoticeListController as OEAccountNoticeListController;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountRecommlistController as OEAccountRecommlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\AccountWishlistController as OEAccountWishlistController;
|
||||
use OxidEsales\Eshop\Application\Controller\ArticleDetailsController as OEArticleDetailsController;
|
||||
use OxidEsales\Eshop\Application\Controller\ArticleListController as OEArticleListController;
|
||||
use OxidEsales\Eshop\Application\Controller\BasketController as OEBasketController;
|
||||
use OxidEsales\Eshop\Application\Controller\ManufacturerListController as OEManufacturerListController;
|
||||
use OxidEsales\Eshop\Application\Controller\SearchController as OESearchController;
|
||||
use OxidEsales\Eshop\Application\Controller\StartController as OEStartController;
|
||||
use OxidEsales\Eshop\Application\Controller\ThankYouController as OEThankYouController;
|
||||
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\Core\ViewConfig as OEViewConfig;
|
||||
|
||||
$sMetadataVersion = '2.1';
|
||||
$aModule = [
|
||||
'id' => 'd3googleanalytics4',
|
||||
'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.<br>
|
||||
@ -17,18 +49,50 @@ $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' => '1.7.0',
|
||||
'version' => '2.17.1',
|
||||
'author' => 'Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
'extend' => [
|
||||
OEViewConfig::class => ViewConfig::class
|
||||
// Core
|
||||
OEViewConfig::class => ViewConfig::class,
|
||||
|
||||
// Model
|
||||
OECategory::class => Category::class,
|
||||
OEBasket::class => Basket::class,
|
||||
OEManufacturer::class => Manufacturer::class,
|
||||
|
||||
// Controller
|
||||
OEBasketController::class => BasketController::class,
|
||||
OEThankYouController::class => ThankYouController::class,
|
||||
OEArticleListController::class => ArticleListController_AddToCartHelpMethods::class,
|
||||
OEArticleDetailsController::class => ArticleDetailsController::class,
|
||||
OEAccountNoticeListController::class => d3GtmAccountNoticeListController::class,
|
||||
OEAccountRecommlistController::class => d3GtmAccountRecommlistController::class,
|
||||
OEAccountWishlistController::class => d3GtmAccountWishlistController::class,
|
||||
OEStartController::class => d3GtmStartController::class,
|
||||
OESearchController::class => d3GtmSearchController::class,
|
||||
OEManufacturerListController::class => d3GtmManufacturerListController::class,
|
||||
|
||||
// Component
|
||||
OEArticleDetails::class => d3GtmWidgetArticleDetails::class,
|
||||
OEBasketComponent::class => d3GtmBasketComponentExtension::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',
|
||||
// Event files that store the GA4 Event-Information
|
||||
'event/add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/event/add_to_cart.tpl',
|
||||
'event/view_item.tpl' => 'd3/googleanalytics4/Application/views/event/view_item.tpl',
|
||||
'event/view_cart.tpl' => 'd3/googleanalytics4/Application/views/event/view_cart.tpl',
|
||||
'event/purchase.tpl' => 'd3/googleanalytics4/Application/views/event/purchase.tpl',
|
||||
'event/view_item_list.tpl' => 'd3/googleanalytics4/Application/views/event/view_item_list.tpl',
|
||||
'event/view_search_result.tpl' => 'd3/googleanalytics4/Application/views/event/view_search_result.tpl',
|
||||
'event/remove_from_cart.tpl' => 'd3/googleanalytics4/Application/views/event/remove_from_cart.tpl',
|
||||
|
||||
// complete overwritten file of OXID-Originals
|
||||
// the path of the template-name is the original path to the file in OXID-context from tpl/->
|
||||
'page/account/d3gtmnoticelist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmnoticelist.tpl',
|
||||
'page/account/d3gtmrecommendationlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmrecommendationlist.tpl',
|
||||
'page/account/d3gtmwishlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmwishlist.tpl',
|
||||
],
|
||||
'blocks' => [
|
||||
// tag manager js
|
||||
@ -55,33 +119,52 @@ $aModule = [
|
||||
[
|
||||
'template' => 'page/checkout/basket.tpl',
|
||||
'block' => 'checkout_basket_main',
|
||||
'file' => '/Application/views/blocks/checkout_s1.tpl'
|
||||
'file' => '/Application/views/blocks/view_cart.tpl'
|
||||
],
|
||||
[
|
||||
'template' => 'page/checkout/thankyou.tpl',
|
||||
'block' => 'checkout_thankyou_main',
|
||||
'file' => '/Application/views/blocks/checkout_s5.tpl'
|
||||
'file' => '/Application/views/blocks/purchase.tpl'
|
||||
],
|
||||
// Lists
|
||||
// view_item_list
|
||||
[
|
||||
'template' => 'page/list/list.tpl',
|
||||
'block' => 'page_list_productlist',
|
||||
'file' => '/Application/views/ga4/view_item_list.tpl',
|
||||
'file' => '/Application/views/blocks/view_item_list.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
// view_search_result
|
||||
[
|
||||
'template' => 'page/search/search.tpl',
|
||||
'block' => 'search_results',
|
||||
'file' => '/Application/views/ga4/search.tpl',
|
||||
'file' => '/Application/views/blocks/view_search_result.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
// add_to_cart
|
||||
[
|
||||
'template' => 'page/details/inc/productmain.tpl',
|
||||
'block' => 'details_productmain_tobasket',
|
||||
'file' => '/Application/views/ga4/add_to_cart.tpl',
|
||||
'file' => '/Application/views/blocks/details_productmain_tobasket.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
[
|
||||
'template' => 'page/list/list.tpl',
|
||||
'block' => 'page_list_listbody',
|
||||
'file' => '/Application/views/blocks/page_list_listbody.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
[
|
||||
'template' => 'page/shop/start.tpl',
|
||||
'block' => 'start_welcome_text',
|
||||
'file' => '/Application/views/blocks/start_welcome_text.tpl',
|
||||
'position' => 150
|
||||
],
|
||||
// remove_from_cart
|
||||
[
|
||||
'template' => 'page/checkout/basket.tpl',
|
||||
'block' => 'checkout_basket_main',
|
||||
'file' => '/Application/views/blocks/remove_from_cart.tpl',
|
||||
'position' => 150
|
||||
]
|
||||
],
|
||||
@ -107,6 +190,13 @@ $aModule = [
|
||||
'value' => false,
|
||||
'position' => 999
|
||||
],
|
||||
[
|
||||
'group' => 'd3_gtm_settings',
|
||||
'name' => 'd3_gtm_blActivateConsentMode',
|
||||
'type' => 'bool',
|
||||
'value' => false,
|
||||
'position' => 999
|
||||
],
|
||||
[
|
||||
'group' => 'd3_gtm_settings_cookiemanager',
|
||||
'name' => 'd3_gtm_settings_hasOwnCookieManager',
|
||||
@ -116,9 +206,9 @@ $aModule = [
|
||||
],
|
||||
[
|
||||
'group' => 'd3_gtm_settings_cookiemanager',
|
||||
'name' => 'd3_gtm_settings_cookieName',
|
||||
'name' => 'd3_gtm_settings_controlParameter',
|
||||
'type' => 'str',
|
||||
'value' => 'example',
|
||||
'value' => '',
|
||||
'position' => 999
|
||||
],
|
||||
[
|
||||
@ -126,7 +216,20 @@ $aModule = [
|
||||
'name' => 'd3_gtm_settings_HAS_STD_MANAGER',
|
||||
'type' => 'select',
|
||||
'value' => 'none',
|
||||
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS',
|
||||
'constraints' => 'NONE|CONSENTMANAGER|USERCENTRICS|COOKIEFIRST|COOKIEBOT',
|
||||
],
|
||||
// OST929760 - Erweiterung für Serverside Tagging
|
||||
[
|
||||
'group' => 'd3_gtm_settings_serversidetagging',
|
||||
'name' => 'd3_gtm_settings_serversidetagging_js',
|
||||
'type' => 'str',
|
||||
'value' => 'https://www.googletagmanager.com/gtm.js',
|
||||
],
|
||||
[
|
||||
'group' => 'd3_gtm_settings_serversidetagging',
|
||||
'name' => 'd3_gtm_settings_serversidetagging_nojs',
|
||||
'type' => 'str',
|
||||
'value' => 'https://www.googletagmanager.com/ns.html',
|
||||
],
|
||||
]
|
||||
];
|
13
phpstan.neon
13
phpstan.neon
@ -1,10 +1,15 @@
|
||||
parameters:
|
||||
scanFiles:
|
||||
- IntelliSenseHelper.php
|
||||
- ../../oxid-esales/oxideshop-ce/source/bootstrap.php
|
||||
- ../../oxid-esales/oxideshop-ce/source/oxfunctions.php
|
||||
- ../../oxid-esales/oxideshop-ce/source/overridablefunctions.php
|
||||
level: 9
|
||||
phpVersion: 70100
|
||||
checkMissingIterableValueType: false
|
||||
scanDirectories:
|
||||
- ../../oxid-esales
|
||||
ignoreErrors:
|
||||
- '#Psr\\Container\\ContainerExceptionInterface is not subtype of Throwable#'
|
||||
- '#.*is not subtype of Throwable.*#'
|
||||
paths:
|
||||
- ./
|
||||
level: 5
|
||||
phpVersion: 80100
|
||||
checkMissingIterableValueType: false
|
||||
|
Reference in New Issue
Block a user