Compare commits

...

4 Commits
2.6.0 ... 2.7.0

Author SHA1 Message Date
MaxBUhe e48b21022c bump version && changelog to 2.7.0 2023-06-19 15:17:43 +02:00
MaxBUhe b4bf91660e [rework] change structure of GA-event
moving the procedere into one step so there's not an accidental triggering of an GA-Push-Event which at the end overwrites the View-Item-Push-Event in the cmpEvent
2023-06-19 14:57:12 +02:00
MaxBUhe 3d62993dfc add missing consentmanager readme entry 2023-06-01 14:19:29 +02:00
MaxBUhe 679a49823c add missing changelog 1.x changes 2023-05-31 14:33:49 +02:00
4 changed files with 69 additions and 47 deletions

View File

@ -1,56 +1,47 @@
[{$smarty.block.parent}]
[{assign var="d3ProductObject" value=$oView->getProduct()}]
[{assign var="d3PriceObject" value=$d3ProductObject->getPrice()}]
[{* variable $gtmProduct is passed from parent tempalte *}]
[{assign var="d3PriceObject" value=$gtmProduct->getPrice()}]
[{assign var="gtmCurrency" value=$oView->getActCurrency()}]
[{assign var="gtmManufacturer" value=$gtmProduct->getManufacturer()}]
[{assign var="gtmCategory" value=$gtmProduct->getCategory()}]
[{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) {
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
[{*** Debug cases ***}]
[{*event.preventDefault();*}]
let itemCategories = '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]no category[{/if}]'.split('/');
let iArtQuantity = $("#amountToBasket").val();
[{*** Debug cases ***}]
[{*event.preventDefault();*}]
dataLayer.push({
'isAddToBasket': true,
'event':'add_to_cart',
'eventLabel': 'add_to_cart',
'ecommerce': {
'currency': "[{$currency->name}]",
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
'items': [
{
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
'price': [{$d3PriceObject->getPrice()}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]',
'item_category': itemCategories[0] || 'no category',
'item_category_2':itemCategories[1] || '',
'item_category_3':itemCategories[2] || '',
'item_category_4':itemCategories[3] || '',
'quantity': iArtQuantity
}
]
let iArtQuantity = $("#amountToBasket").val();
dataLayer.push({
'isAddToBasket': true,
'event':'add_to_cart',
'eventLabel': 'add_to_cart',
'ecommerce': {
'currency': "[{$currency->name}]",
'value': iArtQuantity*[{$d3PriceObject->getPrice()}],
'items': [
{
'item_id': '[{$gtmProduct->getFieldData('oxartnum')}]',
'item_name': '[{$gtmProduct->getFieldData('oxtitle')}]',
'price': [{$d3PriceObject->getPrice()}],
'item_brand': '[{if $gtmManufacturer}][{$gtmManufacturer->oxmanufacturers__oxtitle->value}][{/if}]',
'item_variant': '[{if $gtmProduct->getFieldData('oxvarselect')}][{$gtmProduct->getFieldData('oxvarselect')}][{/if}]',
'item_category': itemCategories[0] || 'no category',
'item_category_2':itemCategories[1] || '',
'item_category_3':itemCategories[2] || '',
'item_category_4':itemCategories[3] || '',
'quantity': iArtQuantity
}
]
}
});
});
[{/block}]
[{/capture}]
[{oxscript add=$d3_ga4_add_to_cart}]
[{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>
dataLayer.push({"event": null, "eventLabel": null, "ecommerce": null}); /* Clear the previous ecommerce object. */
let itemCategories = '[{if $gtmCategory}][{$gtmCategory->getLink()|parse_url:5|ltrim:"/"|rtrim:"/"}][{else}]no category[{/if}]'.split('/');
</script>
[{/strip}]
[{/block}]
[{/capture}]
[{oxscript add=$d3_ga4_add_to_cart}]

View File

@ -4,6 +4,10 @@ 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.7.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.6.0...2.7.0) - 2023-06-19
### Changed
- add_to_cart event template-structure
## [2.6.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/2.5.0...2.6.0) - 2023-05-31
### Added
- add settings to explicit choose an external service (usercentrics/ consentmanager)
@ -68,6 +72,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added
- using of ContainerFactory in ViewConfig
## [1.8.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.7.0...1.8.0) - 2023-05-31
### Fixed
- bug in explicit manager selection
## [1.7.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.6.0...1.7.0) - 2023-05-31
### Added
- extended call to read the technical documentation
### Changed
- block-extension for view_item_list
- way of getting list-articles in view_item_list
## [1.6.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.5.0...1.6.0) - 2023-05-30
### Added
- possibility to choose between consentmanager && usercentrics
- position to block extension
### Changed
- genuine code cleanup
- usercentrics includation script
## [1.5.0](https://git.d3data.de/D3Public/GoogleAnalytics4/compare/1.4.0...1.5.0) - 2023-05-23
### Added
- additional settings to explicitly indicate that consentmanager is used

View File

@ -65,4 +65,12 @@ Aktivieren Sie anschließend diese Weiche. Setzen Sie den Haken bei "Eigenen Coo
- [OXID Cookie Management powered by usercentrics](https://docs.oxid-esales.com/modules/usercentrics/de/latest/einfuehrung.html)
- In der Usercentrics-Verwaltung die Services "Google Analytics" und "Google Tag Manager" anlegen
- Den Service ```Google Tag Manager``` in den Moduleinstellungen des 'Google Analytics 4' unter
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen
Google Tag Manager eintragen
-
- [Consent Management Provider](https://www.consentmanager.net/)
- In der Consentmanager-Oberfläche den Anbieter "Google Tag Manager" mit der ID s905 hinzufügen
- Im Frontend, im consentmanager-Pop-up nach dem 'Google Tag Manager' suchen
- kleines Fragezeichen neben den Namen anklicken und ganz runter scrollen
- prüfen, ob ein Cookie vorgegeben ist
- sonst, in der Consentmanager-Oberfläche Cookie-Liste entsprechendes Cookie suchen und im Admin unter
```Einstell. > Cookie Manager Einstellungen > Cookie-ID``` eintragen

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' => '2.6.0',
'version' => '2.7.0',
'author' => 'Data Development (Inh.: Thomas Dartsch)',
'email' => 'support@shopmodule.com',
'url' => 'https://www.oxidmodule.com/',