Compare commits
38 Commits
Author | SHA1 | Date | |
---|---|---|---|
27798703b0 | |||
8eb734be8a | |||
527eec1355 | |||
1966d3008e | |||
bd51b37159 | |||
d4df87bfff | |||
63007e9b02 | |||
5fe656988c | |||
2f6fd8a31c | |||
8f9ed021d6 | |||
0ef3d3373a | |||
fd2b4a5bbe | |||
1c45a16356 | |||
1589f202a9 | |||
55bd7b7fb4 | |||
3c1e6a11ff | |||
9ac78a0d43 | |||
e2bcb34051 | |||
4ea0c19d7b | |||
56740f1f10 | |||
daed30a585 | |||
48d411ac3f | |||
b530366cb8 | |||
975d07056a | |||
24bf113d30 | |||
ca6a810fa3 | |||
62b382eadf | |||
45d8e45137 | |||
70f2308575 | |||
6eb15ec080 | |||
d722c46a74 | |||
d847a34e99 | |||
7b55d1d57c | |||
a25be1069c | |||
5200232a32 | |||
bcd785774b | |||
5ba613df30 | |||
a1dc0a6a58 |
@ -1,16 +1,13 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This Software is the property of Data Development and is protected
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* by copyright law - it is NOT Freeware.
|
* file that was distributed with this source code.
|
||||||
* Any unauthorized use of this software without a valid license
|
*
|
||||||
* is a violation of the license agreement and will be prosecuted by
|
* https://www.d3data.de
|
||||||
* civil and criminal law.
|
|
||||||
* http://www.shopmodule.com
|
|
||||||
*
|
*
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||||
* @link http://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
$style = '<style type="text/css">
|
$style = '<style type="text/css">
|
||||||
|
@ -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}]
|
@ -1,25 +0,0 @@
|
|||||||
[{$smarty.block.parent}]
|
|
||||||
[{assign var="gtmProduct" value=$oView->getProduct()}]
|
|
||||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
|
||||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
|
||||||
|
|
||||||
<script>
|
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
|
||||||
dataLayer.push({
|
|
||||||
'event': 'view_item',
|
|
||||||
'eventLabel':'Product View',
|
|
||||||
'ecommerce': {
|
|
||||||
'currency': '[{$currency->name}]',
|
|
||||||
'items': [
|
|
||||||
{
|
|
||||||
'item_name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
|
|
||||||
'item_id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
|
|
||||||
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
|
||||||
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
|
||||||
'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
|
|
||||||
'price': [{$gtmProduct->oxarticles__oxprice->value}]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
25
Application/views/blocks/view_item.tpl
Normal file
25
Application/views/blocks/view_item.tpl
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
[{$smarty.block.parent}]
|
||||||
|
[{assign var="gtmProduct" value=$oView->getProduct()}]
|
||||||
|
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
||||||
|
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
||||||
|
|
||||||
|
<script>
|
||||||
|
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
||||||
|
dataLayer.push({
|
||||||
|
'event': 'view_item',
|
||||||
|
'eventLabel':'Product View',
|
||||||
|
'ecommerce': {
|
||||||
|
'currency': '[{$currency->name}]',
|
||||||
|
'items': [
|
||||||
|
{
|
||||||
|
'item_name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
|
||||||
|
'item_id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
|
||||||
|
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
||||||
|
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
||||||
|
'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
|
||||||
|
'price': [{$gtmProduct->oxarticles__oxprice->value}]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
});
|
||||||
|
</script>
|
@ -1,35 +0,0 @@
|
|||||||
[{$smarty.block.parent}]
|
|
||||||
[{assign var="gtmProduct" value=$oView->getProduct()}]
|
|
||||||
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
|
|
||||||
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
|
|
||||||
<script>
|
|
||||||
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
|
|
||||||
dataLayer.push({
|
|
||||||
'event': 'ee.impression',
|
|
||||||
'eventLabel':'Impression',
|
|
||||||
'ecommerce': {
|
|
||||||
'currencyCode': '[{$currency->name}]',
|
|
||||||
'impressions': [
|
|
||||||
{
|
|
||||||
'name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
|
|
||||||
'id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
|
|
||||||
'price': [{$gtmProduct->oxarticles__oxprice->value}],
|
|
||||||
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
|
|
||||||
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
|
||||||
'variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]'
|
|
||||||
[{if $list && $position}],
|
|
||||||
'list': '[{$list}]',
|
|
||||||
'position': [{"_"|str_replace:"":$position}]
|
|
||||||
[{/if}]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
<!--
|
|
||||||
sWidgetType [{$sWidgetType}] | [{$oView->getViewParameter('sWidgetType')}]
|
|
||||||
sListType [{$sListType}] | [{$oView->getViewParameter('sListType')}]
|
|
||||||
iIndex [{$iIndex}] | [{$oView->getIndex()}]
|
|
||||||
listId [{$listId}] | [{$oView->getViewParameter('listId')}]
|
|
||||||
testid [{$testid}] | [{$oView->getViewParameter('testid')}]
|
|
||||||
-->
|
|
@ -5,6 +5,8 @@
|
|||||||
[{capture assign=d3_ga4_add_to_cart}]
|
[{capture assign=d3_ga4_add_to_cart}]
|
||||||
[{block name="d3_ga4_add_to_basket"}]
|
[{block name="d3_ga4_add_to_basket"}]
|
||||||
$("#toBasket").click(function(event) {
|
$("#toBasket").click(function(event) {
|
||||||
|
|
||||||
|
[{*** Debug cases ***}]
|
||||||
[{*event.preventDefault();*}]
|
[{*event.preventDefault();*}]
|
||||||
|
|
||||||
let iArtQuantity = $("#amountToBasket").val();
|
let iArtQuantity = $("#amountToBasket").val();
|
||||||
@ -28,7 +30,6 @@
|
|||||||
'item_category_3':itemCategories[2] || '',
|
'item_category_3':itemCategories[2] || '',
|
||||||
'item_category_4':itemCategories[3] || '',
|
'item_category_4':itemCategories[3] || '',
|
||||||
[{if false}]
|
[{if false}]
|
||||||
[{* ??? what *}]
|
|
||||||
'item_list_name': 'Search Results', // If associated with a list selection.
|
'item_list_name': 'Search Results', // If associated with a list selection.
|
||||||
'item_list_id': 'SR123', // If associated with a list selection.
|
'item_list_id': 'SR123', // If associated with a list selection.
|
||||||
'index': 1, // If associated with a list selection.
|
'index': 1, // If associated with a list selection.
|
||||||
|
46
CHANGELOG.md
46
CHANGELOG.md
@ -4,6 +4,47 @@ 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).
|
||||||
|
|
||||||
|
## [2.4.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.3.3...2.4.0) - 2023-05-02
|
||||||
|
### Added
|
||||||
|
- "OXID Cookie Management powered by usercentrics" compatibility
|
||||||
|
- usercentrics defined script attributes
|
||||||
|
- cookie-manager evaluation
|
||||||
|
### Changed
|
||||||
|
- genuine clean up of base-js-files
|
||||||
|
|
||||||
|
## [2.3.3](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.3.2...2.3.3) - 2023-03-20
|
||||||
|
### Fixed
|
||||||
|
- metadata file path for view_item
|
||||||
|
|
||||||
|
## [2.3.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.2.2...2.3.2) - 2023-03-17
|
||||||
|
### Added
|
||||||
|
- Aggrosoft-Cookie-Consent compatibility
|
||||||
|
### Fixed
|
||||||
|
- wrong function for pageview on thankyou page
|
||||||
|
### Deleted
|
||||||
|
- unused files
|
||||||
|
|
||||||
|
## [2.2.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.2.1...2.2.2) - 2023-02-22
|
||||||
|
### Fixed
|
||||||
|
- price formatting in view_cart
|
||||||
|
|
||||||
|
## [2.2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.1.1...2.2.1) - 2023-02-21
|
||||||
|
### Added
|
||||||
|
- cookie handling
|
||||||
|
|
||||||
|
## [2.1.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.1...2.1.1) - 2023-01-27
|
||||||
|
### Fixed
|
||||||
|
- add missing class import
|
||||||
|
|
||||||
|
## [2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.0...2.1) - 2023-01-27
|
||||||
|
### Added
|
||||||
|
- block section for add_to_basket js
|
||||||
|
- template block order positions
|
||||||
|
|
||||||
|
## [2.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...2.0) - 2023-01-20
|
||||||
|
### Added
|
||||||
|
- using of ContainerFactory in ViewConfig
|
||||||
|
|
||||||
## [1.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
|
||||||
@ -12,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 in view_cart
|
- price formatting 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
|
||||||
@ -26,6 +67,7 @@ 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
|
@ -1,65 +1,131 @@
|
|||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* This Software is the property of Data Development and is protected
|
* For the full copyright and license information, please view the LICENSE
|
||||||
* by copyright law - it is NOT Freeware.
|
* file that was distributed with this source code.
|
||||||
* Any unauthorized use of this software without a valid license
|
*
|
||||||
* is a violation of the license agreement and will be prosecuted by
|
* https://www.d3data.de
|
||||||
* civil and criminal law.
|
*
|
||||||
* http://www.shopmodule.com
|
|
||||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
|
||||||
* @link http://www.oxidmodule.com
|
* @link https://www.oxidmodule.com
|
||||||
*/
|
*/
|
||||||
|
|
||||||
namespace D3\GoogleAnalytics4\Modules\Core;
|
namespace D3\GoogleAnalytics4\Modules\Core;
|
||||||
|
|
||||||
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
use OxidEsales\Eshop\Application\Controller\FrontendController;
|
||||||
use OxidEsales\Eshop\Core\Registry;
|
use OxidEsales\Eshop\Core\Registry;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Container\ContainerFactory;
|
||||||
|
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Bridge\ModuleSettingBridgeInterface;
|
||||||
|
|
||||||
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;
|
||||||
|
private $sCookieManagerType = null;
|
||||||
|
|
||||||
public function getGtmContainerId()
|
public function getGtmContainerId()
|
||||||
{
|
{
|
||||||
if ($this->sContainerId === null)
|
if ($this->sContainerId === null)
|
||||||
{
|
{
|
||||||
|
$this->sContainerId = ContainerFactory::getInstance()
|
||||||
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_sContainerID');
|
->getContainer()
|
||||||
|
->get(ModuleSettingBridgeInterface::class)
|
||||||
|
->get('d3_gtm_sContainerID', 'd3googleanalytics4');
|
||||||
}
|
}
|
||||||
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()
|
||||||
{
|
{
|
||||||
if ($this->blGA4enabled === null)
|
if ($this->blGA4enabled === null)
|
||||||
{
|
{
|
||||||
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_blEnableGA4');
|
$this->sContainerId = ContainerFactory::getInstance()
|
||||||
|
->getContainer()
|
||||||
|
->get(ModuleSettingBridgeInterface::class)
|
||||||
|
->get('d3_gtm_blEnableGA4', 'd3googleanalytics4');
|
||||||
}
|
}
|
||||||
|
|
||||||
return $this->blGA4enabled;
|
return $this->blGA4enabled;
|
||||||
@ -72,7 +138,6 @@ class ViewConfig extends ViewConfig_parent
|
|||||||
$oConfig = Registry::getConfig();
|
$oConfig = Registry::getConfig();
|
||||||
$oView = $oConfig->getTopActiveView();
|
$oView = $oConfig->getTopActiveView();
|
||||||
/** @var FrontendController $oShop */
|
/** @var FrontendController $oShop */
|
||||||
|
|
||||||
$oUser = $oConfig->getUser();
|
$oUser = $oConfig->getUser();
|
||||||
|
|
||||||
$cl = $this->getTopActiveClassName();
|
$cl = $this->getTopActiveClassName();
|
||||||
|
@ -23,7 +23,7 @@ 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:^1
|
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.
|
||||||
|
@ -45,7 +45,7 @@
|
|||||||
},
|
},
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.1",
|
"php": ">=7.1",
|
||||||
"oxid-esales/oxideshop-ce": "v6.0 - 6.3",
|
"oxid-esales/oxideshop-ce": "^6.5",
|
||||||
"google/apiclient":" ^2.0"
|
"google/apiclient":" ^2.0"
|
||||||
},
|
},
|
||||||
"autoload": {
|
"autoload": {
|
||||||
|
29
metadata.php
29
metadata.php
@ -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>
|
Die Entwicklung basiert auf einem Fork von Marat Bedoev - <a href='https://github.com/vanilla-thunder/oxid-module-gtm'>Github-Link</a>
|
||||||
",
|
",
|
||||||
'thumbnail' => 'thumbnail.png',
|
'thumbnail' => 'thumbnail.png',
|
||||||
'version' => '1.3.1',
|
'version' => '2.4.0',
|
||||||
'author' => 'Data Development (Inh.: Thomas Dartsch)',
|
'author' => 'Data Development (Inh.: Thomas Dartsch)',
|
||||||
'email' => 'support@shopmodule.com',
|
'email' => 'support@shopmodule.com',
|
||||||
'url' => 'https://www.oxidmodule.com/',
|
'url' => 'https://www.oxidmodule.com/',
|
||||||
@ -43,30 +43,25 @@ $aModule = [
|
|||||||
'block' => 'theme_svg_icons',
|
'block' => 'theme_svg_icons',
|
||||||
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
|
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
|
||||||
],
|
],
|
||||||
// widget_product_list
|
// checkout
|
||||||
|
// view_cart
|
||||||
[
|
[
|
||||||
'template' => 'widget/product/list.tpl',
|
'template' => 'page/checkout/basket.tpl',
|
||||||
'block' => 'widget_product_list',
|
'block' => 'checkout_basket_main',
|
||||||
'file' => '/Application/views/blocks/widget_product_list.tpl'
|
'file' => '/Application/views/blocks/checkout_s1.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/detail.tpl',
|
'file' => '/Application/views/blocks/view_item.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
|
||||||
[
|
[
|
||||||
|
Reference in New Issue
Block a user