Display Preference Center on Script Load
To show site visitors the Preference Center immediately upon page loading and not showing the Cookie Banner, place the following HTML code to the <head>
of your site.
<!-- OneTrust Cookies Consent Notice start -->
<script src="https://cdn.cookielaw.org/scripttemplates/otSDKStub.js" type="text/javascript" charset="UTF-8" data-domain-script="YourDomainID"></script>
<script type="text/javascript">
function OptanonWrapper() {
if(OneTrust.IsAlertBoxClosed() === false){
var banner = document.getElementById("onetrust-banner-sdk");
var prefpc = document.getElementById("onetrust-pc-sdk");
var filter = document.getElementsByClassName("onetrust-pc-dark-filter")[0];
banner.style = "display: none;";
prefpc.style = "display: block !important;animation: example1 3s linear";
filter.style = "display: block !important;";
/* Move it (define the animation) */
}
}
</script>
<style>
@keyframes example1 {
0% {
transform: translateY(-200%);
}
100% {
transform: translateY(0%);
}
}
</style>
Updated about 1 year ago