Compare commits

..

49 Commits
1.1 ... 2.4.0

Author SHA1 Message Date
27798703b0 bump version && changelog to 2.4.0 2023-05-02 14:36:52 +02:00
8eb734be8a OXID UserCentrics support, general overhaul for cookie managers 2023-05-02 14:28:47 +02:00
527eec1355 bump changelog 2023-03-20 11:01:03 +01:00
1966d3008e Merge remote-tracking branch 'remotes/origin/rel_2.x_custB' into rel_2.x 2023-03-20 10:56:29 +01:00
bd51b37159 hot-fix: add missing view_item file; add metadata entry 2023-03-20 09:49:49 +01:00
d4df87bfff Merge remote-tracking branch 'remotes/origin/rel_1.x' into rel_2.x 2023-03-17 15:30:03 +01:00
4222c947a9 bump versions and changelog 2023-03-17 14:49:49 +01:00
d8fa06233b adjust translation 2023-03-17 14:49:28 +01:00
4e0988307a bump readme files 2023-03-17 14:03:53 +01:00
0e55c3e38f add: Aggrosoft-Cookie-Consent compatibility 2023-03-17 10:59:50 +01:00
13df965a03 bug-fix: wrong function for pageview on thankyou page 2023-03-17 08:58:15 +01:00
1ff6f0159f rm overblowing files 2023-03-16 10:59:39 +01:00
63007e9b02 bump version 2023-03-10 11:25:12 +01:00
5fe656988c genuine cleaning off of unnecessary files (prevent confusion) 2023-03-10 11:22:49 +01:00
2f6fd8a31c bump version 2023-02-22 14:31:28 +01:00
707e389f54 bump version 2023-02-22 14:21:24 +01:00
98533cf7f7 add special price formatting 2023-02-22 14:19:38 +01:00
8f9ed021d6 bump version 2023-02-22 14:07:14 +01:00
0ef3d3373a Merge remote-tracking branch 'remotes/origin/dev/view_cart/illegal_character_U+20AC' into rel_2.x 2023-02-22 14:05:56 +01:00
fd2b4a5bbe add special price formatting 2023-02-22 13:46:27 +01:00
1c45a16356 bump version 2023-02-21 12:27:52 +01:00
1589f202a9 add own cookie-check method; rm unnecessary help-text 2023-02-21 12:09:04 +01:00
25234abfd8 bump version 2023-02-01 15:42:59 +01:00
667b48ac4b rm unnecessary hint 2023-02-01 15:33:52 +01:00
5e358fc684 add own cookie-check method; rm unnecessary help-text 2023-02-01 15:32:28 +01:00
55bd7b7fb4 adjust module_options meta-docs 2023-02-01 14:27:49 +01:00
3c1e6a11ff bump version 2023-01-27 13:47:13 +01:00
9ac78a0d43 OST:#573111 fix bug - missing use 2023-01-27 13:43:29 +01:00
e2bcb34051 bump version 2023-01-27 11:11:09 +01:00
4ea0c19d7b Merge remote-tracking branch 'remotes/origin/rel_1.x' into rel_2.x 2023-01-27 11:04:23 +01:00
56740f1f10 rm unnecessary method call in gtm_js.tpl 2023-01-27 09:19:05 +01:00
daed30a585 rm unnecessary entries in metadata 2023-01-27 09:07:22 +01:00
48d411ac3f switch head-meta-infos 2023-01-27 09:07:09 +01:00
b530366cb8 rm unnecessary lang file 2023-01-27 09:06:49 +01:00
975d07056a cleaning off branding 2023-01-27 08:59:06 +01:00
24bf113d30 switch comment in changelog of 2.0 2023-01-26 09:20:56 +01:00
ca6a810fa3 add 1.0 section to changelog 2023-01-26 09:16:51 +01:00
62b382eadf adding tech-docs; rm unnecessary sections in readme; fixing wrong links 2023-01-26 09:15:10 +01:00
45d8e45137 fix missing entries in changelog 2023-01-25 10:58:24 +01:00
70f2308575 extend changelog and readme 2023-01-25 10:48:02 +01:00
6eb15ec080 add block description 2023-01-20 14:31:39 +01:00
d722c46a74 bump metadata-version 2023-01-20 11:26:09 +01:00
d847a34e99 set compatibility to oxid 6.5 and above 2023-01-20 11:24:30 +01:00
7b55d1d57c adjust requirements 2023-01-20 11:18:48 +01:00
a25be1069c rework code to actually fit 6.0.x && 6.1x 2023-01-20 11:18:17 +01:00
5200232a32 Merge remote-tracking branch 'remotes/origin/rel_1.x' into dev_1.x_OXID_6.3 2023-01-20 11:11:17 +01:00
bcd785774b adjusting composer.json to fit corresponding shop-version 2022-12-22 08:56:45 +01:00
5ba613df30 add currency to the params 2022-12-21 11:12:35 +01:00
a1dc0a6a58 fix bug that'd fail in wave and fail iIndex 2022-12-09 14:51:45 +01:00
33 changed files with 249 additions and 368 deletions

