Skip to content

Commit 8153f02

Browse files
committed
Improved compatability with consent mode v2
1 parent 769cab9 commit 8153f02

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

view/frontend/templates/js_code.phtml

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,17 @@ if (!isset($escaper)) {
3131
<?php } ?>
3232

3333
<?php if ($block->isProtectCustomerDataEnabled()) { ?>
34+
35+
window.dataLayer = window.dataLayer || [];
36+
function gtag() { dataLayer.push(arguments); }
37+
gtag('consent', 'default', {
38+
'ad_user_data': 'denied',
39+
'ad_personalization': 'denied',
40+
'ad_storage': 'denied',
41+
'analytics_storage': 'denied',
42+
'wait_for_update': 500,
43+
});
44+
3445
(function () {
3546
function getCookieValue(cookieName) {
3647
let name = cookieName + '=';
@@ -91,7 +102,6 @@ if (!isset($escaper)) {
91102
window.mfGTMTriedToLoad = true;
92103

93104
<?php if ($block->isProtectCustomerDataEnabled()) { ?>
94-
function gtag() { dataLayer.push(arguments); };
95105
gtag('consent', 'update', {
96106
ad_user_data: 'granted',
97107
ad_personalization: 'granted',

0 commit comments

Comments
 (0)