Share Cookies Across Subdomains

This guide explains how to share cookie consent settings between your main website and subdomains (e.g., www.example.com and shop.example.com).

The Problem

By default, cookie consent is stored as a host-only cookie, which means:

  • If a visitor accepts cookies on www.example.com, the consent is not recognized on shop.example.com
  • Users would need to accept cookies separately on each subdomain
  • This creates a poor user experience, especially for websites with webshops or other services on subdomains

The Solution

The "Share cookies across subdomains" feature solves this by setting cookies with the parent domain (e.g., .example.com), making them accessible to all subdomains.

How to Enable

  1. Go to Extensions → Plugins in your Joomla administrator
  2. Find and open System - Web357 Cookies Policy Notification Bar
  3. Navigate to the Advanced Settings tab
  4. Scroll down to the "Share Cookies Across Subdomains" section
  5. Set "Share cookies across subdomains" to Yes
  6. Click Save

Share Cookies Across Subdomains Setting

How It Works

When enabled, the plugin automatically:

  • Detects your parent domain (e.g., example.com from www.example.com or shop.example.com)
  • Sets all consent cookies with domain=.example.com
  • This allows all subdomains to read and write the same consent cookies

Affected Cookies

The following cookies will be shared across subdomains:

  • cpnb_cookiesSettings - Stores the user's category preferences
  • cpnbCookiesDeclined - Indicates if the user declined cookies
  • cpnbCookiesCancelled - Indicates if the user cancelled the consent dialog
  • The accept cookie (default: cookiesDirective)

Requirements

For this feature to work correctly:

  • ✅ Both the main site and subdomain must use HTTPS
  • ✅ The plugin should be installed on both sites (if applicable)
  • ✅ Both installations should have the same setting enabled
  • ✅ Clear existing cookies in your browser after enabling this feature for the first time

Common Use Cases

Webshop on Subdomain

Your main website is at www.example.com and your webshop is at shop.example.com. With this feature enabled, customers only need to consent once.

Multi-language Sites

If you have language-specific subdomains like en.example.comde.example.com, and fr.example.com, consent will carry over between all language versions.

Staging/Development

Share consent between www.example.com and staging.example.com for consistent testing.

Troubleshooting

Cookies still not shared?

  1. Clear browser cookies - Old host-only cookies may still exist
  2. Check HTTPS - Both domains must use HTTPS
  3. Verify the setting - Ensure the setting is enabled and saved
  4. Check domain detection - The plugin automatically detects the parent domain; complex domain structures (like shop.co.uk) may need verification

Need to revert?

Simply set the option back to No. New cookies will be created as host-only cookies again. Note that existing shared cookies may persist until they expire or are manually cleared.

Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.

Still need help? Contact Us Contact Us