Skip to main content
All CollectionsCustomization and advanced settingsBlocking content and tag templates
Provide placeholder for blocked page elements (YouTube, Vimeo etc)
Provide placeholder for blocked page elements (YouTube, Vimeo etc)

This article lets you know how to give placeholders to blocked page elements (e.g. YouTube, Vimeo)

Updated over a week ago

Provide placeholder for blocked page elements

In some cases where you have blocked something using the SDK, that when unblocked usually is something visual on the page, then it might be a good idea to have something else to replace the otherwise blank space.

From the 10th of Jun. 2020 a new feature was added to all templates in the platform that allows you to have an element on the page that disappears after users have given consent. If you wish you can update your template and get this feature with it.
โ€‹See how to change the template here

<div class="consent-placeholder"  
data-category="cookie_cat_marketing"
onClick="CookieConsent.renew()">
You have not yet consent to marketing
</div>

You can place this element underneath the script that is blocked and it will only show while the script is still being blocked.

If you do not have this feature in your current template, then you can copy it and place it yourself in the javascript field of the template.

window.addEventListener('CookieInformationConsentGiven', function(event) {
var consentplaceholders = document.getElementsByClassName('consent-placeholder');
if (consentplaceholders) {
for (var i = 0; i < consentplaceholders.length; i++) {
if (!CookieInformation.getConsentGivenFor(consentplaceholders[i].getAttribute('data-category'))) {
consentplaceholders[i].style.display = 'block';
} else {
consentplaceholders[i].style.display = 'none';
}
}
}
}, false);

Example:

Related articles:

Did this answer your question?