1. Login to your Mandatly account -> Cookie Compliance -> Websites.
    2. Navigate to Integration tab -> Copy the banner script from Custom HTML option.
    3. 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: The Mandatly script sets the Consent Mode default itself as soon as it loads, before any Google tag fires, so the default consent script above is optional. Add it only if you need region-specific defaults of your own. If you do add it, place it above the Mandatly script.To block Google tags and other trackers until the visitor consents (Basic Consent Mode), go to the Banner Configuration tab, edit the GeoConsent Rule, and enable "Block Trackers Until Consent is Granted".


    1. 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: