Compare commits

..

3 Commits
2.2.2 ... 1.2

Author SHA1 Message Date
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
8 changed files with 51 additions and 85 deletions

View File

@ -1,13 +1,16 @@
<?php <?php
/** /**
* For the full copyright and license information, please view the LICENSE * This Software is the property of Data Development and is protected
* file that was distributed with this source code. * by copyright law - it is NOT Freeware.
* * Any unauthorized use of this software without a valid license
* https://www.d3data.de * 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) * @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com> * @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link https://www.oxidmodule.com * @link http://www.oxidmodule.com
*/ */
$style = '<style type="text/css"> $style = '<style type="text/css">
@ -30,7 +33,6 @@ $aLang = [
// for cookie manager settings // for cookie manager settings
'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen', 'SHOP_MODULE_GROUP_d3_gtm_settings_cookiemanager' => 'Cookie Manager Einstellungen',
'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Eigenen Cookie Manager nutzen? 'SHOP_MODULE_d3_gtm_settings_hasOwnCookieManager' => 'Eigenen Cookie Manager nutzen?',
<strong style="color: red">Hinweis (Fragezeichen) lesen!</strong>',
'SHOP_MODULE_d3_gtm_settings_cookieName' => 'Cookie-Name', 'SHOP_MODULE_d3_gtm_settings_cookieName' => 'Cookie-Name',
]; ];

View File

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

View File

@ -1,37 +1,35 @@
[{$smarty.block.parent}] [{$smarty.block.parent}]
[{assign var="gtmProduct" value=$oView->getProduct()}] [{assign var="gtmProduct" value=$oView->getProduct()}]
[{if $gtmProduct}] [{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}] [{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}] <script>
<script> dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */ dataLayer.push({
dataLayer.push({
'event': 'ee.impression', 'event': 'ee.impression',
'eventLabel':'Impression', 'eventLabel':'Impression',
'ecommerce': { 'ecommerce': {
'currencyCode': '[{$currency->name}]', 'currencyCode': '[{$currency->name}]',
'impressions': [ 'impressions': [
{ {
'name': '[{$gtmProduct->getFieldData('oxtitle')}]', 'name': '[{$gtmProduct->oxarticles__oxtitle->value}]',
'id': '[{$gtmProduct->getFieldData('oxartnum')}]', 'id': '[{$gtmProduct->oxarticles__oxartnum->value}]',
'price': [{$gtmProduct->getFieldData('oxprice')}], 'price': [{$gtmProduct->oxarticles__oxprice->value}],
'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->getFieldData('oxtitle')}][{/if}]', 'brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]', 'category': '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]-[{/if}]',
'variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]' 'variant': '[{if $gtmProduct->oxarticles__oxvarselect->value}][{$gtmProduct->oxarticles__oxvarselect->value}][{/if}]'
[{if $list && $position}], [{if $list && $position}],
'list': '[{$list}]', 'list': '[{$list}]',
'position': [{"_"|str_replace:"":$position}] 'position': [{"_"|str_replace:"":$position}]
[{/if}] [{/if}]
} }
] ]
} }
}); });
</script> </script>
<!-- <!--
sWidgetType [{$sWidgetType}] | [{$oView->getViewParameter('sWidgetType')}] sWidgetType [{$sWidgetType}] | [{$oView->getViewParameter('sWidgetType')}]
sListType [{$sListType}] | [{$oView->getViewParameter('sListType')}] sListType [{$sListType}] | [{$oView->getViewParameter('sListType')}]
iIndex [{$iIndex}] | [{$oView->getViewParameter('iIndex')}] iIndex [{$iIndex}] | [{$oView->getIndex()}]
listId [{$listId}] | [{$oView->getViewParameter('listId')}] listId [{$listId}] | [{$oView->getViewParameter('listId')}]
testid [{$testid}] | [{$oView->getViewParameter('testid')}] testid [{$testid}] | [{$oView->getViewParameter('testid')}]
--> -->
[{/if}]

View File

@ -4,32 +4,6 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), 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.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.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 ## [1.2](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.1...1.2) - 2023-02-01
### Added ### Added
- own cookie-check-handler - own cookie-check-handler
@ -42,7 +16,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Changed ### Changed
- switched price formatting - switched price formatting
## [1.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.0...1.0) - 2023-01-20
## [1.0](https://git.d3data.de/D3Public/GoogleAnalytics4/releases/tag/1.0) - 2023-01-20
### Added ### Added
- publication of app features - publication of app features

View File

@ -1,21 +1,20 @@
<?php <?php
/** /**
* For the full copyright and license information, please view the LICENSE * This Software is the property of Data Development and is protected
* file that was distributed with this source code. * by copyright law - it is NOT Freeware.
* * Any unauthorized use of this software without a valid license
* https://www.d3data.de * 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) * @copyright (C) D3 Data Development (Inh. Thomas Dartsch)
* @author D3 Data Development - Daniel Seifert <info@shopmodule.com> * @author D3 Data Development - Daniel Seifert <support@shopmodule.com>
* @link https://www.oxidmodule.com * @link http://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
{ {
@ -27,10 +26,8 @@ class ViewConfig extends ViewConfig_parent
{ {
if ($this->sContainerId === null) if ($this->sContainerId === null)
{ {
$this->sContainerId = ContainerFactory::getInstance()
->getContainer() $this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_sContainerID');
->get(ModuleSettingBridgeInterface::class)
->get('d3_gtm_sContainerID', 'd3googleanalytics4');
} }
return $this->sContainerId; return $this->sContainerId;
} }
@ -57,10 +54,7 @@ class ViewConfig extends ViewConfig_parent
{ {
if ($this->blGA4enabled === null) if ($this->blGA4enabled === null)
{ {
$this->sContainerId = ContainerFactory::getInstance() $this->sContainerId = $this->getConfig()->getConfigParam('d3_gtm_blEnableGA4');
->getContainer()
->get(ModuleSettingBridgeInterface::class)
->get('d3_gtm_blEnableGA4', 'd3googleanalytics4');
} }
return $this->blGA4enabled; return $this->blGA4enabled;
@ -73,6 +67,7 @@ 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->getTopActionClassName(); $cl = $this->getTopActionClassName();

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. Ö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:^2 php composer require d3/google-analytics4:^1
``` ```
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.

View File

@ -45,7 +45,7 @@
}, },
"require": { "require": {
"php": ">=7.1", "php": ">=7.1",
"oxid-esales/oxideshop-ce": "^6.5", "oxid-esales/oxideshop-ce": "v6.0 - 6.3",
"google/apiclient":" ^2.0" "google/apiclient":" ^2.0"
}, },
"autoload": { "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> 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' => '2.2.2', 'version' => '1.2.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/',