iframe loading from HTML

You can also handle this part from an Content element if you want.

load iframe after accepting

If you want to load iframes (YouTube, GMap, ..) after the Cookie is accepted you can use this snippet

<iframe width="560" height="315"
    data-cookieconsent="statistics"
    data-src="https://www.youtube-nocookie.com/embed/XXXXXX?autoplay=1"
    class="dp--iframe"
    frameborder="0" allow="accelerometer; autoplay; encrypted-media; gyroscope; picture-in-picture" allowfullscreenn >
</iframe>

With the class="dp--iframe" the iframe is hidden by default and would be shown after accepting of the cookie.

iframe overlay

if you want to add an overlay to accept Cookies outside of the cookie hint

../_images/iframe-overlay.png

You also can modify the text in this hint individually per iframe

<iframe
    data-cookieconsent="statistics"
    data-src="https://www.youtube-nocookie.com/embed/XXXXXX?autoplay=1"
    class="dp--iframe"

    data-cookieconsent-notice="Cookie Notice"
    data-cookieconsent-description="Loading this...."
    data-cookieconsent-btn="allow cookies and load this ...."
>