Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up consent mode #222

Open
joachimVT opened this issue Mar 11, 2024 · 1 comment
Open

Set up consent mode #222

joachimVT opened this issue Mar 11, 2024 · 1 comment

Comments

@joachimVT
Copy link

joachimVT commented Mar 11, 2024

To setup a consent solution on a webshop and integrate consent mode (AKA cookie banner) a default consent mode should be setup. I think it can be added in script.phtml so that easy integration with a custom cookie banner can be added.

Would it be beneficial to update the script.phtml file like described here: https://developers.google.com/tag-platform/security/guides/consent?consentmode=advanced#implementation_example

events.forEach(function (eventType) {
window.removeEventListener(eventType, initYireoGoogleTagManager2);
});

// Define dataLayer and the gtag function.
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}

// Set default consent to 'denied' as a placeholder
// Determine actual values based on your own requirements
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied'
});

(function (w, d, s, l, i) {
w[l] = w[l] || [];
w[l].push({'gtm.start': new Date().getTime(), event: 'gtm.js'});
var f = d.getElementsByTagName(s)[0],
j = d.createElement(s),
dl = l != 'dataLayer' ? '&l=' + l : '';
j.async = true;
j.src = '<?= $config->getGoogleTagmanagerUrl() ?>' + '/gtm.js?id=' + i + dl;
f.parentNode.insertBefore(j, f);
})(window, document, 'script', 'dataLayer', '<?= $config->getId() ?>');

I could add a PR for this.

@JustinElst
Copy link

JustinElst commented Mar 13, 2024

There is a pull-request open that will add a consent popup/banner here: #198
Is this something that will solve your problem?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants