Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
d722c46a74 | |||
d847a34e99 | |||
7b55d1d57c | |||
a25be1069c | |||
5200232a32 | |||
bcd785774b | |||
5ba613df30 | |||
a1dc0a6a58 |
39
Application/translations/de/module_lang.php
Normal file
39
Application/translations/de/module_lang.php
Normal file
@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* [bla] tag-manager
|
||||
* Copyright (C) 2018 bestlife AG
|
||||
* info: oxid@bestlife.ag
|
||||
*
|
||||
* This program is free software;
|
||||
* you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
|
||||
**/
|
||||
|
||||
$aLang = [
|
||||
'charset' => 'UTF-8',
|
||||
|
||||
// das hier wird nicht mehr benötigt, aber ich lasse es drin, falls doch
|
||||
// leserliche Namen fĂĽr product list performance (GA)
|
||||
'VT_GTM_EE_productList' => 'Kategorie',
|
||||
'VT_GTM_EE_categoryList' => 'Kategorie',
|
||||
'VT_GTM_EE_searchList' => 'Suchergebnisse',
|
||||
'VT_GTM_EE_cross' => 'Crossselling',
|
||||
'VT_GTM_EE_accessories' => 'Zubehör',
|
||||
'VT_GTM_EE_alsoBought' => 'Kunden kaufen auch',
|
||||
'VT_GTM_EE_last' => 'Zuletzt angesehen',
|
||||
'VT_GTM_EE_bargainItems' => 'Angebot der Woche',
|
||||
'VT_GTM_EE_newItems' => 'Frisch eingetroffen',
|
||||
'VT_GTM_EE_topBox' => 'Topseller',
|
||||
// ab hier wird wieder benötigt
|
||||
|
||||
// Dimensionen im checkout
|
||||
'VT_GTM_EE_LOGINOPTION' => 'Bestandskunde',
|
||||
'VT_GTM_EE_LOGINOPTION1' => 'Gastbestellung',
|
||||
'VT_GTM_EE_LOGINOPTION2' => 'Bestandskunde',
|
||||
'VT_GTM_EE_LOGINOPTION3' => 'Neukunde'
|
||||
|
||||
];
|
37
Application/translations/en/blagtm_lang.php
Normal file
37
Application/translations/en/blagtm_lang.php
Normal file
@ -0,0 +1,37 @@
|
||||
<?php
|
||||
/**
|
||||
* [bla] tag-manager
|
||||
* Copyright (C) 2018 bestlife AG
|
||||
* info: oxid@bestlife.ag
|
||||
*
|
||||
* This program is free software;
|
||||
* you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
|
||||
**/
|
||||
|
||||
$aLang = [
|
||||
'charset' => 'UTF-8',
|
||||
|
||||
|
||||
// das hier wird nicht mehr benötigt, aber ich lasse es drin, falls doch
|
||||
// leserliche Namen fĂĽr product list performance (GA)
|
||||
'VT_GTM_EE_productList' => 'Category',
|
||||
'VT_GTM_EE_searchList' => 'Search',
|
||||
'VT_GTM_EE_cross' => 'Crossselling',
|
||||
'VT_GTM_EE_accessories' => 'Accessories',
|
||||
'VT_GTM_EE_last' => 'Last Seen',
|
||||
'VT_GTM_EE_bargainItems' => 'Offer of the Week',
|
||||
'VT_GTM_EE_newItems' => 'Just Arrived',
|
||||
'VT_GTM_EE_topBox' => 'Topseller',
|
||||
// ab hier wird wieder benötigt
|
||||
|
||||
// Dimensionen im checkout
|
||||
'VT_GTM_EE_LOGINOPTION' => 'Existing Customer',
|
||||
'VT_GTM_EE_LOGINOPTION1' => 'Guest',
|
||||
'VT_GTM_EE_LOGINOPTION2' => 'Existing Customer',
|
||||
'VT_GTM_EE_LOGINOPTION3' => 'New Customer'
|
||||
];
|
@ -1,16 +1,16 @@
|
||||
<?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
|
||||
/*
|
||||
* vanilla-thunder/oxid-module-gtm
|
||||
* Google Tag Manager Integration for OXID eShop v6.2+
|
||||
*
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
* This program is free software;
|
||||
* you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
$style = '<style type="text/css">
|
||||
@ -25,22 +25,22 @@ input.confinput:hover {outline:3px solid #ff3600;}
|
||||
</style>';
|
||||
$aLang = [
|
||||
'charset' => 'UTF-8',
|
||||
'SHOP_MODULE_d3_gtm_sContainerID' => 'Container ID',
|
||||
'SHOP_MODULE_GROUP_d3_gtm_settings' => 'Einstellungen',
|
||||
'SHOP_MODULE_d3_gtm_blGA4enab' => 'GA4 Aktivieren',
|
||||
'SHOP_MODULE_d3_gtm_blUAenabled' => 'UA Aktivieren',
|
||||
'SHOP_MODULE_d3_gtm_blEnableDebug' => 'Debug-Modus aktivieren',
|
||||
'SHOP_MODULE_vt_gtm_sContainerID' => 'Container ID',
|
||||
'SHOP_MODULE_GROUP_vt_gtm_settings' => 'Einstellungen',
|
||||
'SHOP_MODULE_vt_gtm_blGA4enab' => 'GA4 Aktivieren',
|
||||
'SHOP_MODULE_vt_gtm_blUAenabled' => 'UA Aktivieren',
|
||||
'SHOP_MODULE_vt_gtm_blEnableDebug' => 'Debug-Modus aktivieren',
|
||||
|
||||
// for cookie manager settings
|
||||
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
|
||||
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Eigenen Cookie Manager nutzen?
|
||||
'SHOP_MODULE_GROUP_vt_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
|
||||
'SHOP_MODULE_vt_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,
|
||||
'HELP_SHOP_MODULE_vt_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_vt_gtm_settings_cookieName' => 'Cookie-Name',
|
||||
];
|
||||
|
@ -1,6 +1,6 @@
|
||||
[{assign var="d3VtConfigObject" value=$oViewConf->getConfig()}]
|
||||
[{if $d3VtConfigObject->getConfigParam('d3_gtm_settings_hasOwnCookieManager')}]
|
||||
[{if $oViewConf->blAcceptedCookie($d3VtConfigObject->getConfigParam('d3_gtm_settings_cookieName'))}]
|
||||
[{if $d3VtConfigObject->getConfigParam('vt_gtm_settings_hasOwnCookieManager')}]
|
||||
[{if $oViewConf->blAcceptedCookie($d3VtConfigObject->getConfigParam('vt_gtm_settings_cookieName'))}]
|
||||
|
||||
[{if $oViewConf->getGtmContainerId()}][{strip}]
|
||||
<!-- Google Tag Manager -->
|
||||
@ -16,6 +16,7 @@
|
||||
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
|
||||
</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
[{$oViewConf->triggerGA4events()}]
|
||||
[{if $oViewConf->getTopActionClassName() === "alist" }]
|
||||
[{* include file="ga4_view_item_list.tpl" gtmCategory=$oView->getActiveCategory() gtmProducts=$oView->getArticleList() listtype=$oView->getListType() *}]
|
||||
[{elseif $oViewConf->getTopActionClassName() === "details" }]
|
||||
@ -45,6 +46,7 @@
|
||||
})(window, document, 'script', 'dataLayer', '[{$oViewConf->getGtmContainerId()}]');
|
||||
</script>
|
||||
<!-- End Google Tag Manager -->
|
||||
[{$oViewConf->triggerGA4events()}]
|
||||
[{if $oViewConf->getTopActionClassName() === "alist" }]
|
||||
[{* include file="ga4_view_item_list.tpl" gtmCategory=$oView->getActiveCategory() gtmProducts=$oView->getArticleList() listtype=$oView->getListType() *}]
|
||||
[{elseif $oViewConf->getTopActionClassName() === "details" }]
|
||||
|
@ -11,7 +11,7 @@
|
||||
'ecommerce': {
|
||||
'actionField': "step: 1",
|
||||
'currency': "[{$currency->name}]",
|
||||
'value': [{oxprice price=$oxcmp_basket->getPrice()}],
|
||||
'value': [{$oxcmp_basket->getBruttoSum()}],
|
||||
'items': [
|
||||
[{foreach from=$oxcmp_basket->getContents() item=basketitem name=gtmCartContents key=basketindex}]
|
||||
[{assign var='_price' value=$basketitem->getUnitPrice()}]
|
||||
|
@ -8,7 +8,7 @@
|
||||
'checkout': {
|
||||
'actionField': {
|
||||
'step': 2,
|
||||
'option':'[{oxmultilang ident="vt_GTM_EE_LOGINOPTION"|cat:$oView->getLoginOption()}]'
|
||||
'option':'[{oxmultilang ident="VT_GTM_EE_LOGINOPTION"|cat:$oView->getLoginOption()}]'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,35 +1,37 @@
|
||||
[{$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({
|
||||
[{if $gtmProduct}]
|
||||
[{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}]
|
||||
}
|
||||
]
|
||||
'currencyCode': '[{$currency->name}]',
|
||||
'impressions': [
|
||||
{
|
||||
'name': '[{$gtmProduct->getFieldData('oxtitle')}]',
|
||||
'id': '[{$gtmProduct->getFieldData('oxartnum')}]',
|
||||
'price': [{$gtmProduct->getFieldData('oxprice')}],
|
||||
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->getFieldData('oxtitle')}][{/if}]',
|
||||
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
|
||||
'variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]'
|
||||
[{if $list && $position}],
|
||||
'list': '[{$list}]',
|
||||
'position': [{"_"|str_replace:"":$position}]
|
||||
[{/if}]
|
||||
}
|
||||
]
|
||||
}
|
||||
});
|
||||
</script>
|
||||
});
|
||||
</script>
|
||||
<!--
|
||||
sWidgetType [{$sWidgetType}] | [{$oView->getViewParameter('sWidgetType')}]
|
||||
sListType [{$sListType}] | [{$oView->getViewParameter('sListType')}]
|
||||
iIndex [{$iIndex}] | [{$oView->getIndex()}]
|
||||
iIndex [{$iIndex}] | [{$oView->getViewParameter('iIndex')}]
|
||||
listId [{$listId}] | [{$oView->getViewParameter('listId')}]
|
||||
testid [{$testid}] | [{$oView->getViewParameter('testid')}]
|
||||
-->
|
||||
-->
|
||||
[{/if}]
|
@ -3,7 +3,6 @@
|
||||
[{*$gtmProduct|get_class_methods|dumpvar*}]
|
||||
|
||||
[{capture assign=d3_ga4_add_to_cart}]
|
||||
[{block name="d3_ga4_add_to_basket"}]
|
||||
$("#toBasket").click(function(event) {
|
||||
[{*event.preventDefault();*}]
|
||||
|
||||
@ -39,7 +38,7 @@
|
||||
}
|
||||
});
|
||||
});
|
||||
[{/block}]
|
||||
|
||||
[{/capture}]
|
||||
[{oxscript add=$d3_ga4_add_to_cart}]
|
||||
|
||||
|
25
CHANGELOG.md
25
CHANGELOG.md
@ -4,14 +4,27 @@ 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).
|
||||
|
||||
## [1.1](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.0...1.1) - 2023-01-27
|
||||
## [Unreleased](https://git.d3data.de/D3Public/MyModule/compare/1.1.0.0...rel_1.x)
|
||||
|
||||
## [1.1.0.0](https://git.d3data.de/D3Public/MyModule/compare/1.0.0.0...1.1.0.0) - 2022-07-26
|
||||
### Added
|
||||
- block section for add_to_basket js
|
||||
- template block order positions
|
||||
- another feature
|
||||
|
||||
### Changed
|
||||
- switched price formatting
|
||||
- changed old code
|
||||
|
||||
## [1.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.0...1.0) - 2023-01-20
|
||||
### Deprecated
|
||||
- ...
|
||||
|
||||
### Removed
|
||||
- ...
|
||||
|
||||
### Fixed
|
||||
- ...
|
||||
|
||||
### Security
|
||||
- ...
|
||||
|
||||
## [1.0.0.0](https://git.d3data.de/D3Public/MyModule/releases/tag/1.0.0.0) - 2022-07-25
|
||||
### Added
|
||||
- publication of app features
|
||||
- implemented features
|
@ -1,51 +0,0 @@
|
||||
## 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
|
||||
Für den geregelten Ablauf sind folgende Blöcke nötig:
|
||||
- Suchergebnisse
|
||||
- Blockname: search_results
|
||||
- Datei: page/search/search.tpl
|
||||
- GA4 Event: view_search_results
|
||||
- Artikelliste
|
||||
- Blockname: d3Ga4_view_item_list (muss hinzugefĂĽgt werden)
|
||||
- Datei: widget/product/list.tpl
|
||||
- GA4 Event: view_item_list
|
||||
- Detailseite
|
||||
- Blockname: details_productmain_title
|
||||
- Datei: page/details/inc/productmain.tpl
|
||||
- GA4 Event: view_item
|
||||
- dem WK hinzufĂĽgen (button)
|
||||
- Blockname: details_productmain_tobasket
|
||||
- Datei: page/details/inc/productmain.tpl
|
||||
- GA4 Event: add_to_cart
|
||||
- Warenkorb
|
||||
- Blockname: checkout_basket_main
|
||||
- Datei: page/checkout/basket.tpl
|
||||
- GA4 Event: view_cart
|
||||
- abgeschlossener Kauf
|
||||
- Blockname: checkout_thankyou_main
|
||||
- Datei: page/checkout/thankyou.tpl
|
||||
- GA4 Event: purchase
|
||||
|
||||
### 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:
|
||||
+ **page.type** - Seitentyp: default / cms / product / listing / checkout (an google analytics angelehnt)
|
||||
+ **page.title** - Seitentitel (auĂźer Startseite, sie hat keinen Titel)
|
||||
+ **page.cl** - OXID Controller Klasse (start, search, etc)
|
||||
+ **userid** - oxId vom Benutzer bzw `false` falls nicht eingeloggt
|
||||
+ **sessionid** - session iD
|
||||
|
||||
Alle fĂĽr Ecommerce Tracking relevanten Daten werden mit speziellen Ecommerce Events in die Datenschicht eingefĂĽgt.
|
||||
|
||||
### 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.
|
@ -1,20 +1,24 @@
|
||||
<?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
|
||||
* @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
|
||||
* @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
|
||||
* @link http://www.oxidmodule.com
|
||||
|
||||
/*
|
||||
* vanilla-thunder/oxid-module-gtm
|
||||
* Google Tag Manager Integration for OXID eShop v6.2+
|
||||
*
|
||||
* This program is free software;
|
||||
* you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
|
||||
* either version 3 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
* without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
* You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
|
||||
*/
|
||||
|
||||
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
|
||||
{
|
||||
@ -26,8 +30,10 @@ class ViewConfig extends ViewConfig_parent
|
||||
{
|
||||
if ($this->sContainerId === null)
|
||||
{
|
||||
|
||||
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_sContainerID');
|
||||
$this->sContainerId = ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('vt_gtm_sContainerID', 'vt-gtm');
|
||||
}
|
||||
return $this->sContainerId;
|
||||
}
|
||||
@ -38,7 +44,10 @@ class ViewConfig extends ViewConfig_parent
|
||||
{
|
||||
if ($this->blGA4enabled === null)
|
||||
{
|
||||
$this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_blEnableGA4');
|
||||
$this->sContainerId = ContainerFactory::getInstance()
|
||||
->getContainer()
|
||||
->get(ModuleSettingBridgeInterface::class)
|
||||
->get('vt_gtm_blEnableGA4', 'vt-gtm');
|
||||
}
|
||||
|
||||
return $this->blGA4enabled;
|
||||
@ -51,7 +60,7 @@ class ViewConfig extends ViewConfig_parent
|
||||
$oConfig = Registry::getConfig();
|
||||
$oView = $oConfig->getTopActiveView();
|
||||
/** @var FrontendController $oShop */
|
||||
|
||||
//$oShop = oxRegistry::getConfig()->getActiveShop(); /** @var oxShop $oShop */
|
||||
$oUser = $oConfig->getUser();
|
||||
|
||||
$cl = $this->getTopActionClassName();
|
||||
@ -79,6 +88,37 @@ class ViewConfig extends ViewConfig_parent
|
||||
];
|
||||
|
||||
return json_encode([$dataLayer], JSON_PRETTY_PRINT);
|
||||
|
||||
unset($dataLayer["user"]["http"]); // das brauchen wir hier nicht
|
||||
|
||||
|
||||
return json_encode([$dataLayer], JSON_PRETTY_PRINT);
|
||||
/*
|
||||
// --- Produktdaten ---
|
||||
$transactionProducts = [];
|
||||
foreach($oOrder->getOrderArticles() as $_prod ) $transactionProducts[] = [
|
||||
'name' => '', // (erforderlich) Produktname String
|
||||
'sku' => '', // (erforderlich) Produkt-SKU String
|
||||
'category' => '', // (optional) Produktkategorie String
|
||||
'price' => '', // (erforderlich) Preis pro Einheit Numerischer Wert
|
||||
'quantity' => '' // (erforderlich) Anzahl der Artikel Numerischer Wert
|
||||
];
|
||||
|
||||
// --- Transaktionsdaten ---
|
||||
|
||||
$dataLayer['transactionId'] = $oOrder->oxorder__oxordernr->value; // (erforderlich) Eindeutige Transaktionskennung String
|
||||
$dataLayer['transactionAffiliation'] = $oShop->oxshops__oxname->value; // (optional) Partner oder Geschäft String
|
||||
$dataLayer['transactionTotal'] = $oOrder->oxorder__oxtotalordersum->value; // (erforderlich) Gesamtwert der Transaktion Numerischer Wert
|
||||
$dataLayer['transactionShipping'] = $oOrder->oxorder__oxdelcost->value; // (optional) Versandkosten fĂĽr die Transaktion Numerischer Wert
|
||||
$dataLayer['transactionTax'] = ''; // (optional) Steuerbetrag fĂĽr die Transaktion Numerischer Wert
|
||||
$dataLayer['transactionProducts'] = $transactionProducts; // (optional) Liste der bei der Transaktion erworbenen Artikel Array von Produktobjekten
|
||||
*/
|
||||
}
|
||||
|
||||
public function triggerGA4events()
|
||||
{
|
||||
// general events
|
||||
|
||||
}
|
||||
|
||||
public function isPromotionList($listId)
|
||||
|
35
README.md
35
README.md
@ -20,8 +20,25 @@ WeiterfĂĽhrende Informationen: https://developers.google.com/analytics/devguides
|
||||
|
||||
Dieses Paket erfordert einen mit Composer installierten OXID eShop in einer in der [composer.json](composer.json) definierten Version.
|
||||
|
||||
Bitte tragen Sie den folgenden Abschnitt in die `composer.json` Ihres Projektes ein:
|
||||
|
||||
```
|
||||
"extra": {
|
||||
"oxideshop": {
|
||||
"blacklist-filter": [
|
||||
"*.md",
|
||||
"composer.json",
|
||||
".php-cs-fixer.php",
|
||||
"*.xml",
|
||||
"*.neon"
|
||||
],
|
||||
"target-directory": "d3/googleanalytics"
|
||||
}
|
||||
```
|
||||
|
||||
Ă–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
|
||||
```
|
||||
@ -31,7 +48,7 @@ Sofern nötig, bestätigen Sie bitte, dass Sie `package-name` erlauben, Code aus
|
||||
Aktivieren Sie das Modul im Shopadmin unter "Erweiterungen -> Module".
|
||||
|
||||
## Verwendung
|
||||
### Grundfunktionalität
|
||||
|
||||
Nach erfolgreicher Installation finden Sie in Ihrem Shop-Admin unter "Erweiterungen > Module"
|
||||
den Eintrag 'Google Analytics 4'.
|
||||
Aktivieren Sie dieses Modul, um die Funktionalitäten nutzen zu können.
|
||||
@ -41,11 +58,12 @@ Tragen Sie die nötige sog. 'Container ID' ein. Diese sieht in etwa so aus: 'GTM
|
||||
|
||||
Aktivieren Sie GA4 selbst, indem Sie dieses direkt darunter anhaken.
|
||||
|
||||
### Technische Infos
|
||||
- Navigieren Sie bitte zur [technischen Doku](./Docs/README.md)
|
||||
|
||||
---
|
||||
|
||||
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.
|
||||
|
||||
## Changelog
|
||||
|
||||
Siehe [CHANGELOG](CHANGELOG.md) fĂĽr weitere Informationen.
|
||||
@ -71,11 +89,8 @@ Copyright (c) D3 Data Development (Inh. Thomas Dartsch)
|
||||
Diese Software wird unter der GNU GENERAL PUBLIC LICENSE Version 3 vertrieben.
|
||||
```
|
||||
|
||||
Die vollständigen Copyright- und Lizenzinformationen entnehmen Sie bitte der [LICENSE](LICENSE)-Datei, die mit diesem Quellcode verteilt wurde.
|
||||
Die vollständigen Copyright- und Lizenzinformationen entnehmen Sie bitte der [LICENSE](LICENSE.md)-Datei, die mit diesem Quellcode verteilt wurde.
|
||||
|
||||
## Credits
|
||||
Zu diesem Modul haben beigetragen:
|
||||
## weitere Lizenzen und Nutzungsbedingungen
|
||||
|
||||
- [Marat Bedoev](https://github.com/vanilla-thunder)
|
||||
|
||||
Vielen Dank.
|
||||
...
|
67
__README.md
Normal file
67
__README.md
Normal file
@ -0,0 +1,67 @@
|
||||
# [D3] Google Tag Manager
|
||||
Google Tag Manager integration for OXID eShop v6.x
|
||||
|
||||
## Installation
|
||||
* ``composer require vanilla-thunder/oxid-module-gtm --no-update``
|
||||
* Modul aktivieren und Moduleinstellungen konfigurieren
|
||||
|
||||
## Tag Manager konfigurieren:
|
||||
+ https://support.google.com/tagmanager/answer/9442095
|
||||
|
||||
## Google Analytics 4 Einrichtung
|
||||
|
||||
## GA4 Events / Customizing
|
||||
fĂĽr alle implementierten GA4 Events existieren Templates unter `source/modules/GoogleTagManager/Application/views/ga4/`, dabei entspricht der Dateiname dem Eventnamen in GA4.
|
||||
Die Einbindung dieser Event-Templates erfolgt über TPL-Blöcke unter `source/modules/GoogleTagManager/Application/views/blocks/`.
|
||||
|
||||
### aktuell zu beachtende Blöcke
|
||||
- Suchergebnisse: search_results
|
||||
- (muss hinzugefĂĽgt werden) aList: d3Ga4_view_item_list
|
||||
- Detailseite: details_productmain_title
|
||||
- add_to_basket-button: details_productmain_tobasket
|
||||
- Warenkorb: checkout_basket_main
|
||||
- Purchase | abgeschlossener Kauf: checkout_thankyou_main
|
||||
|
||||
## Universal Analytics Events
|
||||
|
||||
**"EE-Trigger" fĂĽr Ecomemrce-Tags (Beispiel fĂĽr Google Tag Manager):**
|
||||
+ Triggertyp: Benutzerdefiniertes Ereignis
|
||||
+ Ereignisname: ``ee\..*``
|
||||
+ Übereinstimmung mit regulärem Ausdruck verwenden
|
||||
+ Diesen Trigger auslösen bei: Alle benutzerdefinierten Ereignisse
|
||||
|
||||
**"EE-Tag" fĂĽr Google Analytics Enhanced Ecommerce:**
|
||||
+ Tag-Typ: Google Analytics - Universal Analytics
|
||||
+ Tracking-Typ: Ereignis
|
||||
+ Aktion: {{Event}}
|
||||
+ Label: {{Event Label}}
|
||||
+ Trigger : EE-Trigger
|
||||
|
||||
## 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:
|
||||
+ **page.type** - Seitentyp: default / cms / product / listing / checkout (an google analytics angelehnt)
|
||||
+ **page.title** - Seitentitel (auĂźer Startseite, sie hat keinen Titel. Danke OXID...)
|
||||
+ **page.cl** - OXID Controller Klasse (start, search, etc)
|
||||
+ **userid** - oxID vom Benutzer bzw `false` falls nicht eingeloggt
|
||||
+ **sessionid** - session iD
|
||||
|
||||
Alle fĂĽr Ecommerce Tracking releavanten Daten werden mit speziellen Ecommerce Events in die Datenschicht eingefĂĽgt.
|
||||
Hier ist ein Beispiel fĂĽr die Einrichtung von Enhanced Ecomemrce Tracking ĂĽber Google Tag Manager:
|
||||
|
||||
|
||||
|
||||
|
||||
### LICENSE AGREEMENT
|
||||
[vt] google-tag-manager
|
||||
Copyright (C) 2021 Marat Bedoev
|
||||
info: info@mb-dev.pro oder so /** @todo: ĂĽberarbeiten, wenn ich wieder nĂĽchtern bin */
|
||||
|
||||
This program is free software;
|
||||
you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation;
|
||||
either version 3 of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
|
||||
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
||||
You should have received a copy of the GNU General Public License along with this program; if not, see <http://www.gnu.org/licenses/>
|
@ -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": {
|
||||
|
45
metadata.php
45
metadata.php
@ -1,4 +1,6 @@
|
||||
<?php
|
||||
|
||||
|
||||
use D3\GoogleAnalytics4\Modules\Core\ViewConfig;
|
||||
use OxidEsales\Eshop\Core\ViewConfig as OEViewConfig;
|
||||
|
||||
@ -17,7 +19,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.0.0.0',
|
||||
'author' => 'Data Development (Inh.: Thomas Dartsch)',
|
||||
'email' => 'support@shopmodule.com',
|
||||
'url' => 'https://www.oxidmodule.com/',
|
||||
@ -43,6 +45,12 @@ $aModule = [
|
||||
'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',
|
||||
/*
|
||||
'gtm_ua_impression' => 'vt/GoogleTagManager/Application/views/ua/impression.tpl'
|
||||
'gtm_view_promotion.tpl' => 'vt/GoogleTagManager/Application/views/view_promotion.tpl',
|
||||
'gtm_select_promotion.tpl' => 'vt/GoogleTagManager/Application/views/select_promotion.tpl',
|
||||
'gtm_begin_checkout.tpl' => 'vt/GoogleTagManager/Application/views/begin_checkout.tpl',
|
||||
*/
|
||||
],
|
||||
'blocks' => [
|
||||
// tag manager js
|
||||
@ -57,6 +65,12 @@ $aModule = [
|
||||
'block' => 'theme_svg_icons',
|
||||
'file' => '/Application/views/blocks/_gtm_nojs.tpl'
|
||||
],
|
||||
// add to cart
|
||||
[
|
||||
'template' => 'layout/header.tpl',
|
||||
'block' => 'header_main',
|
||||
'file' => '/Application/views/blocks/add_to_cart.tpl'
|
||||
],
|
||||
// widget_product_list
|
||||
[
|
||||
'template' => 'widget/product/list.tpl',
|
||||
@ -111,56 +125,53 @@ $aModule = [
|
||||
[
|
||||
'template' => 'widget/product/list.tpl',
|
||||
'block' => 'd3Ga4_view_item_list',
|
||||
'file' => '/Application/views/ga4/view_item_list.tpl',
|
||||
'position' => 150
|
||||
'file' => '/Application/views/ga4/view_item_list.tpl'
|
||||
],
|
||||
// view_search_result
|
||||
[
|
||||
'template' => 'page/search/search.tpl',
|
||||
'block' => 'search_results',
|
||||
'file' => '/Application/views/ga4/search.tpl',
|
||||
'position' => 150
|
||||
'file' => '/Application/views/ga4/search.tpl'
|
||||
],
|
||||
// add_to_cart
|
||||
[
|
||||
'template' => 'page/details/inc/productmain.tpl',
|
||||
'block' => 'details_productmain_tobasket',
|
||||
'file' => '/Application/views/ga4/add_to_cart.tpl',
|
||||
'position' => 150
|
||||
'file' => '/Application/views/ga4/add_to_cart.tpl'
|
||||
]
|
||||
],
|
||||
'settings' => [
|
||||
[
|
||||
'group' => 'd3_gtm_settings',
|
||||
'name' => 'd3_gtm_sContainerID',
|
||||
'group' => 'vt_gtm_settings',
|
||||
'name' => 'vt_gtm_sContainerID',
|
||||
'type' => 'str',
|
||||
'value' => 'GTM-',
|
||||
'position' => 0
|
||||
],
|
||||
[
|
||||
'group' => 'd3_gtm_settings',
|
||||
'name' => 'd3_gtm_blGA4enab',
|
||||
'group' => 'vt_gtm_settings',
|
||||
'name' => 'vt_gtm_blGA4enab',
|
||||
'type' => 'bool',
|
||||
'value' => true,
|
||||
'position' => 1
|
||||
],
|
||||
[
|
||||
'group' => 'd3_gtm_settings',
|
||||
'name' => 'd3_gtm_blEnableDebug',
|
||||
'group' => 'vt_gtm_settings',
|
||||
'name' => 'vt_gtm_blEnableDebug',
|
||||
'type' => 'bool',
|
||||
'value' => false,
|
||||
'position' => 999
|
||||
],
|
||||
[
|
||||
'group' => 'd3_gtm_settings_cookiemanager',
|
||||
'name' => 'd3_gtm_settings_hasOwnCookieManager',
|
||||
'group' => 'vt_gtm_settings_cookiemanager',
|
||||
'name' => 'vt_gtm_settings_hasOwnCookieManager',
|
||||
'type' => 'bool',
|
||||
'value' => false,
|
||||
'position' => 999
|
||||
],
|
||||
[
|
||||
'group' => 'd3_gtm_settings_cookiemanager',
|
||||
'name' => 'd3_gtm_settings_cookieName',
|
||||
'group' => 'vt_gtm_settings_cookiemanager',
|
||||
'name' => 'vt_gtm_settings_cookieName',
|
||||
'type' => 'str',
|
||||
'value' => 'example',
|
||||
'position' => 999
|
||||
|
Loading…
Reference in New Issue
Block a user