View File

@ -1,16 +1,13 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
* http://www.shopmodule.com
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
$style = '<style type="text/css">
@ -33,14 +30,6 @@ $aLang = [
// for cookie manager settings
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Eigenen Cookie Manager nutzen?
<strong style="color: red">Hinweis (Fragezeichen) lesen!</strong>',
'HELP_SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Stellen Sie sicher, dass Sie ein Modul installiert haben,
dass die Methode "blAcceptedCookie" implementiert.<br> Sollten Sie sich nicht sicher sein kontaktieren Sie Ihren
technischen Ansprechpartner.<br><br>
<strong>Wichtig!</strong> Das Aktivieren dieser Checkbox kann <u>ohne dem nötigen technischen Wissen</u> den Shop-Ablauf im Frontend stören!<hr>
Die Checkbox muss nicht aktiviert werden, sofern die Cookies beispielsweise direkt via Google Cookie-Banner integriert werden.
Bei Fragen <u>kontaktieren Sie bitte</u> auch hier einen entsprechenden technischen Ansprechpartner.',
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'Cookie-Name',
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Cookie Manager nutzen?',
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'CookieID',
];

View File

@ -1,40 +1,12 @@
[{assign var="d3VtConfigObject" value=$oViewConf->getConfig()}]
[{if $d3VtConfigObject->getConfigParam('d3_gtm_settings_hasOwnCookieManager')}]
[{if $oViewConf->blAcceptedCookie($d3VtConfigObject->getConfigParam('d3_gtm_settings_cookieName'))}]
[{* Always prepare the data layer to avoid errors *}]
<script>
var dataLayer = [{$oViewConf->getGtmDataLayer()}] || [];
</script>
[{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->D3blShowGtmScript()}]
[{if $oViewConf->getGtmContainerId()}][{strip}]
<!-- Google Tag Manager -->
<script>
var dataLayer = [{$oViewConf->getGtmDataLayer()}] || [];
<script [{$oViewConf->getGtmScriptAttributes()}]>
(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
@ -45,15 +17,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}]

View File

@ -1,8 +1,12 @@
[{if $oViewConf->getGtmContainerId()}][{strip}]
[{if $oViewConf->D3blShowGtmScript() && !$oViewConf->getCookieManagerType()}]
[{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}]
<!-- End Google Tag Manager (noscript) -->
[{/strip}][{/if}]
[{/if}]
[{$smarty.block.parent}]

View File

