Using Manual Script
- Login to your Mandatly account -> Cookie Compliance -> Websites.
- Navigate to Integration tab -> Copy the banner script from Custom HTML option.
- Copy the below code and insert it in your website's <head> section as the first script before all other scripts. This code should be inserted on every page followed by the CMP script.
<script> // Define dataLayer and the gtag function. window.dataLayer = window.dataLayer || []; function gtag(){dataLayer.push(arguments);}
// IMPORTANT - DO NOT COPY/PASTE WITHOUT MODIFYING REGION LIST // Set default consent for specific regions according to your requirements gtag('consent', 'default', { 'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied', 'functionality_storage': 'denied', 'personalization_storage': 'denied', 'security_storage': 'granted', 'region':[<list of ISO 3166-2 region codes>] }); // Set default consent for all other regions according to your requirements gtag('consent', 'default', { 'ad_storage': 'denied', 'ad_user_data': 'denied', 'ad_personalization': 'denied', 'analytics_storage': 'denied', 'functionality_storage': 'denied', 'personalization_storage': 'denied', 'security_storage': 'granted', });
</script> <!-- Mandatly Banner script here!--> |
Note: Above default consent scripts need to be placed only if the “Execute Google Tags Before Consent” (Advanced Mode) toggle is ON in Advanced Settings. |
- Click on the Validate GCM Configuration button to validate your GCM configuration. It will display the errors found if any during the GCM validation.
Relevant Resources: