Kjeks
← All docs

Kjeks Social — consent-gated social embeds

Social widgets held behind the Kjeks consent layer. The provider script stays inert until the visitor consents, and the quoted post is shown as a fallback — the gated markup is identical for everyone, so it stays cache-safe.

Requires WordPress 6.8+PHP 8.3+Requires the Kjeks core Source on GitHub →

101 Setup

This add-on gates the social widgets that Kjeks Embeds deliberately skips — the ones that ship a <blockquote> plus a provider script. 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-social.zip and upload it under Plugins → Add New → Upload Plugin, then activate it (network-activate on multisite).
  • Updates arrive automatically from GitHub releases.

Pick a category per provider

Open Cookie Consent → Social and assign each provider a consent category — Analytics or Marketing — or Off to pass it through ungated. Supported providers: X/Twitter, Instagram, TikTok, Facebook, Pinterest, Reddit, and Bluesky.

201 How gating works

On the_content (priority 20) the add-on detects each provider's widget, strips its <script src> by URL, and re-registers it through the core Kjeks blocking registry as an inert script that only runs once the visitor consents to the mapped category:

// For each detected widget, the provider's <script src> is stripped and
// re-registered with the core Kjeks blocking registry — inert until consent:
kjeks_register_integration( 'social-twitter', array(
    'category'     => 'marketing',                  // the mapped category
    'label'        => 'twitter',                    // the provider
    'src_scripts'  => array( 'https://platform.twitter.com/widgets.js' ),
) );

The provider's <blockquote> stays in place as a readable fallback, so a visitor who never consents still sees the quoted post — just without the interactive embed. Because the gated markup does not vary per visitor, it stays safe behind a full-page cache; consent is released client-side on the kjeks:granted event.

An invalid or missing category coerces to marketing, so a bad mapping can never leave a social script ungated.

301 Config, filters & internals

Option

OptionScope
kjeks_socialNetwork option on Multisite, regular option on single site — a category per provider.

Filters

Override the category for a single provider at render time:

add_filter( 'kjeks_social_category', function ( $category, $provider, $html ) {
    // $category = 'analytics', 'marketing', or 'off'
    // Make Bluesky analytics instead of marketing:
    if ( 'bluesky' === $provider ) {
        return 'analytics';
    }
    return $category;
}, 10, 3 );

Or adjust the whole per-provider map:

add_filter( 'kjeks_social_config', function ( $config ) {
    // $config = per-provider category map, e.g.
    // [ 'twitter' => 'marketing', 'instagram' => 'marketing',
    //   'tiktok' => 'marketing', 'facebook' => 'marketing', ... ]
    return $config;
} );

Built on AddonKit

Kjeks Social renders as the Social tab on the Cookie Consent screen through the shared Soderlind\Kjeks\AddonKit base classes — it extends AddonKit\AbstractFormTab and stores its option through AddonKit\Options. See the Build an add-on guide to build your own the same way.

Use the scanner to confirm a gated social widget does not load in the before-choice and reject-all states.