Kjeks Embeds — consent-gated oEmbeds
Third-party embeds held behind the Kjeks consent layer. No request reaches the provider until the visitor consents, and the gated markup is identical for everyone — safe behind a full-page cache.
101 Setup
This add-on gates embeds through Kjeks. Install the
core plugin first — the add-on declares it as a hard
dependency (Requires Plugins: kjeks) and does nothing without it.
Install & activate
-
Download the latest
kjeks-embeds.zipand upload it under Plugins → Add New → Upload Plugin, then activate it (network-activate on multisite). - There is no migration — it registers embed gating and a settings screen.
- Updates arrive automatically from GitHub releases via plugin-update-checker.
Pick a category per embed source
Open Cookie Consent → Embeds (slug kjeks-embeds, mounted as a
submenu of the core Kjeks menu on both single-site and Multisite). Assign each
source a consent category — Analytics or Marketing — or
Off to pass it through ungated.
201 What gets gated
Automatic oEmbed providers
YouTube, Vimeo, Spotify, SoundCloud, and Dailymotion are gated automatically
wherever they appear — the core/embed block and the
[embed] shortcode / autoembed.
| Source | How |
|---|---|
| YouTube, Vimeo, Spotify, SoundCloud, Dailymotion | Gated automatically via oEmbed. |
| Any other oEmbed provider (Issuu, Scribd, TED, …) | Gated with a generic single-iframe fallback you can turn Off. |
| Google Maps | Gated via the [kjeks_google_map] shortcode — Maps has no oEmbed endpoint. |
| Twitter/X, TikTok, Facebook, Instagram | Script/blockquote embeds (not a single iframe) — passed through untouched. |
Google Maps shortcode
Copy the src from Google's Share → Embed a map dialog into the
shortcode. Only Google's own Maps embed URL is accepted:
[kjeks_google_map src="https://www.google.com/maps/embed?pb=..." ]
<!-- Override the Maps category for a single map: -->
[kjeks_google_map src="https://www.google.com/maps/embed?pb=..." category="analytics"]
Privacy touches
- YouTube is served through
youtube-nocookie.com. - Vimeo unlisted-video privacy hashes are preserved.
- The gated markup is the same for every visitor, so it is safe behind a full-page cache; consent is released client-side.
301 Config, filters & internals
Option
| Option | Scope |
|---|---|
kjeks_embeds | Network option on Multisite, regular option on single site — a category slug (or off) per embed source. |
Per-embed override filter
kjeks_embeds_category resolves the category for a single embed
(receives the category, the provider, and the URL), so one video can be marketing
while another is analytics:
add_filter( 'kjeks_embeds_category', function ( $category, $provider, $url ) {
// $category = 'analytics', 'marketing', or 'off'
// Make one specific video analytics instead of marketing:
if ( str_contains( $url, 'youtu' ) && str_contains( $url, 'ABC123' ) ) {
return 'analytics';
}
return $category;
}, 10, 3 );
Resolved-config filter
Adjust the whole per-source map with kjeks_embeds_config:
add_filter( 'kjeks_embeds_config', function ( $config ) {
// $config = per-source category map, e.g.
// [ 'youtube' => 'marketing', 'vimeo' => 'analytics', 'maps' => 'marketing',
// 'other_iframes' => 'off' ]
return $config;
} );
before-choice and reject-all states — the
quickest proof your embed gating is correct.