Google Consent Mode V2 - before V 12.1.0
Integrate Google Tag Manager directly (loaded directly without Consent):
If the Google Tag Manager is integrated directly, e.g. via the page.headerData, set the default values for the Googel Consent categories beforehand like this:
<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>
Afterwards, the desired categories can be granted in the cookie groups.
INFO: if the permissions should be distributed via different cookie groups, the GTM and the default values of the categories must either be loaded directly via the essential group or integrated and loaded directly via TYPO3 (e.g. as described above). In this way, no separate consent can be given, as the time when what is loaded is relevant here. Alternatively, I can recommend an update to version 12.1.0+ for TYPO3 11+, here this is possible directly via the extension.