Skip to main content

Iframe rules

Iframes load third-party content into your page, such as embedded videos, maps and social posts. Many set cookies or track visitors, and OptSens can block them until the visitor consents. This page lists the iframes the scanner found and lets you add your own rules.

Enable iframe blocking first

Iframe management is controlled by the Auto iframe blocking setting in your privacy settings. Until it is enabled, the iframes you categorize and the custom rules you add do not take effect on your site. The page shows a reminder when blocking is off. Iframe blocking requires the Pro plan or higher.

Detected iframes

The iframes the scanner found are grouped by category. Unknown iframes, the ones not in the OptSens library, are grouped separately and counted, which makes them quick to find. Assign a category to each unknown iframe. The banner then manages it correctly. These categories apply:

CategoryWhen the iframe loads
NecessaryAlways, never blocked
FunctionalAfter consent to functional
AnalyticsAfter consent to analytics
AdvertisingAfter consent to advertising

An iframe you recategorized is marked Your override, and your choice is kept across rescans. Save changes from the bar at the bottom of the page.

Built-in library

OptSens ships a built-in library of more than 700 iframe embed patterns, including YouTube, Google Maps, Facebook, TikTok and Vimeo. These are recognized and blocked automatically once iframe blocking is on. Most sites need no custom rules.

Custom rules

Add a custom rule for an iframe the scanner did not detect, or to force a specific behavior:

  1. Fill URL or domain pattern. The iframe src matches when it contains this text, for example youtube.com/embed or maps.google.com.
  2. Pick the Action, either Block until consent or Always allow (whitelist) for an iframe that must never be blocked.
  3. Pick the Category the block is tied to. Advertising is preselected.
  4. Optionally fill Provider name and Description for your own records.
  5. Click Add rule. The rule takes effect on your site within a few minutes.

Rules can be toggled on or off and deleted. Only your own rules appear in the custom rules list. Library matches are handled automatically.

What visitors see

When an iframe is blocked, a placeholder overlay replaces it with the provider name, the category, and an Allow button that consents to that category and loads the content. See auto-blocking for how the placeholder behaves, and the recipe for blocking YouTube embeds for a worked example.