Compare commits

..

5 Commits

Author SHA1 Message Date
17a77bbf4c [Unknown-State] first base for it
came formerly from an OS-Ticket but ticket got canceled from the customer
2024-07-30 14:54:03 +02:00
44d89a667b Merge remote-tracking branch 'remotes/origin/rel_2.x' into dev_2.x_remove_from_cart_integration 2024-07-30 14:51:51 +02:00
9e79835bc4 [Removed] xml from composer-blacklist_filter 2024-05-30 09:15:03 +02:00
96033e1e03 [Added] missing admin-mod tab translation 2024-05-30 09:14:31 +02:00
a48356bc30 [Removed] dead files 2024-05-30 08:42:27 +02:00
75 changed files with 377 additions and 655 deletions

View File

@ -1,15 +1,13 @@
<?php <?php
$finder = PhpCsFixer\Finder::create() $finder = PhpCsFixer\Finder::create()
->in(__DIR__) ->in(__DIR__)
; ;
$config = new PhpCsFixer\Config(); $config = new PhpCsFixer\Config();
return $config->setRules([ return $config->setRules([
'@PHP81Migration' => true, '@PHP73Migration' => true,
'@PSR12' => true, '@PSR12' => true
'php_unit_test_class_requires_covers' => true, ])
'doctrine_annotation_indentation' => true, ->setFinder($finder)
]) ;
->setFinder($finder)
;

View File

@ -1,15 +0,0 @@
<?php
declare(strict_types=1);
namespace D3\GoogleAnalytics4\Application\Component\Widget;
class d3GtmStartWidget extends \OxidEsales\Eshop\Application\Component\Widget\WidgetController
{
public function render()
{
parent::render();
return '';
}
}

View File