@ -1,66 +0,0 @@
[{$smarty.block.parent}]
[{*
[{strip}]
[{assign var="gtmProduct" value=$oView->getProduct()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{if !$head }]
[{assign var=$head value=$oView->getViewParameter('head')}]
[{/if}]
<script>
var gtmItem = {
'id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
'item_id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
'name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
'item_name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
'variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'price': [{$gtmProduct->oxarticles__oxprice->value}],
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]no category[{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]no category[{/if}]',
[{if $listId == 'productList' || $listId == 'categoryList'}]
/* category list */
'list': '[{$listId}]',
'item_list_id': '[{$listId}]',
'item_list_name': '[{$head}]',
[{elseif $listId}]
/* category list */
'list': '[{$listId}]',
'promotion_id': '[{$listId}]',
'promotion_name': '[{$head}]',
[{/if}]
'position': [{$iIndex}],
'index': [{$iIndex}],
'quantity': '1'
};
/* UA */
dataLayer.push({ ecommerce: null });
dataLayer.push({
'event': 'UA_event',
'event_name': 'Impression',
'ecommerce': {
'currencyCode': '[{$currency->name}]',
'impressions': [gtmItem]
}
});
/* GA4 */
dataLayer.push({ ecommerce: null });
dataLayer.push({
'event': 'GA4_event',
'event_name': 'view_item_list',
'ecommerce': {
'items': [gtmItem]
}
});
</script>
[{/strip}]
*}]

View File

@ -1,5 +0,0 @@
[{if $oxcmp_basket->isNewItemAdded() && $smarty.session._newitem}]
<!-- [{$smarty.session._newitem|@var_dump}] -->
[{* include file="ga4_add_to_cart.tpl" gtmProduct=$smarty.session._newitem *}]
[{/if}]
[{$smarty.block.parent}]

View File

@ -4,6 +4,8 @@
[{assign var='gtmCartArticles' value=$oView->getBasketArticles()}]
[{strip}][{capture assign=d3_ga4_view_cart}]
let iPrice = "[{oxprice price=$oxcmp_basket->getPrice()}]";
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'view_cart',
@ -11,7 +13,7 @@
'ecommerce': {
'actionField': "step: 1",
'currency': "[{$currency->name}]",
'value': [{oxprice price=$oxcmp_basket->getPrice()}],
'value': iPrice.replace("€", ""),
'items': [
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
[{assign var='_price' value=$basketitem->getUnitPrice()}]

View File

@ -1,18 +0,0 @@
[{strip}]
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event':'ee.checkout',
'eventLabel':'Checkout Step 2',
'ecommerce': {
'checkout': {
'actionField': {
'step': 2,
'option':'[{oxmultilang ident="vt_GTM_EE_LOGINOPTION"|cat:$oView->getLoginOption()}]'
}
}
}
});
</script>
[{/strip}]
[{$smarty.block.parent}]

View File

@ -1,9 +0,0 @@
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
'event': 'ee.checkout',
'eventLabel': 'Checkout Step 3',
'ecommerce': {'checkout': {'actionField': {'step': 3}}}
});
</script>
[{$smarty.block.parent}]

View File

@ -1,9 +0,0 @@
<script>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({
"event": "ee.checkout",
'eventLabel': 'Checkou Step 4',
"ecommerce": {"checkout": {"actionField": {"step": 4}}}
});
</script>
[{$smarty.block.parent}]

View File

@ -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>

View 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>

View File

@ -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')}]
-->

View File

