Same question here ?
As far as I understand the docs https://developers.google.com/tag-platform/security/guides/consent?hl=de&consentmode=advanced it's necessary to set & update the "consent status"
Here's a snippet as google recommends on its website.
<script>
// 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'
});
</script>
<!-- Google tag (gtag.js) -->
<script async src="https://www.googletagmanager.com/gtag/js?id=TAG_ID
">
</script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'TAG_ID');
</script>
<!-- Create one update function for each consent parameter -->
<script>
function consentGrantedAdStorage() {
gtag('consent', 'update', {
'ad_storage': 'granted'
});
}
</script>
<!-- Invoke your consent functions when a user interacts with your banner -->
<body>
...
<button onclick="consentGrantedAdStorage">Yes</button>
...
</body>
I'm thinking about using PrivacyWire for triggering a custom js function: Passing the necessary gtag parameters to google after the user had interacted with the Consent Banner.
@joshua Is it possible to define multiple data-categories at the same time – e.g.:
<script type="text/plain" data-type="text/javascript" data-category="statistics|marketing|external_media">
// Load GTM
</script>