@ -12,7 +12,7 @@ use OxidEsales\Eshop\Core\ViewConfig;
class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controller\Admin\AdminDetailsController
{ {
protected $_sThisTemplate = '@' . Constants::OXID_MODULE_ID . '/admin/d3ga4uimain'; protected $_sThisTemplate = 'ga4/admin/d3ga4uimain.tpl';
public function render() public function render()
{ {
@ -21,7 +21,7 @@ class GA4AdminUserInterface_main extends \OxidEsales\Eshop\Application\Controlle
$this->addTplParam('d3ViewObject', $this); $this->addTplParam('d3ViewObject', $this);
$this->addTplParam('d3ViewConfObject', Registry::get(ViewConfig::class)); $this->addTplParam('d3ViewConfObject', Registry::get(ViewConfig::class));
$this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList()); $this->addTplParam('d3ManagerTypeArray', oxNew(ManagerTypes::class)->getManagerList());
$this->addTplParam('d3CurrentCMP', oxNew(ManagerHandler::class)->getActManager()); $this->addTplParam('d3CurrentCMP', oxNew(ManagerHandler::class)->getCurrManager());
return $return; return $return;
} }

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace D3\GoogleAnalytics4\Application\Model\CMP; namespace D3\GoogleAnalytics4\Application\Model\CMP;
abstract class ConsentManagementPlatformBaseModel extends \OxidEsales\Eshop\Core\Model\BaseModel implements ConsentManagementPlatformInterface abstract class ConsentManagementPlatformBaseModel extends \OxidEsales\Eshop\Core\Model\BaseModel implements ConsentManagementPlatformInterface
{ {
public string $sCMPName; public string $sCMPName;
@ -15,4 +16,4 @@ abstract class ConsentManagementPlatformBaseModel extends \OxidEsales\Eshop\Core
{ {
return $this->sCMPName; return $this->sCMPName;
} }
} }

View File

@ -5,4 +5,4 @@ namespace D3\GoogleAnalytics4\Application\Model\CMP;
interface ConsentManagementPlatformInterface interface ConsentManagementPlatformInterface
{ {
public function getCMPName(); public function getCMPName();
} }

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace D3\GoogleAnalytics4\Application\Model\CMP; namespace D3\GoogleAnalytics4\Application\Model\CMP;
use D3\GoogleAnalytics4\Application\Model\ManagerTypes; use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
/** /**
@ -17,8 +18,8 @@ use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
*/ */
class Usercentrics extends ConsentManagementPlatformBaseModel class Usercentrics extends ConsentManagementPlatformBaseModel
{ {
public const sExternalIncludationPublicName = "( Externe Einbindung ) Usercentrics"; const sExternalIncludationPublicName = "( Externe Einbindung ) Usercentrics";
public const sExternalIncludationInternalName = "usercentrics"; const sExternalIncludationInternalName = "usercentrics";
public const sModuleIncludationPublicName = "( Modul ) Usercentrics"; const sModuleIncludationPublicName = "( Modul ) Usercentrics";
public const sModuleIncludationInternalName = "oxps_usercentrics"; const sModuleIncludationInternalName = "oxps_usercentrics";
} }

View File

@ -4,7 +4,8 @@ declare(strict_types=1);
namespace D3\GoogleAnalytics4\Application\Model; namespace D3\GoogleAnalytics4\Application\Model;
class Constants class Constants
{ {
public const OXID_MODULE_ID = 'd3googleanalytics4'; public const OXID_MODULE_ID = 'd3googleanalytics4';
} }

View File

@ -7,6 +7,35 @@ use OxidEsales\Eshop\Core\ViewConfig;
class ManagerHandler class ManagerHandler
{ {
/**
* Gets current chosen Manager
*
* @return string
*/
public function getCurrManager() :string
{
/** @var ManagerTypes $oManagerTypes */
$oManagerTypes = oxNew(ManagerTypes::class);
/** @var ViewConfig $oViewConfig */
$oViewConfig = oxNew(ViewConfig::class);
$aManagerList = $oManagerTypes->getManagerList();
if ($this->getModuleSettingExplicitManagerSelectValue()){
return $this->getExplicitManager();
}
foreach ($aManagerList as $shopModuleId => $publicCMPName){
if ($oViewConfig->isModuleActive($shopModuleId)){
$this->d3SaveShopConfVar($shopModuleId);
return $shopModuleId;
}
}
return "";
}
/** /**
* @param string $sParam * @param string $sParam
* @return void * @return void
@ -24,8 +53,26 @@ class ManagerHandler
/** /**
* @return string * @return string
*/ */
public function getActManager() :string public function getModuleSettingExplicitManagerSelectValue() :string
{ {
return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER')?:""; return Registry::get(ViewConfig::class)->d3GetModuleConfigParam('_HAS_STD_MANAGER')?:"";
}
/**
* @return string
*/
public function getExplicitManager() :string
{
$sPotentialManagerName = $this->getModuleSettingExplicitManagerSelectValue();
/** @var ManagerTypes $oManagerTypes */
$oManagerTypes = oxNew(ManagerTypes::class);
$sCMPName = $oManagerTypes->isManagerInList($sPotentialManagerName)
? $sPotentialManagerName
: "NONE";
$this->d3SaveShopConfVar($sCMPName);
return $sCMPName;
} }
} }

View File

@ -6,26 +6,20 @@ use D3\GoogleAnalytics4\Application\Model\CMP\Usercentrics;
class ManagerTypes class ManagerTypes
{ {
public const EXTERNAL_SERVICE = "eigener Service"; const EXTERNAL_SERVICE = "eigener Service";
public const INTERNAL_EXTERNAL_SERVICE = "externalService"; const NET_COOKIE_MANAGER = "Netensio Cookie Manager";
public const NET_COOKIE_MANAGER = "Netensio Cookie Manager";
public const INTERNAL_NET_COOKIE_MANAGER = "net_cookie_manager";
/** /**
* Further information's: * Further information's:
* https://github.com/aggrosoft/oxid-cookie-compliance * https://github.com/aggrosoft/oxid-cookie-compliance
*/ */
public const AGCOOKIECOMPLIANCE = "Aggrosoft Cookie Compliance"; const AGCOOKIECOMPLIANCE = "Aggrosoft Cookie Compliance";
public const INTERNAL_AGCOOKIECOMPLIANCE = "agcookiecompliance";
public const CONSENTMANAGER = "Consentmanager"; const CONSENTMANAGER = "Consentmanager";
public const INTERNAL_CONSENTMANAGER = "cmconsentmanager";
public const COOKIEFIRST = "Cookiefirst"; const COOKIEFIRST = "Cookiefirst";
public const INTERNAL_COOKIEFIRST = "cookiefirst";
public const COOKIEBOT = "Cookiebot"; const COOKIEBOT = "Cookiebot";
public const INTERNAL_COOKIEBOT = "cookiebot";
/** /**
* @return array * @return array
@ -33,14 +27,14 @@ class ManagerTypes
public function getManagerList(): array public function getManagerList(): array
{ {
return [ return [
self::INTERNAL_EXTERNAL_SERVICE => self::EXTERNAL_SERVICE, "externalService" => self::EXTERNAL_SERVICE,
self::INTERNAL_AGCOOKIECOMPLIANCE => self::AGCOOKIECOMPLIANCE, "agcookiecompliance" => self::AGCOOKIECOMPLIANCE,
self::INTERNAL_NET_COOKIE_MANAGER => self::NET_COOKIE_MANAGER, "net_cookie_manager" => self::NET_COOKIE_MANAGER,
Usercentrics::sModuleIncludationInternalName => Usercentrics::sModuleIncludationPublicName, Usercentrics::sModuleIncludationInternalName => Usercentrics::sModuleIncludationPublicName,
Usercentrics::sExternalIncludationInternalName => Usercentrics::sExternalIncludationPublicName, Usercentrics::sExternalIncludationInternalName => Usercentrics::sExternalIncludationPublicName,
self::INTERNAL_CONSENTMANAGER => self::CONSENTMANAGER, "cmconsentmanager" => self::CONSENTMANAGER,
self::INTERNAL_COOKIEFIRST => self::COOKIEFIRST, "cookiefirst" => self::COOKIEFIRST,
self::INTERNAL_COOKIEBOT => self::COOKIEBOT, "cookiebot" => self::COOKIEBOT,
]; ];
} }
@ -48,25 +42,8 @@ class ManagerTypes
* @param string $sManager * @param string $sManager
* @return bool * @return bool
*/ */
public function isManagerInList(string $sManager): bool public function isManagerInList(string $sManager) :bool
{ {
return in_array($sManager, array_keys($this->getManagerList()), true); return in_array($sManager, array_keys($this->getManagerList()), true);
} }
}
/**
* @return array
*
* the CMP from this method always needs the script tag delivered to the dom.
*/
public function scriptTagDeliveredByDefaultArray(): array
{
return [
Usercentrics::sModuleIncludationInternalName,
Usercentrics::sExternalIncludationInternalName,
ManagerTypes::INTERNAL_CONSENTMANAGER,
ManagerTypes::INTERNAL_COOKIEFIRST,
ManagerTypes::INTERNAL_COOKIEBOT,
ManagerTypes::INTERNAL_EXTERNAL_SERVICE,
];
}
}

View File

@ -1,14 +1,14 @@
<?php <?php
$sLangName = "Deutsch"; $sLangName = "Deutsch";
// ------------------------------- // -------------------------------
// RESOURCE IDENTITFIER = STRING // RESOURCE IDENTITFIER = STRING
// ------------------------------- // -------------------------------
$aLang = [ $aLang = array(
'charset' => 'UTF-8', 'charset' => 'UTF-8',
'd3mxgoogleanalytics4' => 'Google Analytics 4', 'd3mxgoogleanalytics4' => 'Google Analytics 4',
'd3mxgoogleanalytics4set' => 'Einstellungen', 'd3mxgoogleanalytics4set' => 'Einstellungen',
'd3mxd3modules' => "<i class='fab fa-fw fa-d3 d3fa-color-blue'></i> Module",
// Base Translations // Base Translations
'D3BASECONFIG' => 'Grundeinstellungen', 'D3BASECONFIG' => 'Grundeinstellungen',
@ -19,7 +19,7 @@ $aLang = [
'D3ACTIVATEMOD' => 'Modul aktivieren', 'D3ACTIVATEMOD' => 'Modul aktivieren',
'D3CNTRLPARAM' => 'Steuerungsparameter', 'D3CNTRLPARAM' => 'Steuerungsparameter',
'D3CNTRLPARAM_HELP' => '<a target="_blank" href="https://github.com/d3datadevelopment/GoogleAnalytics4/blob/master/Docs/README.md#steuerungsparameter" class="text-muted text-decoration-none"><i class="bi bi-book-half"></i> Was ist der <strong>Steuerungsparameter</strong>?</a>', 'D3CNTRLPARAM_HELP' => '<a target="_blank" href="https://github.com/d3datadevelopment/GoogleAnalytics4/blob/master/Docs/README.md#steuerungsparameter" class="text-muted text-decoration-none"><i class="bi bi-book-half"></i> Was ist der <strong>Steuerungsparameter</strong>?</a>',
'D3INACTIVATEMOD' => 'Modul ist nicht aktiv! Es werden keine Funktionen ausgespielt!', 'D3INACTIVATEMOD' => 'Modul ist nicht aktiv! Es werde keine Funktionen ausgespielt!',
// Usercentrics Dynamische Optionen // Usercentrics Dynamische Optionen
'D3USRCNTRCSDYNOPT' => 'Usercentrics Dynamische Optionen', 'D3USRCNTRCSDYNOPT' => 'Usercentrics Dynamische Optionen',
@ -41,7 +41,7 @@ $aLang = [
völlig verhindert, solange keine Zustimmung erteilt wurde.<br> völlig verhindert, solange keine Zustimmung erteilt wurde.<br>
<br> <br>
Ein einfaches anschalten dieser Funktion regelt noch <strong>nicht</strong> die völlige Funktionsweise Ein einfaches anschalten dieser Funktion regelt noch <strong>nicht</strong> die völlige Funktionsweise
aller beteiligten Instanzen; diese bedarf eine detailliertere Konfiguration!<br>", aller beteiligten Instanzen; diese bedarf eine detailiertere Konfiguration!<br>",
// Use CMP? // Use CMP?
'D3CMPTABTITLE' => 'Cookie Manager Einstellungen', 'D3CMPTABTITLE' => 'Cookie Manager Einstellungen',
@ -58,12 +58,12 @@ $aLang = [
Diese konformen CMP sind in Diese konformen CMP sind in
<a target="_blank" href="https://cmppartnerprogram.withgoogle.com/">offizieller Partnerschaft mit Google ( Liste der Partner )</a> <a target="_blank" href="https://cmppartnerprogram.withgoogle.com/">offizieller Partnerschaft mit Google ( Liste der Partner )</a>
und unterliegen strengen Vorschriften, um ein ordnungsgemäßes Senden und und unterliegen strengen Vorschriften, um ein ordnungsgemäßes Senden und
Verarbeiten der Zustimmung unterliegenden Daten sicher stellen zu können.', Verarbeiten der Zustimmung unterliegenden Daten sicher zu stellen.',
'D3CMP' => 'Consent Management Platform ( CMP ) wählen', 'D3CMP' => 'Consent Management Platform ( CMP ) wählen',
// Usercentrics Config // Usercentrics Config
// activate Individual Default Values // activate Individual Default Values
'D3USRCNTRCSCFG_ACT_INDIVDEFVAL' => "Usercentrics individual 'Default Values' aktiveren", 'D3USRCNTRCSCFG_ACT_INDIVDEFVAL' => "usercentrics individual 'Default Values' aktiveren",
// standard Consent // standard Consent
'D3USRCNTRCSCFG_STD_CNST' => "GTM Standard Consent", 'D3USRCNTRCSCFG_STD_CNST' => "GTM Standard Consent",
// activate consent mode API // activate consent mode API
@ -71,7 +71,7 @@ $aLang = [
// consent mode api // consent mode api
'D3USRCNTRCSCFG_CNSTMDE_API' => "Consent Mode API", 'D3USRCNTRCSCFG_CNSTMDE_API' => "Consent Mode API",
'D3USRCNTRCSCFG_DOCS' => 'Nähere Infos zu den hier konfigurierbaren Einstellungen entnehmen Sie bitte der offiziellen 'D3USRCNTRCSCFG_DOCS' => 'Nähere Infos zu den hier konfigurierbaren Einstellungen entnehmen Sie bitte der offiziellen
Dokumentation von Usercentrics selbst: <a target="_blank" href="https://docs.usercentrics.com/#/consent-mode" class="text-primary"><i class="bi bi-book-half"></i> Dokumentation</a>', Dokumentation von Usercentrics selbst: <a href="https://docs.usercentrics.com/#/consent-mode" class="text-primary"><i class="bi bi-book-half"></i> Dokumentation</a>',
'D3USRCNTRCSCFG_WARNING' => "Bevor Sie hier Anpassungen machen, konsultieren Sie bitte einen technischen Support!<br> 'D3USRCNTRCSCFG_WARNING' => "Bevor Sie hier Anpassungen machen, konsultieren Sie bitte einen technischen Support!<br>
Anpassungen können zu Beeinträchtigungen und Ausfall von Funktionen im Frontend führen!", Anpassungen können zu Beeinträchtigungen und Ausfall von Funktionen im Frontend führen!",
@ -121,4 +121,4 @@ Nachher:
src="{Domain}?id={Container-ID}" src="{Domain}?id={Container-ID}"
</code> </code>
</pre>', </pre>',
]; );

View File

@ -1,5 +1,4 @@
<?php <?php
/** /**
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.

View File

@ -1,4 +1,4 @@
[{include file="@d3googleanalytics4/admin/d3ga4uiheaditem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}] [{include file="ga4/admin/d3ga4uiheaditem.tpl" title="GENERAL_ADMIN_TITLE"|oxmultilangassign}]
<style> <style>
body { body {
background-image: linear-gradient(to top, #d5d4d0 0%, #d5d4d0 1%, #eeeeec 31%, #efeeec 75%, #e9e9e7 100%); background-image: linear-gradient(to top, #d5d4d0 0%, #d5d4d0 1%, #eeeeec 31%, #efeeec 75%, #e9e9e7 100%);
@ -80,6 +80,7 @@
[{oxmultilang ident="D3CMP"}] [{oxmultilang ident="D3CMP"}]
</label> </label>
<select class="form-select w-50" name="editval[select][_HAS_STD_MANAGER]" aria-label="Default select example"> <select class="form-select w-50" name="editval[select][_HAS_STD_MANAGER]" aria-label="Default select example">
<option value="NONE" selected>[{oxmultilang ident="D3NONE"}]</option>
[{foreach from=$d3ManagerTypeArray key="sInternalName" item="sPublicName" name="editval[aCmpNameArray]"}] [{foreach from=$d3ManagerTypeArray key="sInternalName" item="sPublicName" name="editval[aCmpNameArray]"}]
<option value="[{$sInternalName}]" [{if $sInternalName === $d3CurrentCMP}]SELECTED[{/if}]>[{$sPublicName}]</option> <option value="[{$sInternalName}]" [{if $sInternalName === $d3CurrentCMP}]SELECTED[{/if}]>[{$sPublicName}]</option>
[{/foreach}] [{/foreach}]

View File

View File

@ -1,12 +1,12 @@
[{if $oViewConf->D3blShowGtmScript()}] [{if $oViewConf->D3blShowGtmScript()}]
[{if $oViewConf->getGtmContainerId()}][{strip}] [{if $oViewConf->getGtmContainerId()}][{strip}]
<!-- Google Tag Manager (noscript) --> <!-- Google Tag Manager (noscript) -->
<noscript> <noscript>
<iframe src="[{$oViewConf->getServerSidetaggingNoJsDomain()}]?id=[{$oViewConf->getGtmContainerId()}]" <iframe src="[{$oViewConf->getServerSidetaggingNoJsDomain()}]?id=[{$oViewConf->getGtmContainerId()}]"
height="0" width="0" style="display:none;visibility:hidden"></iframe> height="0" width="0" style="display:none;visibility:hidden"></iframe>
</noscript> </noscript>
<!-- End Google Tag Manager (noscript) --> <!-- End Google Tag Manager (noscript) -->
[{/strip}][{/if}] [{/strip}][{/if}]
[{/if}] [{/if}]
[{$smarty.block.parent}] [{$smarty.block.parent}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/purchase.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/remove_from_cart.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/view_cart.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/view_item.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/view_item_list.tpl"}]

View File

@ -0,0 +1,3 @@
[{$smarty.block.parent}]
[{include file="event/view_search_result.tpl"}]

View File

@ -41,4 +41,4 @@
[{/if}] [{/if}]
[{/block}] [{/block}]
[{include file='@d3googleanalytics4/event/add_to_cart.tpl' htmlIdAmountOfArticles='#amountToBasket'}] [{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -8,7 +8,7 @@
<p class="alert alert-info">[{oxmultilang ident="WISH_LIST_EMPTY"}]</p> <p class="alert alert-info">[{oxmultilang ident="WISH_LIST_EMPTY"}]</p>
[{/if}] [{/if}]
[{include file='@d3googleanalytics4/event/add_to_cart.tpl' htmlIdAmountOfArticles='#amountToBasket'}] [{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
[{insert name="oxid_tracker" title=$template_title}] [{insert name="oxid_tracker" title=$template_title}]
[{/capture}] [{/capture}]

View File

@ -21,7 +21,7 @@
[{/if}] [{/if}]
[{/block}] [{/block}]
[{include file='@d3googleanalytics4/event/add_to_cart.tpl' htmlIdAmountOfArticles='#amountToBasket'}] [{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
[{insert name="oxid_tracker" title=$template_title}] [{insert name="oxid_tracker" title=$template_title}]
[{/capture}] [{/capture}]

View File

@ -34,7 +34,7 @@
</p> </p>
[{/if}] [{/if}]
[{include file='@d3googleanalytics4/event/add_to_cart.tpl' htmlIdAmountOfArticles='#amountToBasket'}] [{include file="event/add_to_cart.tpl" htmlIdAmountOfArticles='#amountToBasket'}]
[{insert name="oxid_tracker" title=$template_title}] [{insert name="oxid_tracker" title=$template_title}]
[{/capture}] [{/capture}]

View File

@ -4,53 +4,9 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [unreleased](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/3.0.0.1...rel_3.x) - 2025-x ## [unreleased](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.17.2...rel_2.x) - 2024-x
## [3.0.0.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/3.0.0.0...3.0.0.1) - 2024-03-19 ## [2.18.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.18.0...2.18.1) - 2024-06-25
### Fixed
- reset of cmp-selection
- over-engineered getter-methods
## [3.0.0.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.22.0...3.0.0.0) - 2024-11-25
### Added
- installability OXID 7
- don't submit item prices, if user doesn't have "show price" right
## [2.23.0.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.23.0.0...2.23.0.1) - 2025-02-19
### Fixed
- false metadata view_cart entry
- missing menu-translation
### Added
- data layer doesn't contain prices if current user hasn't "show price" rights
## [2.23.0.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.22.0...2.23.0.0) - 2024-12-21
### Added
- another tag-versioning position
- additional global variables, if given
## [2.22.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.21.0...2.22.0) - 2024-09-21
### Fixed
- Consentmanager didn't get delivered
### Changed
- write "internal_names" of CMP to constants
## [2.21.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.20.1...2.21.0) - 2024-09-19
### Fixed
- missing parameters for widget.php call
## [2.20.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.20.0...2.20.1) - 2024-09-11
### Fixed
- missing currency name in begin_checkout template
## [2.20.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.19.0...2.20.0) - 2024-08-20
### Added
- new event "begin_checkout"
- new event "add_payment_info"
## [2.19.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.18.2...2.19.0) - 2024-08-10
### Fixed
- usage of not yet existing function
## [2.18.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.18.1...2.18.2) - 2024-06-25
### Fixed ### Fixed
- oe-console apply-configuration triggers on-activate and overwrites existing values - oe-console apply-configuration triggers on-activate and overwrites existing values

View File

@ -14,28 +14,13 @@
*/ */
namespace D3\GoogleAnalytics4\Modules\Core{ namespace D3\GoogleAnalytics4\Modules\Core{
class ViewConfig_parent extends \OxidEsales\Eshop\Core\ViewConfig class ViewConfig_parent extends \OxidEsales\Eshop\Core\ViewConfig{}
{
}
} }
namespace D3\GoogleAnalytics4\Modules\Application\Model{ namespace D3\GoogleAnalytics4\Modules\Application\Model{
class Category_parent extends \OxidEsales\Eshop\Application\Model\Category {}
use OxidEsales\Eshop\Application\Model\Payment; class Basket_parent extends \OxidEsales\Eshop\Application\Model\Basket {}
class Manufacturer_parent extends \OxidEsales\Eshop\Application\Model\Manufacturer {}
class Category_parent extends \OxidEsales\Eshop\Application\Model\Category
{
}
class Basket_parent extends \OxidEsales\Eshop\Application\Model\Basket
{
}
class Manufacturer_parent extends \OxidEsales\Eshop\Application\Model\Manufacturer
{
}
class gtmPayment_parent extends Payment
{
}
} }
namespace D3\GoogleAnalytics4\Modules\Application\Controller{ namespace D3\GoogleAnalytics4\Modules\Application\Controller{
@ -48,60 +33,36 @@ namespace D3\GoogleAnalytics4\Modules\Application\Controller{
use OxidEsales\Eshop\Application\Controller\SearchController; use OxidEsales\Eshop\Application\Controller\SearchController;
use OxidEsales\Eshop\Application\Controller\StartController; use OxidEsales\Eshop\Application\Controller\StartController;
class BasketController_parent extends \OxidEsales\Eshop\Application\Controller\BasketController class BasketController_parent extends \OxidEsales\Eshop\Application\Controller\BasketController {}
{ class ThankYouController_parent extends \OxidEsales\Eshop\Application\Controller\ThankYouController {}
}
class ThankYouController_parent extends \OxidEsales\Eshop\Application\Controller\ThankYouController
{
}
class ArticleListController_AddToCartHelpMethods_parent extends ArticleListController class ArticleListController_AddToCartHelpMethods_parent extends ArticleListController {}
{
}
class ArticleDetailsController_parent extends \OxidEsales\Eshop\Application\Controller\ArticleDetailsController class ArticleDetailsController_parent extends \OxidEsales\Eshop\Application\Controller\ArticleDetailsController {}
{
}
class d3GtmAccountNoticeListController_parent extends AccountNoticeListController class d3GtmAccountNoticeListController_parent extends AccountNoticeListController {}
{
}
class d3GtmAccountRecommlistController_parent extends AccountRecommlistController class d3GtmAccountRecommlistController_parent extends AccountRecommlistController {}
{
}
class d3GtmAccountWishlistController_parent extends AccountWishlistController class d3GtmAccountWishlistController_parent extends AccountWishlistController {}
{
}
class d3GtmStartController_parent extends StartController class d3GtmStartController_parent extends StartController {}
{
}
class d3GtmSearchController_parent extends SearchController class d3GtmSearchController_parent extends SearchController {}
{
}
class d3GtmManufacturerListController_parent extends ManufacturerController class d3GtmManufacturerListController_parent extends ManufacturerController {}
{
}
} }
namespace D3\GoogleAnalytics4\Modules\Application\Component{ namespace D3\GoogleAnalytics4\Modules\Application\Component{
use OxidEsales\Eshop\Application\Component\BasketComponent; use OxidEsales\Eshop\Application\Component\BasketComponent;
class d3GtmBasketComponentExtension_parent extends BasketComponent class d3GtmBasketComponentExtension_parent extends BasketComponent {}
{
}
} }
namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget{ namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget{
use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails; use OxidEsales\Eshop\Application\Component\Widget\ArticleDetails;
class d3GtmWidgetArticleDetails_parent extends ArticleDetails class d3GtmWidgetArticleDetails_parent extends ArticleDetails {}
{ }
}
}

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget; namespace D3\GoogleAnalytics4\Modules\Application\Component\Widget;
class d3GtmWidgetArticleDetails extends d3GtmWidgetArticleDetails_parent class d3GtmWidgetArticleDetails extends d3GtmWidgetArticleDetails_parent
{ {
public function render() public function render()
@ -14,4 +15,4 @@ class d3GtmWidgetArticleDetails extends d3GtmWidgetArticleDetails_parent
return $return; return $return;
} }
} }

View File

@ -24,9 +24,9 @@ class d3GtmBasketComponentExtension extends d3GtmBasketComponentExtension_parent
$iAmountArticlesAddedToCart = (int) Registry::getRequest()->getRequestEscapedParameter('am'); $iAmountArticlesAddedToCart = (int) Registry::getRequest()->getRequestEscapedParameter('am');
if ($iAmountArticlesAddedToCart) { if ($iAmountArticlesAddedToCart){
Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', $iAmountArticlesAddedToCart); Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', $iAmountArticlesAddedToCart);
} else { }else{
Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', 1); Registry::getSession()->setVariable('d3GtmAddToCartAmountArticles', 1);
} }
@ -36,7 +36,7 @@ class d3GtmBasketComponentExtension extends d3GtmBasketComponentExtension_parent
/** /**
* @return int * @return int
*/ */
public function getD3GtmAddToCartAmountArticles(): int public function getD3GtmAddToCartAmountArticles() :int
{ {
$iAmount = Registry::getSession()->getVariable('d3GtmAddToCartAmountArticles'); $iAmount = Registry::getSession()->getVariable('d3GtmAddToCartAmountArticles');
@ -48,7 +48,7 @@ class d3GtmBasketComponentExtension extends d3GtmBasketComponentExtension_parent
/** /**
* @return bool * @return bool
*/ */
public function getAddToBasketDecision(): bool public function getAddToBasketDecision() :bool
{ {
$decision = Registry::getSession()->getVariable('d3GtmAddToBasketTrigger'); $decision = Registry::getSession()->getVariable('d3GtmAddToBasketTrigger');
@ -57,6 +57,26 @@ class d3GtmBasketComponentExtension extends d3GtmBasketComponentExtension_parent
return (bool) $decision; return (bool) $decision;
} }
public function getRemoveFromBasketDecision() :bool
{
$decision = Registry::getSession()->getVariable('d3GtmRemoveFromBasketTrigger');
Registry::getSession()->setVariable('d3GtmRemoveFromBasketTrigger', false);
return (bool) $decision;
}
protected function _getItems($sProductId = null, $dAmount = null, $aSel = null, $aPersParam = null, $blOverride = false)
{
$aProducts = parent::_getItems($sProductId, $dAmount, $aSel, $aPersParam, $blOverride);
if (is_array($aProducts) && count($aProducts)) {
Registry::getSession()->setVariable('d3GtmRemoveFromBasketTrigger', true);
}
return $return;
}
/** /**
* @return Article|null * @return Article|null
*/ */
@ -66,7 +86,7 @@ class d3GtmBasketComponentExtension extends d3GtmBasketComponentExtension_parent
$oArticle = null; $oArticle = null;
if ($sAnid) { if ($sAnid){
/** @var Article $oArticle */ /** @var Article $oArticle */
$oArticle = oxNew(Article::class); $oArticle = oxNew(Article::class);
$oArticle->load($sAnid); $oArticle->load($sAnid);
@ -74,4 +94,4 @@ class d3GtmBasketComponentExtension extends d3GtmBasketComponentExtension_parent
return $oArticle; return $oArticle;
} }
} }

View File

@ -12,4 +12,4 @@ class ArticleDetailsController extends ArticleDetailsController_parent
return $return; return $return;
} }
} }

