to be honest - I've never done something like this, but I could think of a a custom module with an if-statement that will check for the marketing-cookie or trigger the cookie banner...
{% if marketing_cookie %}
{{ module.form }}
...
{% else %} {# <-- if marketing cookie is not set #}
{% require_css %}
<style>
.cookie-overlay{
display:flex;
justify-content:center;
align-items: center;
background-color:#eaeaea;
}
span.cookie-banner-button{
background-color: #f00;
color:#fff;
padding:.75rem 2rem;
font-weight:700;
display:inline-flex;
}
</style>
{% end_require_css %}
{% require_js %}
<script>
document.querySelectorAll('.cookie-banner-button').forEach(button => {
button.addEventListener('click', function() {
(function(){
var _hsp = window._hsp = window._hsp || [];
_hsp.push(['showBanner']);
})();
});
});
</script>
{% end_require_js %}
<div class="cookie-overlay">
<p><strong>In order to fill out the form, please enable Marketing cookies</strong></p>
<span class="cookie-banner-button">Manage Cookies</span>
</div>
{% endif %}
PS: Mark HubSpot scripts with data-cookieconsent="ignore" If your embed uses HubSpot’s tracking or scripts blocked by Cookiebot, tag them to bypass auto-blocking.
to be honest - I've never done something like this, but I could think of a a custom module with an if-statement that will check for the marketing-cookie or trigger the cookie banner...
{% if marketing_cookie %}
{{ module.form }}
...
{% else %} {# <-- if marketing cookie is not set #}
{% require_css %}
<style>
.cookie-overlay{
display:flex;
justify-content:center;
align-items: center;
background-color:#eaeaea;
}
span.cookie-banner-button{
background-color: #f00;
color:#fff;
padding:.75rem 2rem;
font-weight:700;
display:inline-flex;
}
</style>
{% end_require_css %}
{% require_js %}
<script>
document.querySelectorAll('.cookie-banner-button').forEach(button => {
button.addEventListener('click', function() {
(function(){
var _hsp = window._hsp = window._hsp || [];
_hsp.push(['showBanner']);
})();
});
});
</script>
{% end_require_js %}
<div class="cookie-overlay">
<p><strong>In order to fill out the form, please enable Marketing cookies</strong></p>
<span class="cookie-banner-button">Manage Cookies</span>
</div>
{% endif %}