Home

Awesome

Magento 2 GTM Consent Mode v2 Extension

The Collab_ConsentMode module extends native Magento_Cookie module in following ways:

The Collab_ConsentMode module works in following way:

gtag('consent', 'default', {
    'ad_storage': 'denied',
    'ad_user_data': 'denied',
    'ad_personalization': 'denied',
    'analytics_storage': 'denied'
})

Please mind that this initialization needs to be done as soon as possible (at least before GTM script is fired) so we are loading gtag's template (block name consent.initializer) in head.additional block with before="-" argument. If Your project is using customized layout please make sure that consent.initializer is first block in Yours head.additional block or it is placed at least before GTM init script.

Configuration

You can configure the module in the admin panel under Stores > Configuration > Collab Extensions > Google Consent Mode v2.

TabConfig FieldDescription
GeneralEnabled (bool: Select)If Yes then native consent popup is extended by functionalities provided by this module.
GeneralUrl Passthrough (bool: Select)If Yes then minimal information about vistors is passed even without consent. More: gTag Passthrough
GeneralIs Reject Button Visible (bool: Select)If Yes then Reject button is visible in the consent popup.
GGeneralReject Button Behaviour (select: Select)If Reject button is visible then you can choose what happens when user clicks on it. Native means that Magento functionality is preserved, 'Save Minimal Set Of Preferences' means that only necesarry checkbox is saved and popup is closed.

Installation details

composer require collab/module-consent-mode
bin/magento setup:upgrade

Screenshots

Consent Widget Embeded in CMS Page