View File

@ -12,4 +12,4 @@ class ArticleListController_AddToCartHelpMethods extends ArticleListController_A
return $render; return $render;
} }
} }

View File

@ -26,7 +26,7 @@ class BasketController extends BasketController_parent
* @return void * @return void
* @throws oxSystemComponentException * @throws oxSystemComponentException
*/ */
public function d3GA4getRemovedArticlesListObject(): void public function d3GA4getRemovedArticlesListObject() :void
{ {
$this->addTplParam('hasBeenReloaded', false); $this->addTplParam('hasBeenReloaded', false);
// collecting items to add // collecting items to add
@ -52,7 +52,7 @@ class BasketController extends BasketController_parent
'am' => $dAmount, 'am' => $dAmount,
'sel' => $aSel, 'sel' => $aSel,
'persparam' => $aPersParam, 'persparam' => $aPersParam,
'basketitemid' => $sBasketItemId, 'basketitemid' => $sBasketItemId
]; ];
} }
@ -84,9 +84,9 @@ class BasketController extends BasketController_parent
#dumpVar($this->getBasketArticles()); #dumpVar($this->getBasketArticles());
/** @var Article $item */ /** @var Article $item */
foreach ($oArtList->getArray() as $item) { foreach ($oArtList->getArray() as $item){
foreach ($artIdOnArtAmountList as $artId => $artAmount) { foreach ($artIdOnArtAmountList as $artId => $artAmount){
if ($item->getId() === $artId) { if ($item->getId() === $artId){
$item->assign(['d3AmountThatGotRemoved' => $artAmount]); $item->assign(['d3AmountThatGotRemoved' => $artAmount]);
} }
} }
@ -104,13 +104,13 @@ class BasketController extends BasketController_parent
* if that doesn't work, we check if there's an Article in the Products array, that has "'am' = 0" * 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 * Which also shows we're in that state rn
*/ */
protected function isArticleRemovedState(array $productsArray): bool protected function isArticleRemovedState(array $productsArray) :bool
{ {
if (Registry::getRequest()->getRequestEscapedParameter('removeBtn') if (Registry::getRequest()->getRequestEscapedParameter('removeBtn')
or Registry::getRequest()->getRequestEscapedParameter('updateBtn') or Registry::getRequest()->getRequestEscapedParameter('updateBtn')
) { ){
return true; return true;
} else { }else{
foreach ($productsArray as $aProduct) { foreach ($productsArray as $aProduct) {
if (intval($aProduct['am']) === 0) { if (intval($aProduct['am']) === 0) {
return true; return true;

View File

@ -16,10 +16,10 @@ class ThankYouController extends ThankYouController_parent
$oOrder = $this->getOrder(); $oOrder = $this->getOrder();
$sCountryId = $oOrder->getFieldData('oxbillcountryid'); $sCountryId = $oOrder->getFieldData('oxbillcountryid');
/** @var Country::class $oCountry */ /** @var Country $oCountry */
$oCountry = oxNew(Country::class); $oCountry = oxNew(Country::class);
$oCountry->load($sCountryId); $oCountry->load($sCountryId);
return $oCountry; return $oCountry;
} }
} }

View File

@ -2,11 +2,9 @@
namespace D3\GoogleAnalytics4\Modules\Application\Controller; namespace D3\GoogleAnalytics4\Modules\Application\Controller;
use D3\GoogleAnalytics4\Application\Model\Constants;
class d3GtmAccountNoticeListController extends d3GtmAccountNoticeListController_parent class d3GtmAccountNoticeListController extends d3GtmAccountNoticeListController_parent
{ {
protected $_sThisTemplate = '@' . Constants::OXID_MODULE_ID . '/page/account/d3gtmnoticelist.tpl'; protected $_sThisTemplate = 'page/account/d3gtmnoticelist.tpl';
public function render() public function render()
{ {
@ -16,4 +14,4 @@ class d3GtmAccountNoticeListController extends d3GtmAccountNoticeListController_
return $return; return $return;
} }
} }

View File

@ -2,11 +2,9 @@
namespace D3\GoogleAnalytics4\Modules\Application\Controller; namespace D3\GoogleAnalytics4\Modules\Application\Controller;
use D3\GoogleAnalytics4\Application\Model\Constants;
class d3GtmAccountRecommlistController extends d3GtmAccountRecommlistController_parent class d3GtmAccountRecommlistController extends d3GtmAccountRecommlistController_parent
{ {
protected $_sThisTemplate = '@' . Constants::OXID_MODULE_ID . '/page/account/d3gtmrecommendationlist.tpl'; protected $_sThisTemplate = 'page/account/d3gtmrecommendationlist.tpl';
public function render() public function render()
{ {
@ -16,4 +14,4 @@ class d3GtmAccountRecommlistController extends d3GtmAccountRecommlistController_
return $return; return $return;
} }
} }

View File

@ -2,11 +2,9 @@
namespace D3\GoogleAnalytics4\Modules\Application\Controller; namespace D3\GoogleAnalytics4\Modules\Application\Controller;
use D3\GoogleAnalytics4\Application\Model\Constants;
class d3GtmAccountWishlistController extends d3GtmAccountWishlistController_parent class d3GtmAccountWishlistController extends d3GtmAccountWishlistController_parent
{ {
protected $_sThisTemplate = '@' . Constants::OXID_MODULE_ID . '/page/account/d3gtmwishlist.tpl'; protected $_sThisTemplate = 'page/account/d3gtmwishlist.tpl';
public function render() public function render()
{ {
@ -16,4 +14,4 @@ class d3GtmAccountWishlistController extends d3GtmAccountWishlistController_pare
return $return; return $return;
} }
} }

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace D3\GoogleAnalytics4\Modules\Application\Controller; namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class d3GtmManufacturerListController extends d3GtmManufacturerListController_parent class d3GtmManufacturerListController extends d3GtmManufacturerListController_parent
{ {
public function render() public function render()
@ -14,4 +15,4 @@ class d3GtmManufacturerListController extends d3GtmManufacturerListController_pa
return $return; return $return;
} }
} }

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace D3\GoogleAnalytics4\Modules\Application\Controller; namespace D3\GoogleAnalytics4\Modules\Application\Controller;
class d3GtmSearchController extends d3GtmSearchController_parent class d3GtmSearchController extends d3GtmSearchController_parent
{ {
/** /**
@ -13,10 +14,10 @@ class d3GtmSearchController extends d3GtmSearchController_parent
{ {
$return = parent::render(); $return = parent::render();
if (false === in_array('oxcmp_basket', $this->getComponents())) { if (false === in_array('oxcmp_basket', $this->getComponents())){
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket')); $this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
} }
return $return; return $return;
} }
} }

View File

@ -10,10 +10,10 @@ class d3GtmStartController extends d3GtmStartController_parent
{ {
$return = parent::render(); $return = parent::render();
if (false === in_array('oxcmp_basket', $this->getComponents())) { if (false === in_array('oxcmp_basket', $this->getComponents())){
$this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket')); $this->addTplParam('d3CmpBasket', $this->getComponent('oxcmp_basket'));
} }
return $return; return $return;
} }
} }

View File

@ -9,15 +9,15 @@ class Basket extends Basket_parent
/** /**
* @return string * @return string
*/ */
public function getPaymentOnPaymentId(): string public function getPaymentOnPaymentId() :string
{ {
if ($this->getPaymentId()) { if ($this->getPaymentId()){
$oPayment = oxNew(Payment::class); $oPayment = oxNew(Payment::class);
if ($oPayment->load($this->getPaymentId())) { if ($oPayment->load($this->getPaymentId())){
return $oPayment->getFieldData('oxdesc'); return $oPayment->getFieldData('oxdesc');
} }
} }
return "couldn't load payment!"; return "couldn't load payment!";
} }
} }

View File

@ -5,4 +5,4 @@ namespace D3\GoogleAnalytics4\Modules\Application\Model;
class Category extends Category_parent class Category extends Category_parent
{ {
use articleTreeStructure; use articleTreeStructure;
} }

View File

@ -5,4 +5,4 @@ namespace D3\GoogleAnalytics4\Modules\Application\Model;
class Manufacturer extends Manufacturer_parent class Manufacturer extends Manufacturer_parent
{ {
use articleTreeStructure; use articleTreeStructure;
} }

View File

@ -4,7 +4,8 @@ declare(strict_types=1);
namespace D3\GoogleAnalytics4\Modules\Application\Model; namespace D3\GoogleAnalytics4\Modules\Application\Model;
class Vendor extends \OxidEsales\Eshop\Application\Model\Vendor class Vendor extends \OxidEsales\Eshop\Application\Model\Vendor
{ {
use articleTreeStructure; use articleTreeStructure;
} }

View File

@ -8,9 +8,9 @@ trait articleTreeStructure
* @param int $indexOfArray * @param int $indexOfArray
* @return string * @return string
*/ */
public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false): string public function getSplitCategoryArray(int $indexOfArray = -1, bool $bShallTakeStd = false) :string
{ {
if ($bShallTakeStd) { if ($bShallTakeStd){
$splitCatArray = $splitCatArray =
array_values( array_values(
array_filter( array_filter(
@ -26,9 +26,9 @@ trait articleTreeStructure
) )
); );
if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))) { if (($indexOfArray >= 0) and (false === empty($splitCatArray[$indexOfArray]))){
return $splitCatArray[$indexOfArray]; return $splitCatArray[$indexOfArray];
} else { }else{
return ""; return "";
} }
} }
@ -41,4 +41,4 @@ trait articleTreeStructure
) )
); );
} }
} }

