Merge branch 'rel_1.x'
# Conflicts: # CHANGELOG.md # metadata.php
This commit is contained in:
commit
af341a984b
@ -1,40 +1,12 @@
|
|||||||
[{assign var="d3VtConfigObject" value=$oViewConf->getConfig()}]
|
[{* Always prepare the data layer to avoid errors *}]
|
||||||
[{if $d3VtConfigObject->getConfigParam('d3_gtm_settings_hasOwnCookieManager')}]
|
<script>
|
||||||
[{if $oViewConf->D3blAcceptedCookie($d3VtConfigObject->getConfigParam('d3_gtm_settings_cookieName'))}]
|
var dataLayer = [{$oViewConf->getGtmDataLayer()}] || [];
|
||||||
|
</script>
|
||||||
|
|
||||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
[{if $oViewConf->D3blShowGtmScript()}]
|
||||||
<!-- Google Tag Manager -->
|
|
||||||
<script>
|
|
||||||
var dataLayer = [{$oViewConf->getGtmDataLayer()}] || [];
|
|
||||||
(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 -->
|
|
||||||
[{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}]
|
|
||||||
[{else}]
|
|
||||||
<script>
|
|
||||||
var dataLayer = [{$oViewConf->getGtmDataLayer()}] || [];
|
|
||||||
</script>
|
|
||||||
[{/if}]
|
|
||||||
[{else}]
|
|
||||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
||||||
<!-- Google Tag Manager -->
|
<!-- Google Tag Manager -->
|
||||||
<script>
|
<script [{$oViewConf->getGtmScriptAttributes()}]>
|
||||||
var dataLayer = [{$oViewConf->getGtmDataLayer()}] || [];
|
|
||||||
(function (w, d, s, l, i) {
|
(function (w, d, s, l, i) {
|
||||||
w[l] = w[l] || [];
|
w[l] = w[l] || [];
|
||||||
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
|
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
|
||||||
@ -45,15 +17,15 @@
|
|||||||
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
|
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
|
||||||
</script>
|
</script>
|
||||||
<!-- End Google Tag Manager -->
|
<!-- End Google Tag Manager -->
|
||||||
|
|
||||||
[{if $oViewConf->getTopActionClassName() === "alist" }]
|
[{if $oViewConf->getTopActionClassName() === "alist" }]
|
||||||
[{* include file="ga4_view_item_list.tpl" gtmCategory=$oView->getActiveCategory() gtmProducts=$oView->getArticleList() listtype=$oView->getListType() *}]
|
[{* include file="ga4_view_item_list.tpl" gtmCategory=$oView->getActiveCategory() gtmProducts=$oView->getArticleList() listtype=$oView->getListType() *}]
|
||||||
[{elseif $oViewConf->getTopActionClassName() === "details" }]
|
[{elseif $oViewConf->getTopActionClassName() === "details" }]
|
||||||
[{* include file="ga4_view_item.tpl" gtmProduct=$oView->getProduct() *}]
|
[{* include file="ga4_view_item.tpl" gtmProduct=$oView->getProduct() *}]
|
||||||
[{elseif $oViewConf->getTopActionClassName() === "search" }]
|
[{elseif $oViewConf->getTopActionClassName() === "search" }]
|
||||||
[{elseif $oViewConf->getTopActionClassName() === "basket" }]
|
[{elseif $oViewConf->getTopActionClassName() === "basket" }]
|
||||||
|
|
||||||
[{/if}]
|
[{/if}]
|
||||||
[{/strip}][{/if}]
|
[{/strip}][{/if}]
|
||||||
[{/if}]
|
[{/if}]
|
||||||
|
|
||||||
[{$smarty.block.parent}]
|
[{$smarty.block.parent}]
|
@ -1,8 +1,12 @@
|
|||||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
[{if $oViewConf->D3blShowGtmScript() && !$oViewConf->getCookieManagerType()}]
|
||||||
|
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
||||||
<!-- Google Tag Manager (noscript) -->
|
<!-- Google Tag Manager (noscript) -->
|
||||||
<noscript>
|
<noscript>
|
||||||
<iframe src="https://www.googletagmanager.com/ns.html?id=[{$oViewConf->getGtmContainerId()}]"
|
<iframe src="https://www.googletagmanager.com/ns.html?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) -->[{/strip}][{/if}]
|
<!-- End Google Tag Manager (noscript) -->
|
||||||
|
[{/strip}][{/if}]
|
||||||
|
[{/if}]
|
||||||
|
|
||||||
[{$smarty.block.parent}]
|
[{$smarty.block.parent}]
|
13
CHANGELOG.md
13
CHANGELOG.md
@ -37,6 +37,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Added
|
### Added
|
||||||
- using of ContainerFactory in ViewConfig
|
- using of ContainerFactory in ViewConfig
|
||||||
|
|
||||||
|
## [1.4.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.3.1...1.4.0) - 2023-05-02
|
||||||
|
### Added
|
||||||
|
- "OXID Cookie Management powered by usercentrics" compatibility
|
||||||
|
- usercentrics defined script attributes
|
||||||
|
- cookie-manager evaluation
|
||||||
|
### Changed
|
||||||
|
- genuine clean up of base-js-files
|
||||||
|
|
||||||
## [1.3.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2.1...1.3.1) - 2023-03-17
|
## [1.3.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2.1...1.3.1) - 2023-03-17
|
||||||
### Added
|
### Added
|
||||||
- Aggrosoft-Cookie-Consent compatibility
|
- Aggrosoft-Cookie-Consent compatibility
|
||||||
@ -45,7 +53,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [1.2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2...1.2.1) - 2023-02-22
|
## [1.2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2...1.2.1) - 2023-02-22
|
||||||
### Fixed
|
### Fixed
|
||||||
- price formatting view_cart
|
- price formatting in view_cart
|
||||||
|
|
||||||
## [1.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...1.2) - 2023-02-01
|
## [1.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...1.2) - 2023-02-01
|
||||||
### Added
|
### Added
|
||||||
@ -59,7 +67,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
### Changed
|
### Changed
|
||||||
- switched price formatting
|
- switched price formatting
|
||||||
|
|
||||||
|
## [1.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.0...1.0) - 2023-01-20
|
||||||
## [1.0](https://git.d3data.de/D3Public/GoogleAnalytics4/releases/tag/1.0) - 2023-01-20
|
|
||||||
### Added
|
### Added
|
||||||
- publication of app features
|
- publication of app features
|
@ -54,12 +54,15 @@ Aktivieren Sie anschließend diese Weiche. Setzen Sie den Haken bei "Eigenen Coo
|
|||||||
- [aggrosoft - oxid-cookie-compliance](https://github.com/aggrosoft/oxid-cookie-compliance)
|
- [aggrosoft - oxid-cookie-compliance](https://github.com/aggrosoft/oxid-cookie-compliance)
|
||||||
- https://github.com/aggrosoft/oxid-cookie-compliance
|
- https://github.com/aggrosoft/oxid-cookie-compliance
|
||||||
- die entsprechend gewählte Kategorie in den Moduleinstellungen des 'Google Analytics 4' unter
|
- die entsprechend gewählte Kategorie in den Moduleinstellungen des 'Google Analytics 4' unter
|
||||||
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
||||||
|
- Default-Werte sind entweder ```ANALYTICS``` oder ```MARKETING```. Bitte auf die Großschreibung achten.
|
||||||
|
|
||||||
- [Netensio - Cookie Consent Manager](https://www.netensio.de/oxid-eshop-module/cookie-consent-manager-fuer-oxid-eshop.html)
|
- [Netensio - Cookie Consent Manager](https://www.netensio.de/oxid-eshop-module/cookie-consent-manager-fuer-oxid-eshop.html)
|
||||||
- Modul entsprechend konfigurieren
|
- Modul entsprechend konfigurieren
|
||||||
- CookieID des angelegten Cookies in den Moduleinstellungen des 'Google Analytics 4' unter
|
- CookieID des angelegten Cookies in den Moduleinstellungen des 'Google Analytics 4' unter
|
||||||
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
||||||
|
|
||||||
- [OXID Cookie Management powered by usercentrics](https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html)
|
- [OXID Cookie Management powered by usercentrics](https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html)
|
||||||
- soweit ich weiß nichts weiter?
|
- In der Usercentrics-Verwaltung einen Service für Google Analytics anlegen
|
||||||
|
- Den Service-Namen in den Moduleinstellungen des 'Google Analytics 4' unter
|
||||||
|
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
@ -22,6 +22,7 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
|
|
||||||
// Google Tag Manager Container ID
|
// Google Tag Manager Container ID
|
||||||
private $sContainerId = null;
|
private $sContainerId = null;
|
||||||
|
private $sCookieManagerType = null;
|
||||||
|
|
||||||
public function getGtmContainerId()
|
public function getGtmContainerId()
|
||||||
{
|
{
|
||||||
@ -35,27 +36,86 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
return $this->sContainerId;
|
return $this->sContainerId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function getCookieManagerType()
|
||||||
|
{
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return $this->sCookieManagerType;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $sCookieID
|
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
public function D3blAcceptedCookie($sCookieID)
|
public function D3blShowGtmScript()
|
||||||
{
|
{
|
||||||
$oSession = Registry::getSession();
|
$oConfig = $this->getConfig();
|
||||||
$aCookies = $oSession->getVariable("aCookieSel");
|
|
||||||
|
|
||||||
if (!is_null($aCookies) && is_array($aCookies) && array_key_exists($sCookieID, $aCookies) && $aCookies[$sCookieID] == "1") {
|
// No Cookie Manager in use
|
||||||
|
if (!$oConfig->getConfigParam('d3_gtm_settings_hasOwnCookieManager')) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Aggrosoft Cookie Consent
|
$sCookieID = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||||
if (method_exists($this, "isCookieCategoryEnabled")) {
|
|
||||||
return $this->isCookieCategoryEnabled($sCookieID);
|
// Netensio Cookie Manager
|
||||||
|
if ($this->getCookieManagerType() == "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");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Aggrosoft Cookie Consent
|
||||||
|
if ($this->getCookieManagerType() == "agcookiecompliance") {
|
||||||
|
if (method_exists($this, "isCookieCategoryEnabled")) {
|
||||||
|
return $this->isCookieCategoryEnabled($sCookieID);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// UserCentrics
|
||||||
|
if ($this->getCookieManagerType() == "oxps_usercentrics") {
|
||||||
|
// Always needs the script-tags delivered to the DOM.
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Cookie Manager not (yet) supported
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get additional attributes for script tags.
|
||||||
|
* This is especially important for UserCentrics.
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public function getGtmScriptAttributes()
|
||||||
|
{
|
||||||
|
if ($this->getCookieManagerType() == "oxps_usercentrics") {
|
||||||
|
$oConfig = $this->getConfig();
|
||||||
|
$sCookieId = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||||
|
|
||||||
|
if ($sCookieId) {
|
||||||
|
return 'type="text/plain" data-usercentrics="' . $sCookieId . '"';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
||||||
private $blGA4enabled = null;
|
private $blGA4enabled = null;
|
||||||
|
|
||||||
public function isGA4enabled()
|
public function isGA4enabled()
|
||||||
|
27
metadata.php
27
metadata.php
@ -43,25 +43,30 @@ $aModule = [
|
|||||||
'block' => 'theme_svg_icons',
|
'block' => 'theme_svg_icons',
|
||||||
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
|
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
|
||||||
],
|
],
|
||||||
// checkout
|
// widget_product_list
|
||||||
// view_cart
|
|
||||||
[
|
[
|
||||||
'template' => 'page/checkout/basket.tpl',
|
'template' => 'widget/product/list.tpl',
|
||||||
'block' => 'checkout_basket_main',
|
'block' => 'widget_product_list',
|
||||||
'file' => '/Application/views/blocks/checkout_s1.tpl'
|
'file' => '/Application/views/blocks/widget_product_list.tpl'
|
||||||
],
|
|
||||||
[
|
|
||||||
'template' => 'page/checkout/thankyou.tpl',
|
|
||||||
'block' => 'checkout_thankyou_main',
|
|
||||||
'file' => '/Application/views/blocks/checkout_s5.tpl'
|
|
||||||
],
|
],
|
||||||
// details
|
// details
|
||||||
[
|
[
|
||||||
'template' => 'page/details/inc/productmain.tpl',
|
'template' => 'page/details/inc/productmain.tpl',
|
||||||
'block' => 'details_productmain_title',
|
'block' => 'details_productmain_title',
|
||||||
'file' => '/Application/views/blocks/view_item.tpl',
|
'file' => '/Application/views/blocks/detail.tpl',
|
||||||
'position' => 150
|
'position' => 150
|
||||||
],
|
],
|
||||||
|
// checkout
|
||||||
|
[
|
||||||
|
'template' => 'page/checkout/basket.tpl',
|
||||||
|
'block' => 'checkout_basket_main',
|
||||||
|
'file' => '/Application/views/blocks/checkout_s1.tpl'
|
||||||
|
],
|
||||||
|
[
|
||||||
|
'template' => 'page/checkout/thankyou.tpl',
|
||||||
|
'block' => 'checkout_thankyou_main',
|
||||||
|
'file' => '/Application/views/blocks/checkout_s5.tpl'
|
||||||
|
],
|
||||||
// Lists
|
// Lists
|
||||||
// view_item_list
|
// view_item_list
|
||||||
[
|
[
|
||||||
|
Loading…
Reference in New Issue
Block a user