Vergelijk commits
No commits in common. "2.4.0" and "2.3.3" have entirely different histories.
@ -1,12 +1,40 @@
|
||||
[{* Always prepare the data layer to avoid errors *}]
|
||||
<script>
|
||||
var dataLayer = [{$oViewConf->getGtmDataLayer()}] || [];
|
||||
</script>
|
||||
[{assign var="d3VtConfigObject" value=$oViewConf->getConfig()}]
|
||||
[{if $d3VtConfigObject->getConfigParam('d3_gtm_settings_hasOwnCookieManager')}]
|
||||
[{if $oViewConf->D3blAcceptedCookie($d3VtConfigObject->getConfigParam('d3_gtm_settings_cookieName'))}]
|
||||
|
||||
[{if $oViewConf->D3blShowGtmScript()}]
|
||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
||||
<!-- 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}]
|
||||
<!-- Google Tag Manager -->
|
||||
<script [{$oViewConf->getGtmScriptAttributes()}]>
|
||||
<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'});
|
||||
@ -17,15 +45,15 @@
|
||||
})(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}]
|
||||
[{/if}]
|
||||
[{/if}]
|
||||
|
||||
[{$smarty.block.parent}]
|
||||
[{$smarty.block.parent}]
|
||||
|
@ -1,12 +1,8 @@
|
||||
[{if $oViewConf->D3blShowGtmScript() && !$oViewConf->getCookieManagerType()}]
|
||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
||||
<!-- Google Tag Manager (noscript) -->
|
||||
<noscript>
|
||||
<iframe src="https://www.googletagmanager.com/ns.html?id=[{$oViewConf->getGtmContainerId()}]"
|
||||
height="0" width="0" style="display:none;visibility:hidden"></iframe>
|
||||
</noscript>
|
||||
<!-- End Google Tag Manager (noscript) -->
|
||||
[{/strip}][{/if}]
|
||||
[{/if}]
|
||||
|
||||
<!-- End Google Tag Manager (noscript) -->[{/strip}][{/if}]
|
||||
[{$smarty.block.parent}]
|
@ -4,14 +4,6 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [2.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
|
||||
|
@ -54,15 +54,12 @@ Aktivieren Sie anschließend diese Weiche. Setzen Sie den Haken bei "Eigenen Coo
|
||||
- [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
|
||||
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
||||
- Default-Werte sind entweder ```ANALYTICS``` oder ```MARKETING```. Bitte auf die Großschreibung achten.
|
||||
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
||||
|
||||
- [Netensio - Cookie Consent Manager](https://www.netensio.de/oxid-eshop-module/cookie-consent-manager-fuer-oxid-eshop.html)
|
||||
- Modul entsprechend konfigurieren
|
||||
- CookieID des angelegten Cookies in den Moduleinstellungen des 'Google Analytics 4' unter
|
||||
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
|
||||
|
||||
|
||||
- [OXID Cookie Management powered by usercentrics](https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html)
|
||||
- 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
|
||||
- soweit ich weiß nichts weiter?
|
||||
|
@ -22,7 +22,6 @@ class ViewConfig extends ViewConfig_parent
|
||||
|
||||
// Google Tag Manager Container ID
|
||||
private $sContainerId = null;
|
||||
private $sCookieManagerType = null;
|
||||
|
||||
public function getGtmContainerId()
|
||||
{
|
||||
@ -36,86 +35,27 @@ class ViewConfig extends ViewConfig_parent
|
||||
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
|
||||
*/
|
||||
public function D3blShowGtmScript()
|
||||
public function D3blAcceptedCookie($sCookieID)
|
||||
{
|
||||
$oConfig = $this->getConfig();
|
||||
$oSession = Registry::getSession();
|
||||
$aCookies = $oSession->getVariable("aCookieSel");
|
||||
|
||||
// No Cookie Manager in use
|
||||
if (!$oConfig->getConfigParam('d3_gtm_settings_hasOwnCookieManager')) {
|
||||
if (!is_null($aCookies) && is_array($aCookies) && array_key_exists($sCookieID, $aCookies) && $aCookies[$sCookieID] == "1") {
|
||||
return true;
|
||||
}
|
||||
|
||||
$sCookieID = $oConfig->getConfigParam('d3_gtm_settings_cookieName');
|
||||
|
||||
// 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);
|
||||
}
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
public function isGA4enabled()
|
||||
|
@ -17,7 +17,7 @@ $aModule = [
|
||||
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a>
|
||||
",
|
||||
'thumbnail' => 'thumbnail.png',
|
||||
'version' => '2.4.0',
|
||||
'version' => '2.3.3',
|
||||
'author' => 'Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
|
Laden…
Verwijs in nieuw issue
Block a user