View File

@ -1,19 +0,0 @@
<?php
declare(strict_types=1);
namespace D3\GoogleAnalytics4\Modules\Application\Model;
use OxidEsales\Eshop\Application\Model\Payment;
use OxidEsales\Eshop\Core\Registry;
class gtmPayment extends gtmPayment_parent
{
/**
* @return string
*/
public function gtmGetSelectedPaymentName(): string
{
return $this->getFieldData('oxpayments__oxdesc') ?: 'No payment name available';
}
}

View File

@ -1,5 +1,4 @@
<?php <?php
/** /**
* For the full copyright and license information, please view the LICENSE * For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code. * file that was distributed with this source code.
@ -19,16 +18,15 @@ use D3\GoogleAnalytics4\Application\Model\ManagerHandler;
use D3\GoogleAnalytics4\Application\Model\ManagerTypes; use D3\GoogleAnalytics4\Application\Model\ManagerTypes;
use OxidEsales\Eshop\Application\Controller\FrontendController; use OxidEsales\Eshop\Application\Controller\FrontendController;
use OxidEsales\Eshop\Core\Config; use OxidEsales\Eshop\Core\Config;
use OxidEsales\Eshop\Application\Model\User; use OxidEsales\Eshop\Application\Model\User;use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\Registry;
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory; use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Exception\ModuleConfigurationNotFoundException; use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
use OxidEsales\EshopCommunity\Internal\Framework\Module\Setup\Bridge\ModuleActivationBridgeInterface;
use Psr\Container\ContainerExceptionInterface; use Psr\Container\ContainerExceptionInterface;
use Psr\Container\NotFoundExceptionInterface; use Psr\Container\NotFoundExceptionInterface;
class ViewConfig extends ViewConfig_parent class ViewConfig extends ViewConfig_parent
{ {
// Google Tag Manager Container ID // Google Tag Manager Container ID
private $sContainerId = null; private $sContainerId = null;
@ -40,7 +38,8 @@ class ViewConfig extends ViewConfig_parent
public function getGtmContainerId() public function getGtmContainerId()
{ {
if ($this->sContainerId === null) { if ($this->sContainerId === null)
{
$this->sContainerId = $this->d3GetModuleConfigParam("_sContainerID"); $this->sContainerId = $this->d3GetModuleConfigParam("_sContainerID");
} }
return $this->sContainerId; return $this->sContainerId;
@ -49,19 +48,20 @@ class ViewConfig extends ViewConfig_parent
/** /**
* @return void * @return void
*/ */
public function defineCookieManagerType(): void public function defineCookieManagerType() :void
{ {
if ($this->sCookieManagerType === null) { if ($this->sCookieManagerType === null)
{
/** @var ManagerHandler $oManagerHandler */ /** @var ManagerHandler $oManagerHandler */
$oManagerHandler = oxNew(ManagerHandler::class); $oManagerHandler = oxNew(ManagerHandler::class);
$this->sCookieManagerType = $oManagerHandler->getActManager(); $this->sCookieManagerType = $oManagerHandler->getCurrManager();
} }
} }
/** /**
* @return bool * @return bool
*/ */
public function shallUseOwnCookieManager(): bool public function shallUseOwnCookieManager() :bool
{ {
return (bool) $this->d3GetModuleConfigParam('_blEnableOwnCookieManager'); return (bool) $this->d3GetModuleConfigParam('_blEnableOwnCookieManager');
} }
@ -74,7 +74,7 @@ class ViewConfig extends ViewConfig_parent
/** @var Config $oConfig */ /** @var Config $oConfig */
$oConfig = Registry::getConfig(); $oConfig = Registry::getConfig();
if (false === $this->isGA4enabled()) { if (false === $this->isGA4enabled()){
return false; return false;
} }
@ -88,7 +88,7 @@ class ViewConfig extends ViewConfig_parent
$sCookieID = trim($this->d3GetModuleConfigParam('_sControlParameter')); $sCookieID = trim($this->d3GetModuleConfigParam('_sControlParameter'));
// Netensio Cookie Manager // Netensio Cookie Manager
if ($this->sCookieManagerType === ManagerTypes::INTERNAL_NET_COOKIE_MANAGER) { if ($this->sCookieManagerType === ManagerTypes::NET_COOKIE_MANAGER) {
$oSession = Registry::getSession(); $oSession = Registry::getSession();
$aCookies = $oSession->getVariable("aCookieSel"); $aCookies = $oSession->getVariable("aCookieSel");
@ -96,18 +96,22 @@ class ViewConfig extends ViewConfig_parent
} }
// Aggrosoft Cookie Consent // Aggrosoft Cookie Consent
if ($this->sCookieManagerType === ManagerTypes::INTERNAL_AGCOOKIECOMPLIANCE) { if ($this->sCookieManagerType === ManagerTypes::AGCOOKIECOMPLIANCE) {
if (method_exists($this, "isCookieCategoryEnabled")) { if (method_exists($this, "isCookieCategoryEnabled")) {
return $this->isCookieCategoryEnabled($sCookieID); return $this->isCookieCategoryEnabled($sCookieID);
} }
} }
// UserCentrics or consentmanager
if ( if (
in_array( $this->sCookieManagerType === Usercentrics::sModuleIncludationInternalName
$this->sCookieManagerType, or $this->sCookieManagerType === Usercentrics::sExternalIncludationInternalName
(oxNew(ManagerTypes::class)->scriptTagDeliveredByDefaultArray()) 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. // Always needs the script-tags delivered to the DOM.
return true; return true;
} }
@ -121,30 +125,32 @@ class ViewConfig extends ViewConfig_parent
* This is especially important for UserCentrics. * This is especially important for UserCentrics.
* @return string * @return string
*/ */
public function getGtmScriptAttributes(): string public function getGtmScriptAttributes() :string
{ {
$sControlParameter = trim($this->d3GetModuleConfigParam('_sControlParameter')); $sControlParameter = trim($this->d3GetModuleConfigParam('_sControlParameter'));
if (false === $this->shallUseOwnCookieManager() or ($sControlParameter === '')) { if (false === $this->shallUseOwnCookieManager() or ($sControlParameter === '')){
return ""; return "";
} }
if ( if (
$this->sCookieManagerType === Usercentrics::sModuleIncludationInternalName $this->sCookieManagerType === Usercentrics::sModuleIncludationInternalName
or $this->sCookieManagerType === Usercentrics::sExternalIncludationInternalName or $this->sCookieManagerType === Usercentrics::sExternalIncludationInternalName
) { )
{
return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""'; return 'data-usercentrics="' . $sControlParameter . '" type="text/plain" async=""';
} }
if ($this->sCookieManagerType === ManagerTypes::INTERNAL_CONSENTMANAGER) { if ($this->sCookieManagerType === ManagerTypes::CONSENTMANAGER)
{
return 'type="text/plain" class="cmplazyload" data-cmp-vendor="'.$sControlParameter.'"'; return 'type="text/plain" class="cmplazyload" data-cmp-vendor="'.$sControlParameter.'"';
} }
if ($this->sCookieManagerType === ManagerTypes::INTERNAL_COOKIEFIRST) { if ($this->sCookieManagerType === ManagerTypes::COOKIEFIRST){
return 'type="text/plain" data-cookiefirst-category="' . $sControlParameter .'"'; return 'type="text/plain" data-cookiefirst-category="' . $sControlParameter .'"';
} }
if ($this->sCookieManagerType === ManagerTypes::INTERNAL_COOKIEBOT) { if ($this->sCookieManagerType === ManagerTypes::COOKIEBOT){
return 'type="text/plain" data-cookieconsent="' . $sControlParameter .'"'; return 'type="text/plain" data-cookieconsent="' . $sControlParameter .'"';
} }
@ -157,23 +163,22 @@ class ViewConfig extends ViewConfig_parent
*/ */
public function isGA4enabled() public function isGA4enabled()
{ {
if ($this->blGA4enabled === null) { if ($this->blGA4enabled === null)
{
$this->blGA4enabled = $this->d3GetModuleConfigParam("_blEnableGA4"); $this->blGA4enabled = $this->d3GetModuleConfigParam("_blEnableGA4");
} }
return $this->blGA4enabled; return $this->blGA4enabled;
} }
public function isGtmConsentModeSetActivated(): bool public function isGtmConsentModeSetActivated() :bool
{ {
return $this->d3GetModuleConfigParam("_blEnableConsentMode") ?: false; return $this->d3GetModuleConfigParam("_blEnableConsentMode")?: false;
} }
public function getGtmDataLayer() public function getGtmDataLayer()
{ {
if (!$this->getGtmContainerId()) { if (!$this->getGtmContainerId()) return "[]";
return "[]";
}
$oConfig = Registry::getConfig(); $oConfig = Registry::getConfig();
$oView = $oConfig->getTopActiveView(); $oView = $oConfig->getTopActiveView();
@ -208,9 +213,9 @@ class ViewConfig extends ViewConfig_parent
return json_encode([$dataLayer], JSON_PRETTY_PRINT); return json_encode([$dataLayer], JSON_PRETTY_PRINT);
} }
public function isDebugModeOn(): bool public function isDebugModeOn() :bool
{ {
return $this->d3GetModuleConfigParam("_blEnableDebug") ?: false; return $this->d3GetModuleConfigParam("_blEnableDebug")?: false;
} }
/** /**
@ -218,9 +223,9 @@ class ViewConfig extends ViewConfig_parent
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function getServerSidetaggingJsDomain(): string public function getServerSidetaggingJsDomain() :string
{ {
return $this->d3GetModuleConfigParam("_sServersidetagging_js") ?: ""; return $this->d3GetModuleConfigParam("_sServersidetagging_js")?: "";
} }
/** /**
@ -228,9 +233,9 @@ class ViewConfig extends ViewConfig_parent
* @throws ContainerExceptionInterface * @throws ContainerExceptionInterface
* @throws NotFoundExceptionInterface * @throws NotFoundExceptionInterface
*/ */
public function getServerSidetaggingNoJsDomain(): string public function getServerSidetaggingNoJsDomain() :string
{ {
return $this->d3GetModuleConfigParam('_sServersidetagging_nojs') ?: ""; return $this->d3GetModuleConfigParam('_sServersidetagging_nojs')?: "";
} }
/** /**
@ -245,7 +250,7 @@ class ViewConfig extends ViewConfig_parent
/** /**
* @return bool * @return bool
*/ */
public function d3IsUsercentricsCMPChosen(): bool public function d3IsUsercentricsCMPChosen() :bool
{ {
$sCMPPubName = $this->d3GetModuleConfigParam('_HAS_STD_MANAGER'); $sCMPPubName = $this->d3GetModuleConfigParam('_HAS_STD_MANAGER');
$aPossibleCMP = (oxNew(ManagerTypes::class))->getManagerList(); $aPossibleCMP = (oxNew(ManagerTypes::class))->getManagerList();
@ -253,26 +258,4 @@ class ViewConfig extends ViewConfig_parent
return (bool) ($sCMPPubName === Usercentrics::sExternalIncludationInternalName return (bool) ($sCMPPubName === Usercentrics::sExternalIncludationInternalName
or $sCMPPubName === Usercentrics::sModuleIncludationInternalName); or $sCMPPubName === Usercentrics::sModuleIncludationInternalName);
} }
}
/**
* @return bool
*/
public function d3IsModuleActive(string $sModuleId): bool
{
/** @var ModuleActivationBridgeInterface $moduleActivationBridge */
$moduleActivationBridge = $this
->getContainer()
->get(ModuleActivationBridgeInterface::class);
try {
$isActiveBool = $moduleActivationBridge->isActive(
$sModuleId,
Registry::getConfig()->getShopId()
);
} catch (\Exception|ModuleConfigurationNotFoundException $e) {
return false;
}
return (bool) $isActiveBool;
}
}

View File

@ -1,42 +0,0 @@
<?php
namespace D3\GoogleAnalytics4\Modules\Core;
use OxidEsales\EshopCommunity\Core\Registry;
class WidgetControl extends WidgetControl_parent
{
protected function getFrontendStartControllerKey() // phpcs:ignore PSR2.Methods.MethodDeclaration.Underscore
{
/*
* array (
'force_sid' => '2pistlaubiq58qtg3moudei0la',
'lang' => '0',
'actcontrol' => 'details',
'anid' => '064471',
'cl' => 'oxwarticledetails',
'cnid' => '159dd0f2fb2bd6e24ace53a0f1913797',
'listtype' => 'list',
'nocookie' => '1',
'oxwparent' => 'details',
'sid' => '2pistlaubiq58qtg3moudei0la',
'stoken' => 'A22D0F9E',
'varselid' =>
array (
0 => 'b842982bf522aa839bd88221f562fce8',
),
)
*/
$sScriptName = $_SERVER['SCRIPT_NAME'];
if ($sScriptName !== '/widget.php') {
return parent::getFrontendStartControllerKey();
}
$aParameter = $_GET;
if (is_null($aParameter['actcontrol']) and is_null($aParameter['oxwparent'])) {
return 'D3\GoogleAnalytics4\Application\Component\Widget\d3GtmStartWidget';
}
return parent::getFrontendStartControllerKey();
}
}

View File

@ -23,21 +23,11 @@ Dieses Paket erfordert einen mit Composer installierten OXID eShop in einer in d
Ă–ffnen Sie eine Kommandozeile und navigieren Sie zum Stammverzeichnis des Shops (Elternverzeichnis von source und vendor). FĂĽhren Sie den folgenden Befehl aus. Passen Sie die Pfadangaben an Ihre Installationsumgebung an. Ă–ffnen Sie eine Kommandozeile und navigieren Sie zum Stammverzeichnis des Shops (Elternverzeichnis von source und vendor). FĂĽhren Sie den folgenden Befehl aus. Passen Sie die Pfadangaben an Ihre Installationsumgebung an.
```bash ```bash
php composer require d3/google-analytics4:^3 php composer require d3/google-analytics4:^2
``` ```
Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code auszuführen. Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code auszuführen.
```bash
./vendor/bin/oe-console oe:module:deactivate d3googleanalytics4
./vendor/bin/oe-console oe:module:install ./vendor/d3/google-analytics4/
./vendor/bin/oe-console oe:module:activate d3googleanalytics4
./vendor/bin/oe-eshop-db_views_generate
```
Leeren Sie anschlieĂźend den Temp Ordner des Shops.
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module". Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
### Wichtig! ### Wichtig!

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace D3\GoogleAnalytics4\Setup; namespace D3\GoogleAnalytics4\Setup;
use D3\GoogleAnalytics4\Application\Model\Constants; use D3\GoogleAnalytics4\Application\Model\Constants;
use OxidEsales\Eshop\Core\Registry; use OxidEsales\Eshop\Core\Registry;
use OxidEsales\Eshop\Core\ViewConfig; use OxidEsales\Eshop\Core\ViewConfig;
@ -16,11 +17,10 @@ class Actions
* @param string $sSettingValue * @param string $sSettingValue
* @return void * @return void
*/ */
public function d3SaveDefaultSettings(string $sVarType, string $sSettingName, string $sSettingValue) public function d3SaveDefaultSettings(string $sVarType, string $sSettingName, string $sSettingValue){
{
$oConfig = Registry::getConfig(); $oConfig = Registry::getConfig();
if ($this->d3GetModuleConfigParam($sSettingName) and (trim($this->d3GetModuleConfigParam($sSettingName)) !== trim($sSettingValue))) { if (trim($this->d3GetModuleConfigParam($sSettingName)) !== trim($sSettingValue)){
$sSettingValue = trim($this->d3GetModuleConfigParam($sSettingName)); $sSettingValue = trim($this->d3GetModuleConfigParam($sSettingName));
} }
@ -39,6 +39,6 @@ class Actions
*/ */
public function d3GetModuleConfigParam(string $configParamName) public function d3GetModuleConfigParam(string $configParamName)
{ {
return Registry::getConfig()->getShopConfVar(Constants::OXID_MODULE_ID.$configParamName, null, Constants::OXID_MODULE_ID); return Registry::get(ViewConfig::class)->d3GetModuleConfigParam($configParamName);
} }
} }

View File

@ -4,6 +4,7 @@ declare(strict_types=1);
namespace D3\GoogleAnalytics4\Setup; namespace D3\GoogleAnalytics4\Setup;
class Events class Events
{ {
/** /**
@ -32,7 +33,5 @@ class Events
/** /**
* @return void * @return void
*/ */
public static function onDeactivate() public static function onDeactivate(){}
{ }
}
}

View File

@ -28,25 +28,28 @@
"homepage": "https://www.d3data.de" "homepage": "https://www.d3data.de"
} }
], ],
"supports": { "support": {
"email": "support@shopmodule.com" "email": "support@shopmodule.com"
}, },
"require": { "extra": {
"php": "^8.0", "oxideshop": {
"oxid-esales/oxideshop-ce": "7.0 - 7.1", "blacklist-filter": [
"google/apiclient":" ^2.0", "*.md",
"phpstan/phpstan": "^1.10" "composer.json",
}, ".php-cs-fixer.php",
"require-dev": { "*.neon"
"friendsofphp/php-cs-fixer": "^3.9" ],
}, "target-directory": "d3/googleanalytics4"
"autoload": {
"psr-4": {
"D3\\GoogleAnalytics4\\": ""
} }
}, },
"scripts": { "require": {
"php-cs-fixer_audit": "./vendor/bin/php-cs-fixer list-files --config=./vendor/d3/google-analytics4/.php-cs-fixer.php", "php": ">=7.1",
"php-cs-fixer_fix": "./vendor/bin/php-cs-fixer fix --config=./vendor/d3/google-analytics4/.php-cs-fixer.php" "oxid-esales/oxideshop-ce": "^6.5",
"google/apiclient":" ^2.0",
"phpstan/phpstan": "^1.10" },
"autoload": {
"psr-4": {
"D3\\GoogleAnalytics4\\": "../../../source/modules/d3/googleanalytics4"
}
} }
} }

