To ensure proper compliance, define the default consent state before loading Google tracking scripts.
Add the following script BEFORE your Google Analytics or Google Tag Manager script:
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('consent', 'default', {
'ad_storage': 'denied',
'ad_user_data': 'denied',
'ad_personalization': 'denied',
'analytics_storage': 'denied'
});
</script>
This ensures optional cookies remain disabled until the visitor gives consent.