@ -5,6 +5,8 @@
[{capture assign=d3_ga4_add_to_cart}]
[{block name="d3_ga4_add_to_basket"}]
$("#toBasket").click(function(event) {
[{*** Debug cases ***}]
[{*event.preventDefault();*}]
let iArtQuantity = $("#amountToBasket").val();
@ -28,7 +30,6 @@
'item_category_3':itemCategories[2] || '',
'item_category_4':itemCategories[3] || '',
[{if false}]
[{* ??? what *}]
'item_list_name': 'Search Results', // If associated with a list selection.
'item_list_id': 'SR123', // If associated with a list selection.
'index': 1, // If associated with a list selection.

View File

@ -1,36 +0,0 @@
[{strip}]
<script type="text/javascript">
window.dataLayer = window.dataLayer || [];
dataLayer.push({ ecommerce: null });
dataLayer.push({
[{assign var="oBasket" value=$order->getBasket()}]
[{assign var="iVat" value=0}]
'event':'purchase',
'ecommerce':{
'purchase':{
'actionField':{
'id': [{$order->getFieldData('oxordernr')}],
'ordernr': [{$order->getFieldData('oxtotalordersum')}],
'tax': [{$order->d3GetSumOrderVat()}],
'shipping': [{$order->getFieldData('oxdelcost')}],
'currency': "[{$order->getFieldData('oxcurrency')}]"
},
'products':[
[{foreach from=$order->getOrderArticles() item=listItem}]
[{assign var="orderArticle" value=$listItem->getArticle()}]
{
'item_id': "[{$listItem->getFieldData('oxartnum')}]",
'item_name': "[{$listItem->getFieldData('oxtitle')}]",
'currency': "[{$order->getFieldData('oxcurrency')}]",
'articleVat': [{$orderArticle->getArticleVat()}],
'price': [{$orderArticle->getBasePrice()}],
'quantity': [{$listItem->getFieldData('oxamount')}]
},
[{/foreach}]
]
}
}
});
</script>
[{/strip}]

View File

@ -1,26 +0,0 @@
[{strip}]
[{* variable $gtmProduct is passed from parent tempalte *}]
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
<script type="text/javascript">
dataLayer.push({ecommerce: null});
dataLayer.push({
'event':'GA4_event',
'event_name': 'view_item',
'ecommerce': {
'items': [
{
'item_id': '[{$gtmProduct->getFieldData("oxartnum")}]',
'item_name': '[{$gtmProduct->getFieldData("oxtitle")}]',
'item_variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]',
'price': [{$gtmProduct->oxarticles__oxprice->value|default:0}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'quantity': '1'
}
]
}
});
</script>
[{/strip}]

View File

@ -4,6 +4,61 @@ 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
## [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
### Added
- Aggrosoft-Cookie-Consent compatibility
### Fixed
- wrong function for pageview on thankyou page
## [1.2.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.2...1.2.1) - 2023-02-22
### Fixed
- price formatting view_cart
## [1.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...1.2) - 2023-02-01
### Added
- own cookie-check-handler
## [1.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.0...1.1) - 2023-01-27
### Added
- block section for add_to_basket js
@ -12,6 +67,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed
- 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
- publication of app features

View File

@ -1,11 +1,11 @@
## Technische Doku
### GA4 Events / Customizing
# Technische Doku
## GA4 Events / Customizing
FĂĽr alle implementierten GA4 Events existieren Templates unter `source/modules/d3/googleanalytics4/Application/views/ga4/`, dabei entspricht der Dateiname dem Eventnamen in GA4.
Die Einbindung dieser Event-Templates erfolgt über TPL-Blöcke unter `source/modules/d3/googleanalytics4/Application/views/blocks/`.
*Hinweis: nicht alle templates sind bereits gefĂĽllt. WĂĽnschen Sie die Implementierung eines unausgefĂĽllten templates?
Kommen Sie auf uns zu unter https://www.d3data.de/
### Blöcke
## Blöcke
Für den geregelten Ablauf sind folgende Blöcke nötig:
- Suchergebnisse
- Blockname: search_results
@ -32,7 +32,7 @@ Für den geregelten Ablauf sind folgende Blöcke nötig:
- Datei: page/checkout/thankyou.tpl
- GA4 Event: purchase
### VerfĂĽgbare Datalayer Variablen
## VerfĂĽgbare Datalayer Variablen
FĂĽr die einfachste Ăśbersicht der enthaltenen Daten empfehle ich den Vorschau-Modus vom Google Tag Manager.
Bei jedem Seitenaufruf wird die Datenschicht mit einigen wenigen Infos erstellt, die man zum reinen Erfassen der Seitenaufrufe benötigt:
@ -44,8 +44,25 @@ Bei jedem Seitenaufruf wird die Datenschicht mit einigen wenigen Infos erstellt,
Alle fĂĽr Ecommerce Tracking relevanten Daten werden mit speziellen Ecommerce Events in die Datenschicht eingefĂĽgt.
### Cookie-Handling
## Cookie-Handling
Sie nutzen einen eigenen, als Modul im Shop installierten, Cookie-manager?
Dann tragen Sie in den Folgeeinstellungen unter "Cookie Manager Einstellungen",
die Cookie-ID des zugehörigen Cookies ein. Und aktivieren Sie diese Weiche,
indem Sie den Haken bei "Eigenen Cookie Manager nutzen?" setzen.
die Cookie-ID des zugehörigen Cookies ein.
Aktivieren Sie anschlieĂźend diese Weiche. Setzen Sie den Haken bei "Eigenen Cookie Manager nutzen?".
### UnterstĂĽtzung fĂĽr
- [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.
- [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

View File

@ -1,44 +1,131 @@
<?php
/**
* This Software is the property of Data Development and is protected
* by copyright law - it is NOT Freeware.
* Any unauthorized use of this software without a valid license
* is a violation of the license agreement and will be prosecuted by
* civil and criminal law.
* http://www.shopmodule.com
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*
* https://www.d3data.de
*
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link http://www.oxidmodule.com
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com>
* @link https://www.oxidmodule.com
*/
namespace D3\GoogleAnalytics4\Modules\Core;
use OxidEsales\Eshop\Application\Controller\FrontendController;
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
{
// Google Tag Manager Container ID
private $sContainerId = null;
private $sCookieManagerType = null;
public function getGtmContainerId()
{
if ($this->sContainerId === null)
{
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_sContainerID');
$this->sContainerId = ContainerFactory::getInstance()
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('d3_gtm_sContainerID', 'd3googleanalytics4');
}
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;
}
/**
* @return bool
*/
public function D3blShowGtmScript()
{
$oConfig = $this->getConfig();
// No Cookie Manager in use
if (!$oConfig->getConfigParam('d3_gtm_settings_hasOwnCookieManager')) {
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);
}
}
// 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()
{
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;
@ -51,10 +138,9 @@ class ViewConfig extends ViewConfig_parent
$oConfig = Registry::getConfig();
$oView = $oConfig->getTopActiveView();
/** @var FrontendController $oShop */
$oUser = $oConfig->getUser();
$cl = $this->getTopActionClassName();
$cl = $this->getTopActiveClassName();
$aPageTypes = [
"content" => "cms",
"details" => "product",
@ -65,6 +151,7 @@ class ViewConfig extends ViewConfig_parent
"payment" => "checkout",
"order" => "checkout",
"thankyou" => "checkout",
"start" => "start",
];
$dataLayer = [

View File

@ -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.
```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.
@ -77,5 +77,6 @@ Die vollständigen Copyright- und Lizenzinformationen entnehmen Sie bitte der [L
Zu diesem Modul haben beigetragen:
- [Marat Bedoev](https://github.com/vanilla-thunder)
- [Christoph Stäblein [gn2]](https://github.com/reyneke-vosz)
Vielen Dank.

View File

@ -45,7 +45,7 @@
},
"require": {
"php": ">=7.1",
"oxid-esales/oxideshop-ce": "v6.0 - 6.3",
"oxid-esales/oxideshop-ce": "^6.5",
"google/apiclient":" ^2.0"
},
"autoload": {

View File

@ -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' => '1.1.0',
'version' => '2.4.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',
@ -26,23 +26,9 @@ $aModule = [
],
'templates' => [
// GA4 events
'ga4_add_payment_info.tpl' => 'd3/googleanalytics4/Application/views/ga4/add_payment_info.tpl',
'add_shipping_info.tpl' => 'd3/googleanalytics4/Application/views/ga4/add_shipping_info.tpl',
'ga4_add_to_cart.tpl' => 'd3/googleanalytics4/Application/views/ga4/add_to_cart.tpl',
'ga4_begin_checkout.tpl' => 'd3/googleanalytics4/Application/views/ga4/begin_checkout.tpl',
'ga4_generate_lead.tpl' => 'd3/googleanalytics4/Application/views/ga4/generate_lead.tpl',
'ga4_login.tpl' => 'd3/googleanalytics4/Application/views/ga4/login.tpl',
'ga4_purchase.tpl' => 'd3/googleanalytics4/Application/views/ga4/purchase.tpl',
'ga4_remove_from_cart.tpl' => 'd3/googleanalytics4/Application/views/ga4/remove_from_cart.tpl',
'ga4_search.tpl' => 'd3/googleanalytics4/Application/views/ga4/search.tpl',
'ga4_select_content.tpl' => 'd3/googleanalytics4/Application/views/ga4/select_content.tpl',
'ga4_select_item.tpl' => 'd3/googleanalytics4/Application/views/ga4/select_item.tpl',
'ga4_select_promotion.tpl' => 'd3/googleanalytics4/Application/views/ga4/select_promotion.tpl',
'ga4_sign_up.tpl' => 'd3/googleanalytics4/Application/views/ga4/sign_up.tpl',
'ga4_view_cart.tpl' => 'd3/googleanalytics4/Application/views/ga4/view_cart.tpl',
'ga4_view_item.tpl' => 'd3/googleanalytics4/Application/views/ga4/view_item.tpl',
'ga4_view_item_list.tpl' => 'd3/googleanalytics4/Application/views/ga4/view_item_list.tpl',
'ga4_view_promotion.tpl' => 'd3/googleanalytics4/Application/views/ga4/view_promotion.tpl',
],
'blocks' => [
// tag manager js
@ -57,55 +43,25 @@ $aModule = [
'block' => 'theme_svg_icons',
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
],
// widget_product_list
// checkout
// view_cart
[
'template' => 'widget/product/list.tpl',
'block' => 'widget_product_list',
'file' => '/Application/views/blocks/widget_product_list.tpl'
'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'
],
// details
[
'template' => 'page/details/inc/productmain.tpl',
'block' => 'details_productmain_title',
'file' => '/Application/views/blocks/detail.tpl',
'file' => '/Application/views/blocks/view_item.tpl',
'position' => 150
],
// checkout
[
'template' => 'page/checkout/basket.tpl',
'block' => 'checkout_basket_main',
'file' => '/Application/views/blocks/checkout_s1.tpl'
],
[
'template' => 'form/user_checkout_change.tpl',
'block' => 'user_checkout_change',
'file' => '/Application/views/blocks/checkout_s2.tpl'
],
[
'template' => 'form/user_checkout_register.tpl',
'block' => 'user_checkout_register',
'file' => '/Application/views/blocks/checkout_s2.tpl'
],
[
'template' => 'form/user_checkout_noregister.tpl',
'block' => 'user_checkout_noregister',
'file' => '/Application/views/blocks/checkout_s2.tpl'
],
[
'template' => 'page/checkout/payment.tpl',
'block' => 'checkout_payment_main',
'file' => '/Application/views/blocks/checkout_s3.tpl'
],
[
'template' => 'page/checkout/order.tpl',
'block' => 'checkout_order_main',
'file' => '/Application/views/blocks/checkout_s4.tpl'
],
[
'template' => 'page/checkout/thankyou.tpl',
'block' => 'checkout_thankyou_main',
'file' => '/Application/views/blocks/checkout_s5.tpl'
],
// Lists
// view_item_list
[