View File

@ -16,7 +16,6 @@ use D3\GoogleAnalytics4\Modules\Application\Controller\d3GtmStartController;
use D3\GoogleAnalytics4\Modules\Application\Controller\ThankYouController; use D3\GoogleAnalytics4\Modules\Application\Controller\ThankYouController;
use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket; use D3\GoogleAnalytics4\Modules\Application\Model\Basket as Basket;
use D3\GoogleAnalytics4\Modules\Application\Model\Category as Category; use D3\GoogleAnalytics4\Modules\Application\Model\Category as Category;
use D3\GoogleAnalytics4\Modules\Application\Model\gtmPayment as gtmPayment;
use D3\GoogleAnalytics4\Modules\Application\Model\Manufacturer as Manufacturer; use D3\GoogleAnalytics4\Modules\Application\Model\Manufacturer as Manufacturer;
use D3\GoogleAnalytics4\Modules\Core\ViewConfig; use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
use OxidEsales\Eshop\Application\Component\BasketComponent as OEBasketComponent; use OxidEsales\Eshop\Application\Component\BasketComponent as OEBasketComponent;
@ -34,13 +33,12 @@ use OxidEsales\Eshop\Application\Controller\ThankYouController as OEThankYouCont
use OxidEsales\Eshop\Application\Model\Basket as OEBasket; use OxidEsales\Eshop\Application\Model\Basket as OEBasket;
use OxidEsales\Eshop\Application\Model\Category as OECategory; use OxidEsales\Eshop\Application\Model\Category as OECategory;
use OxidEsales\Eshop\Application\Model\Manufacturer as OEManufacturer; use OxidEsales\Eshop\Application\Model\Manufacturer as OEManufacturer;
use OxidEsales\Eshop\Application\Model\Payment as OEPayment;
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig; use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
$sMetadataVersion = '2.1'; $sMetadataVersion = '2.1';
$aModule = [ $aModule = [
'id' => Constants::OXID_MODULE_ID, 'id' => Constants::OXID_MODULE_ID,
'title' => 'Google Analytics 4', 'title' => 'Google Analytics 4',
'description' => "Dieses Modul bietet die Möglichkeit in Ihrem OXID eShop (6.x) die neue 'Property' '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> Google Analytics 4 (GA4) von Google zu integrieren.<br>
HierfĂĽr stehen Ihnen verschiedene 'templates' zur verfĂĽgung, HierfĂĽr stehen Ihnen verschiedene 'templates' zur verfĂĽgung,
@ -51,159 +49,135 @@ $aModule = [
<hr> <hr>
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a> Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a>
", ",
'thumbnail' => 'thumbnail.png', 'thumbnail' => 'thumbnail.png',
'version' => '3.0.0.1', 'version' => '2.18.2',
'author' => 'Data Development (Inh.: Thomas Dartsch)', 'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com', 'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/', 'url' => 'https://www.oxidmodule.com/',
'controllers' => [ 'controllers' => [
'd3googleanalytics4_main' => GA4AdminUserInterfaceMainController::class, 'd3googleanalytics4_main' => GA4AdminUserInterfaceMainController::class
], ],
'extend' => [ 'extend' => [
// Core // Core
OEViewConfig::class => ViewConfig::class, OEViewConfig::class => ViewConfig::class,
\OxidEsales\Eshop\Core\WidgetControl::class => \D3\GoogleAnalytics4\Modules\Core\WidgetControl::class,
// Model // Model
OECategory::class => Category::class, OECategory::class => Category::class,
OEBasket::class => Basket::class, OEBasket::class => Basket::class,
OEManufacturer::class => Manufacturer::class, OEManufacturer::class => Manufacturer::class,
OEPayment::class => gtmPayment::class,
// Controller // Controller
OEBasketController::class => BasketController::class, OEBasketController::class => BasketController::class,
OEThankYouController::class => ThankYouController::class, OEThankYouController::class => ThankYouController::class,
OEArticleListController::class => ArticleListController_AddToCartHelpMethods::class, OEArticleListController::class => ArticleListController_AddToCartHelpMethods::class,
OEArticleDetailsController::class => ArticleDetailsController::class, OEArticleDetailsController::class => ArticleDetailsController::class,
OEAccountNoticeListController::class => d3GtmAccountNoticeListController::class, OEAccountNoticeListController::class => d3GtmAccountNoticeListController::class,
OEAccountRecommlistController::class => d3GtmAccountRecommlistController::class, OEAccountRecommlistController::class => d3GtmAccountRecommlistController::class,
OEAccountWishlistController::class => d3GtmAccountWishlistController::class, OEAccountWishlistController::class => d3GtmAccountWishlistController::class,
OEStartController::class => d3GtmStartController::class, OEStartController::class => d3GtmStartController::class,
OESearchController::class => d3GtmSearchController::class, OESearchController::class => d3GtmSearchController::class,
OEManufacturerListController::class => d3GtmManufacturerListController::class, OEManufacturerListController::class => d3GtmManufacturerListController::class,
// Component // Component
OEArticleDetails::class => d3GtmWidgetArticleDetails::class, OEArticleDetails::class => d3GtmWidgetArticleDetails::class,
OEBasketComponent::class => d3GtmBasketComponentExtension::class, OEBasketComponent::class => d3GtmBasketComponentExtension::class,
], ],
'templates' => [ 'templates' => [
// Event files that store the GA4 Event-Information // Event files that store the GA4 Event-Information
'@' . Constants::OXID_MODULE_ID . '/event/add_to_cart.tpl' => 'views/smarty/event/add_to_cart.tpl', 'event/add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/event/add_to_cart.tpl',
'@' . Constants::OXID_MODULE_ID . '/event/view_item.tpl' => 'views/smarty/event/view_item.tpl', 'event/view_item.tpl' => 'd3/googleanalytics4/Application/views/event/view_item.tpl',
'@' . Constants::OXID_MODULE_ID . '/event/view_cart.tpl' => 'views/smarty/event/view_cart.tpl', 'event/view_cart.tpl' => 'd3/googleanalytics4/Application/views/event/view_cart.tpl',
'@' . Constants::OXID_MODULE_ID . '/event/begin_checkout.tpl' => 'views/smarty/event/begin_checkout.tpl', 'event/purchase.tpl' => 'd3/googleanalytics4/Application/views/event/purchase.tpl',
'@' . Constants::OXID_MODULE_ID . '/event/add_payment_info.tpl' => 'views/smarty/event/add_payment_info.tpl', 'event/view_item_list.tpl' => 'd3/googleanalytics4/Application/views/event/view_item_list.tpl',
'@' . Constants::OXID_MODULE_ID . '/event/purchase.tpl' => 'views/smarty/event/purchase.tpl', 'event/view_search_result.tpl' => 'd3/googleanalytics4/Application/views/event/view_search_result.tpl',
'@' . Constants::OXID_MODULE_ID . '/event/view_item_list.tpl' => 'views/smarty/event/view_item_list.tpl', 'event/remove_from_cart.tpl' => 'd3/googleanalytics4/Application/views/event/remove_from_cart.tpl',
'@' . Constants::OXID_MODULE_ID . '/event/view_search_result.tpl' => 'views/smarty/event/view_search_result.tpl',
'@' . Constants::OXID_MODULE_ID . '/event/remove_from_cart.tpl' => 'views/smarty/event/remove_from_cart.tpl',
// complete overwritten file of OXID-Originals // complete overwritten file of OXID-Originals
// the path of the template-name is the original path to the file in OXID-context from tpl/-> // the path of the template-name is the original path to the file in OXID-context from tpl/->
'@' . Constants::OXID_MODULE_ID . '/page/account/d3gtmnoticelist.tpl' => 'views/smarty/page/account/d3gtmnoticelist.tpl', 'page/account/d3gtmnoticelist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmnoticelist.tpl',
'@' . Constants::OXID_MODULE_ID . '/page/account/d3gtmrecommendationlist.tpl' => 'views/smarty/page/account/d3gtmrecommendationlist.tpl', 'page/account/d3gtmrecommendationlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmrecommendationlist.tpl',
'@' . Constants::OXID_MODULE_ID . '/page/account/d3gtmwishlist.tpl' => 'views/smarty/page/account/d3gtmwishlist.tpl', 'page/account/d3gtmwishlist.tpl' => 'd3/googleanalytics4/Application/views/tpl/page/account/d3gtmwishlist.tpl',
// Admin Templates // Admin Templates
'@' . Constants::OXID_MODULE_ID . '/admin/d3ga4uimain.tpl' => 'views/smarty/admin/d3googleanalytics4_main.tpl', 'ga4/admin/d3ga4uimain.tpl' => 'd3/googleanalytics4/Application/views/admin/tpl/d3googleanalytics4_main.tpl',
'@' . Constants::OXID_MODULE_ID . '/admin/d3ga4uiheaditem.tpl' => 'views/smarty/admin/d3googleanalytics4_headitem.tpl', 'ga4/admin/d3ga4uiheaditem.tpl' => 'd3/googleanalytics4/Application/views/admin/tpl/d3googleanalytics4_headitem.tpl',
], ],
'blocks' => [ 'blocks' => [
// tag manager js // tag manager js
[ [
'template' => 'layout/base.tpl', 'template' => 'layout/base.tpl',
'block' => 'head_meta_robots', 'block' => 'head_meta_robots',
'file' => 'views/smarty/blocks/_gtm_js.tpl', 'file' => '/Application/views/blocks/_gtm_js.tpl',
'position' => 150, 'position' => 150
], ],
// tag manager nojs // tag manager nojs
[ [
'template' => 'layout/base.tpl', 'template' => 'layout/base.tpl',
'block' => 'theme_svg_icons', 'block' => 'theme_svg_icons',
'file' => 'views/smarty/blocks/_gtm_nojs.tpl', 'file' => '/Application/views/blocks/_gtm_nojs.tpl'
'position' => 150,
], ],
// details // details
[ [
'template' => 'page/details/inc/productmain.tpl', 'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_title', 'block' => 'details_productmain_title',
'file' => 'views/smarty/blocks/view_item.tpl', 'file' => '/Application/views/blocks/view_item.tpl',
'position' => 150, 'position' => 150
], ],
// View Cart // checkout
[ [
'template' => 'page/checkout/basket.tpl', 'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_main', 'block' => 'checkout_basket_main',
'file' => 'views/smarty/blocks/view_cart.tpl', 'file' => '/Application/views/blocks/view_cart.tpl'
'position' => 150,
],
// add_to_cart
[
'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_tobasket',
'file' => 'views/smarty/blocks/details_productmain_tobasket.tpl',
'position' => 150,
],
// remove_from_cart
[
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_main',
'file' => 'views/smarty/blocks/remove_from_cart.tpl',
'position' => 150,
], ],
[ [
'template' => 'page/checkout/thankyou.tpl', 'template' => 'page/checkout/thankyou.tpl',
'block' => 'checkout_thankyou_main', 'block' => 'checkout_thankyou_main',
'file' => 'views/smarty/blocks/purchase.tpl', 'file' => '/Application/views/blocks/purchase.tpl'
'position' => 150,
], ],
// Lists // Lists
// view_item_list // view_item_list
[ [
'template' => 'page/list/list.tpl', 'template' => 'page/list/list.tpl',
'block' => 'page_list_productlist', 'block' => 'page_list_productlist',
'file' => 'views/smarty/blocks/view_item_list.tpl', 'file' => '/Application/views/blocks/view_item_list.tpl',
'position' => 150, 'position' => 150
], ],
// view_search_result // view_search_result
[ [
'template' => 'page/search/search.tpl', 'template' => 'page/search/search.tpl',
'block' => 'search_results', 'block' => 'search_results',
'file' => 'views/smarty/blocks/view_search_result.tpl', 'file' => '/Application/views/blocks/view_search_result.tpl',
'position' => 150, 'position' => 150
],
// add_to_cart
[
'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_tobasket',
'file' => '/Application/views/blocks/details_productmain_tobasket.tpl',
'position' => 150
], ],
[ [
'template' => 'page/list/list.tpl', 'template' => 'page/list/list.tpl',
'block' => 'page_list_listbody', 'block' => 'page_list_listbody',
'file' => 'views/smarty/blocks/page_list_listbody.tpl', 'file' => '/Application/views/blocks/page_list_listbody.tpl',
'position' => 150, 'position' => 150
], ],
[ [
'template' => 'page/shop/start.tpl', 'template' => 'page/shop/start.tpl',
'block' => 'start_welcome_text', 'block' => 'start_welcome_text',
'file' => 'views/smarty/blocks/start_welcome_text.tpl', 'file' => '/Application/views/blocks/start_welcome_text.tpl',
'position' => 150, 'position' => 150
], ],
// Checkout process // remove_from_cart
// Begin CHeckout
[ [
'template' => 'page/checkout/user.tpl', 'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_user_main', 'block' => 'checkout_basket_main',
'file' => 'views/smarty/blocks/begin_checkout.tpl', 'file' => '/Application/views/blocks/remove_from_cart.tpl',
'position' => 150, 'position' => 150
], ]
// Add payment info
// We add it into checkout_order_main ( checkout/order.tpl ) to make sure a payment is actually added;
// we'll also do it like that in the future for add_shipping_info ( not planed yet )
[
'template' => 'page/checkout/order.tpl',
'block' => 'checkout_order_main',
'file' => 'views/smarty/blocks/add_payment_info.tpl',
'position' => 150,
],
], ],
'events' => [ 'events' => [
'onActivate' => '\D3\GoogleAnalytics4\Setup\Events::onActivate', 'onActivate' => '\D3\GoogleAnalytics4\Setup\Events::onActivate',
'onDeactivate' => '\D3\GoogleAnalytics4\Setup\Events::onDeactivate', 'onDeactivate' => '\D3\GoogleAnalytics4\Setup\Events::onDeactivate',
], ],
]; ];

0
assets/thumbnail.png → thumbnail.png Normal file → Executable file
View File

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 31 KiB

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file="@d3googleanalytics4/event/add_payment_info.tpl"}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file="@d3googleanalytics4/event/begin_checkout.tpl"}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file='@d3googleanalytics4/event/add_to_cart.tpl' htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file='@d3googleanalytics4/event/add_to_cart.tpl' htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file="@d3googleanalytics4/event/purchase.tpl"}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file="@d3googleanalytics4/event/remove_from_cart.tpl"}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file='@d3googleanalytics4/event/add_to_cart.tpl' htmlIdAmountOfArticles='#amountToBasket'}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file="@d3googleanalytics4/event/view_cart.tpl"}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file="@d3googleanalytics4/event/view_item.tpl"}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file="@d3googleanalytics4/event/view_item_list.tpl"}]

