Blocking tags using Guardian

Asking consent is not enough for your website, you need to be sure that cookies or others tracking technologies are not used without the consent of the user.

For this, we propose a script called Guardian.

circle-info

INFO

At this point, we assume that you followed the instructions in this section to install the CMP

1. Setup the whitelist/blacklist list in the <head>

In the <head> section, configure the urls to be blacklisted or whitelisted in the dynamicallyLoadedScripts in the parameter of the configSFBXAppConsent configuration variable like this :

<script type="text/javascript">
    const configSFBXAppConsent = {
        appKey: 'YOUR_APP_KEY',
        dynamicallyLoadedScripts: {
            blacklist: [
                /facebook/, /youtube/,
            ],
            whitelist: [
                /appconsent/,
            ]
        },
    }
</script>
circle-info

INFO

In the code above, we take control on Facebook and Youtube. If you want to add a new domain, let's say ads-twitter.com, just add this new entry

2. Add the Guardian script

Add the Guardian script in the <head> section, after the definition of the configSFBXAppConsent variable.

triangle-exclamation

That's it - All the tags are now blocked until the user consent. If the user deny cookies in the cmp, the tags will remains blocked.

circle-info

INFO

This library is using observer and override CreateElement core JS functionalities. If you expriment tests that are not working, please deactivate Chrome or Firefox extension in your browser.

We will add new capabilities regularly (more controls, shared database of tags...)

Any issue or suggestions ? Drop an email at [email protected]envelope

Last updated