Supported Plans: All
In some cases, it may be necessary for you to manually prevent scripts from loading in order to block cookies. For example, embedding a video with JS that has cookies. CookieScan has a JS API available to you in order to check for a users consent in JS.
To turn on the API:
- Log into the CookieScan portal at cookiescan.com
- Click “manage domain” on your domain
- Scroll to “Pop-Up Settings”, turn on the “Switch On JavaScript API” switch and click “Save and update” at the bottom
This will now make a JS Object available to you on your site
| JS Variable | Type | Description |
|---|---|---|
| cookieScan.consentGiven | bool | True if the user has accepted necessary cookies. Will always be true |
| cookieScan.consent.preference | bool | True if the user has accepted preference cookies |
| cookieScan.consent.statistics | bool | True if the user has accepted statistics cookies |
| cookieScan.consent.marketing | bool | True if the user has accepted marketing cookies |
| cookieScan.consent.unclassified | bool | True if the user has accepted unclassified cookies |
To use the API:
You can use these variables in order to do things depending on what a user has accepted, for example if you have a YouTube video that you know includes marketing and consent cookies. You can use a simple if statement to only load that video if the user has provided consent for both categories.
if(cookieScan.consent.marketing && cookieScan.consent.statistics){
//load youtube video here
}
Comments
0 comments
Please sign in to leave a comment.