View File

@ -1,3 +0,0 @@
[{$smarty.block.parent}]
[{include file="@d3googleanalytics4/event/view_search_result.tpl"}]

View File

@ -1,53 +0,0 @@
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
[{assign var="gtmBasketPrice" value=$oxcmp_basket->getPrice()}]
[{assign var="gtmBasketObject" value=$oxcmp_basket}]
[{assign var='gtmCartArticles' value=$gtmBasketObject->getBasketArticles()}]
[{assign var="gtmPaymentObject" value=$oView->getPayment()}]
[{block name="gtm_ga4_add_payment_info_block"}]
[{capture name="gtm_ga4_add_payment_info"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'add_payment_info',
'eventLabel':'Checkout - Payment info',
'payment_type':'[{$gtmPaymentObject->gtmGetSelectedPaymentName()}]',
'ecommerce':
{
'actionField': "Payment-Info",
'currency': "[{$currency->name}]",
'value': [{$gtmBasketPrice->getPrice()}],
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'items':
[
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
[{assign var="gtmItemPriceObject" value=$basketitem->getPrice()}]
[{assign var="gtmBasketItem" value=$basketitem->getArticle()}]
[{assign var="gtmBasketItemCategory" value=$gtmBasketItem->getCategory()}]
{
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
[{if $gtmBasketItemCategory}]
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0, true)}]',
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1, true)}]',
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2, true)}]',
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
[{/if}]
'price': [{$gtmItemPriceObject->getPrice()}],
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'quantity': [{$basketitem->getAmount()}],
'position': [{$smarty.foreach.gtmCartContents.index}]
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
[{/foreach}]
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.gtm_ga4_add_payment_info}]
[{/block}]

