Omea Consent · Guides

Share cookie consent across subdomains (WordPress)

Let visitors choose once for example.com and all its subdomains with Omea Consent Pro's One choice across subdomains – WordPress or not.

Updated · Omea Consent 1.0.2

On this page
  1. Turn it on
  2. How it works
  3. Subdomains that aren’t WordPress
  4. Turning it off
  5. For developers

Visitors don’t think in subdomains. If they accept cookies on example.com, they don’t expect to be asked again on shop.example.com or help.example.com. With One choice across subdomains, they aren’t.

This help site is a live example: support.cultmetrics.com shows the same banner as www.cultmetrics.com, and one choice covers both.

Turn it on

  1. Activate Pro on the main site Install and activate Omea Consent Pro on the WordPress site at your main domain.
  2. Turn on subdomain sharing Go to Omea Consent › Settings › Advanced and switch on One choice across subdomains. Click Save changes.
  3. Cover your other subdomains On a subdomain that runs its own WordPress with Omea Consent, turn the same setting on there. On a subdomain that isn’t WordPress, paste the embed line into its <head>.
  4. Test both ways In a private window, choose on one subdomain, then open the other. The banner shouldn’t appear, and the cookie icon should show the same choice.

How it works

Normally the consent cookies belong to the exact host the visitor is on. With sharing on, Omea sets omea_consent_state and omea_consent_id for the whole domain – .example.com – so every subdomain reads the same choice.

  • The shared choice records when it was made and under which banner version. A subdomain picks up a newer choice made elsewhere when the page loads.
  • If the banner texts have changed since the choice, it’s ignored and the visitor is asked again – as on a single site.
  • Each choice is still logged in the consent log of the site where it was made.

Subdomains that aren’t WordPress

A shop on Shopify, a help centre or a landing-page tool on a subdomain can show the same banner with one line in its <head>:

<script src="https://www.example.com/wp-json/omea-consent/v1/embed.js"></script>

With sharing on, the embed script runs on every subdomain of your domain. See Show the cookie banner on pages outside WordPress.

Turning it off

If you switch sharing off, Omea removes visitors’ old domain-wide cookie (for one consent lifetime), so it can’t override the new per-host cookie. Visitors may be asked once more on subdomains where they hadn’t chosen themselves.

For developers

The cookie domain is your host without www, with a leading dot. To use a different one, filter omea_consent_cookie_domain – the value must start with a dot, for example .example.co.uk. Sharing isn’t available on IP addresses or single-label hosts such as localhost.