To add the Usercentrics web CMP script, which will surface a consent banner and control whether services can run based on your visitor's consent choices, you must copy the snippet from the Usercentrics Admin Interface.
You can find it by selecting Implementation from the main menu, on the Script Tag tab.
The Usercentrics Web CMP script in the Admin interface
Clicking the script will copy it to your clipboard.
The script can then by added to your website's template, ideally right below the opening <head>
tag.
Important
If you intend to use the auto-blocking feature, you must ensure that the CMP script loads before any other scripts!
Here is an example how that might look:
<!DOCTYPE html>
<html lang="en">
<head>
<!-- Usercentrics Web CMP --> <script src="https://web.cmp.usercentrics.eu/modules/autoblocker.js"></script>
<script
id="usercentrics-cmp"
src="https://web.cmp.usercentrics.eu/ui/loader.js"
data-settings-id="XxxXXXxx"
async
></script>
<!-- End Usercentrics Web CMP -->
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Consent Mode implementation demo</title>
...
</head>
<body>
...
</body>
</html>
Comments
1 comment
I have added the provided script to the website https://www.galaxyweblinks.com/ built with next js. I am getting below error:
"Runtime Error
TypeError: Cannot read properties of undefined (reading 'cssMode')
Call Stack
Swiper.onLoad
webpack-internal:\node_modules\swiper\shared\swiper-core.mjs (2778:1)
window.Autoblocker.Def.applyOverrideEventListeners
https://web.cmp.usercentrics.eu/modules/autoblocker.js (1:6800)
<unknown>
https://web.cmp.usercentrics.eu/modules/autoblocker.js (1:28152)""
Could you please look into it and let us know your thoughts?
Please sign in to leave a comment.