View File

@ -1,52 +0,0 @@
[{*$oxcmp_basket|get_class_methods|dumpvar*}]
[{assign var="d3BasketPrice" value=$oxcmp_basket->getPrice()}]
[{assign var="d3BasketObject" value=$oxcmp_basket}]
[{assign var='gtmCartArticles' value=$d3BasketObject->getBasketArticles()}]
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
[{block name="d3_ga4_begin_checkout_block"}]
[{capture name="d3_ga4_begin_checkout"}]
[{strip}]
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'begin_checkout',
'eventLabel':'Begin of checkout',
'ecommerce':
{
'actionField': "Begin",
'currency': "[{$gtmCurrency->name}]",
'value': [{$d3BasketPrice->getPrice()}],
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'items':
[
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
[{assign var="d3oItemPrice" value=$basketitem->getPrice()}]
[{assign var="gtmBasketItem" value=$basketitem->getArticle()}]
[{assign var="gtmBasketItemCategory" value=$gtmBasketItem->getCategory()}]
{
'item_id': '[{$gtmCartArticles[$basketindex]->getFieldData('oxartnum')}]',
'item_name': '[{$gtmCartArticles[$basketindex]->getFieldData('oxtitle')}]',
'item_variant': '[{$gtmCartArticles[$basketindex]->getFieldData('oxvarselect')}]',
[{if $gtmBasketItemCategory}]
'item_category': '[{$gtmBasketItemCategory->getSplitCategoryArray(0, true)}]',
'item_category_2': '[{$gtmBasketItemCategory->getSplitCategoryArray(1, true)}]',
'item_category_3': '[{$gtmBasketItemCategory->getSplitCategoryArray(2, true)}]',
'item_category_4': '[{$gtmBasketItemCategory->getSplitCategoryArray(3, true)}]',
'item_list_name': '[{$gtmBasketItemCategory->getSplitCategoryArray()}]',
[{/if}]
'price': [{$d3oItemPrice->getPrice()}],
'coupon': '[{foreach from=$oxcmp_basket->getVouchers() item=sVoucher key=key name=Voucher}][{$sVoucher->sVoucherNr}][{if !$smarty.foreach.Voucher.last}], [{/if}][{/foreach}]',
'quantity': [{$basketitem->getAmount()}],
'position': [{$smarty.foreach.gtmCartContents.index}]
}[{if !$smarty.foreach.gtmCartContents.last}],[{/if}]
[{/foreach}]
]
}[{if $oViewConf->isDebugModeOn()}],
'debug_mode': 'true'
[{/if}]
});
[{/strip}]
[{/capture}]
[{oxscript add=$smarty.capture.d3_ga4_begin_checkout}]
[{/block}]