• Resolved wal99

    (@wal99)


    Hi,

    Could you please tell me how can I enable “Google Consent Mode” in free version of plugin. Is it possible by doing some custom coding or is there a article from plugin how to do that.

Viewing 1 replies (of 1 total)
  • Plugin Author Rogier Lankhorst

    (@rogierlankhorst)

    Hi @wal99,

    Please read our article on consent mode here:
    https://complianz.io/consent-mode/

    An example implementation which you could do yourself should look something like this:

    window.dataLayer = window.dataLayer || [];
    function gtag(){dataLayer.push(arguments);}
    gtag('consent', 'default', {
    	'security_storage': "granted",
    	'functionality_storage': "granted",
    	'personalization_storage': "denied",
    	'analytics_storage': 'denied',
    	'ad_storage': "denied",
    });
    
    document.addEventListener("cmplz_cookie_warning_loaded", function (e) {
    	gtag('js', new Date());
    	gtag('config', 'G_code');
    });
    
    document.addEventListener("cmplz_fire_categories", function (e) {
    	var consentedCategories = e.detail.categories;
    	if (cmplz_in_array( 'marketing', consentedCategories )) {
                   
                gtag('consent', 'update', {
    		'security_storage': "granted",
    		'functionality_storage': "granted",
    		'personalization_storage':"granted",
    		'analytics_storage':"granted",
    		'ad_storage':"granted",
    	    });
            }
    
    });
Viewing 1 replies (of 1 total)
  • The topic ‘Google Consent Mode free’ is closed to new replies.