Skip to content

Commit

Permalink
Only clean dataLayer.ecommerce, if new push actually contains ecommer…
Browse files Browse the repository at this point in the history
…ce data
  • Loading branch information
jissereitsma committed Aug 29, 2024
1 parent 17efb91 commit b4289ce
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

## [3.9.7] - 29 August 2024
### Fixed
- Only clean dataLayer.ecommerce, if new push actually contains ecommerce data

## [3.9.6] - 23 August 2024
### Fixed
- Move CSP logic to external module `Yireo_CspUtilities`
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "yireo/magento2-googletagmanager2",
"version": "3.9.6",
"version": "3.9.7",
"license": "OSL-3.0",
"type": "magento2-module",
"homepage": "https://www.yireo.com/software/magento-extensions/googletagmanager2",
Expand Down
6 changes: 5 additions & 1 deletion view/frontend/templates/hyva/script-pusher.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,11 @@

yireoGoogleTagManager2Logger(message, eventData);
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ecommerce: null});

if (eventData.ecommerce) {
window.dataLayer.push({ecommerce: null});
}

window.dataLayer.push(eventData);
window.YIREO_GOOGLETAGMANAGER2_PAST_EVENTS.push(eventHash);
}
Expand Down
6 changes: 5 additions & 1 deletion view/frontend/web/js/push.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,11 @@ define(['yireoGoogleTagManagerLogger'], function (logger) {

logger(message, eventData);
window.dataLayer = window.dataLayer || [];
window.dataLayer.push({ecommerce: null});

if (cleanEventData.ecommerce) {
window.dataLayer.push({ecommerce: null});
}

window.dataLayer.push(cleanEventData);
window.YIREO_GOOGLETAGMANAGER2_PAST_EVENTS.push(eventHash);
};
Expand Down

0 comments on commit b4289ce

Please sign in to comment.