Load Videos, Maps and Chat Widgets Only After Consent
Last updated: November 15, 2026
Analytics may respect a visitor’s choice while the contact-page map or site-wide chat still calls an external service. These integrations are easy to miss because they live in different CMS blocks, plugins and templates. This guide explains a configuration where selected embeds wait for their category to be allowed, while the page remains useful when the visitor declines.
Inventory embedded services across the site
Inspect more than the homepage. Videos can appear in articles and product pages, maps on contact pages, and chat in shared templates. Include review widgets, booking tools, callback buttons and external forms. Identify each installation point and its owner.
Classify the service from its purpose and actual configuration, not simply from the word “map” or “chat”. The technical goal here is to delay selected external integrations until the corresponding category is allowed; that architectural choice does not determine every requirement applicable to a website.
| Integration | Installation point | Before loading |
|---|---|---|
| Video | iframe, video block or player script | Local cover image and description |
| Map | Contact page or HTML block | Written address and directions |
| Chat | Plugin, template or tag manager | Phone, email or an owned form |
| External form | iframe or provider script | Explanation and another contact option |
A hidden iframe or lazy loading is not a consent gate
Hiding an iframe that already has an external src does not establish a consent condition. loading="lazy" relates loading to the frame’s position, not to a category choice. Scrolling can therefore trigger the embedded content before a banner interaction.
For a consent-gated configuration, create the external frame only after permission, or keep its URL inactive until your handler assigns src. A data-src attribute is just an agreement with your own code. Check whether an existing lazy-loading library already activates that attribute independently.
References: MDN: iframe src and loading
Provide a useful placeholder
Explain what would appear and how to enable it. For example: “This area contains an external video. Allow the relevant category in cookie settings to load it.” Use the same category name as the consent interface.
Do not turn a “Watch video” click into silent acceptance of every category. The button can open preferences for an explicit choice. A separate service-specific permission needs a clearly explained and implemented consent model, not a label placed on an ordinary link.
Inspect the placeholder’s resources too. A cover image hosted by the video provider already makes an external request. Where the goal is no provider requests before the choice, use an image you own or are licensed to host locally. Keep written directions beside a map and an alternative contact method beside chat.
- Name the unavailable feature clearly.
- Explain the button action without hidden acceptance.
- Use local placeholder resources when external calls must wait.
- Preserve an alternative information or contact path.
- Support keyboard use and reserve a stable block size.
Connect loading to Cookiestack
Handle scripts and embedded documents separately. Cookiestack supports scripts marked type="text/plain" and data-cookie-category with autoBlock enabled. Replace the original executable installation: an inert duplicate cannot stop a plugin’s independently injected script.
Iframes need a site-side handler. The current autoBlock mechanism operates on marked script tags; it does not automatically create placeholders for arbitrary frames. A handler can use the documented cb:consent event, check the relevant category and create the permitted embed. Include returning visitors with an existing choice.
Make initialization idempotent so repeated events do not create additional players or chats. Define withdrawal behavior per provider. Changing a flag alone does not stop code that already executed; a service may need its shutdown API, removal of the embedded document or a page reload.
References: Cookiestack script blocking · The cb:consent event · MDN: non-executable script types
Test rejection as well as successful loading
Open Network before loading the page and enable Preserve log for navigation. Before making a choice, scroll to the embed and perform actions that normally open chat. Inspect provider calls including cover images and supporting resources, not just the main script.
Run independent rejection and acceptance scenarios. Rejection should leave the placeholder and alternative contact path usable. Acceptance should initialize the widget once in the intended space. Also check returning visits and changes to the saved choice.
Verify the published page because a CMS preview may include editor-specific resources. Repeat affected scenarios after plugin upgrades or block replacements. A correctly configured homepage does not demonstrate that a newly added campaign form follows the same rules.
References: Chrome: Network and Preserve log
Write a precise implementation brief
Provide the page and service inventory, category mapping, placeholder copy and expected behavior before a choice, after rejection, after acceptance and after withdrawal. Include returning visits and duplicate prevention. These criteria are more actionable than “connect every widget to the banner”.
Start with one page and one service, verify it, then apply the approach to other installation points while accounting for provider differences. Configure Cookiestack categories and retain the acceptance results with the integration inventory so the next maintainer can find the responsible settings.
References: Banner and category configuration
Frequently asked questions
Is loading="lazy" enough for a map or video?
No. Position-based loading does not establish category permission. Use separate control over embed creation or loading when consent must come first.
Does Cookiestack automatically block every iframe?
No. Its current autoBlock activates marked inert scripts. Iframe placeholders and the embedded service lifecycle require a separate site integration.
Should contact information disappear after rejection?
Keep a useful contact path. Written addresses, phone numbers and email let visitors complete their task without loading an external map or chat.