For the complete documentation index, see llms.txt. This page is also available as Markdown.

Domains and subdomains management

The Web Push standard ties each opt-in to the subdomain on which it was collected: users who opt in to push notifications on domain.com are not automatically opted in on shop.domain.com. This page explains why, and describes three architectures you can choose from depending on whether your subdomains share a single userbase and purpose or not.

Why is opt-in bound to a single subdomain?

With Web Push, the push token and the notification permission are bound to the exact subdomain where they were collected. The browser treats each subdomain as a separate installation, with its own opt-in request. As a result, an opt-in on one subdomain does not carry over to another.

This is a constraint of the Web Push standard itself, not a Batch limitation, so it applies regardless of how you configure your project. The standard does not allow cross-domain or cross-subdomain subscriptions. Two consequences follow from it:

  • A separate opt-in request appears on each subdomain where you deploy the Batch SDK.

  • If users accept the opt-in on two subdomains linked to the same project, a full-base campaign reaches these users twice.

The recommended architecture depends on whether your subdomains belong to the same product and audience, or to distinct ones.

Case 1: Subdomains of the same product, shared userbase and purpose

This is the most common case. Examples include country sites served on several domains (domain.fr, domain.it, us.domain.com) or several sections of the same product.

Recommended architecture:

  • A single project on the Batch dashboard.

  • One main subdomain referenced on the project, for example, the one with the most traffic.

  • The other subdomains added under Settings > Channels > Push > Push Configuration: Web > Allowed Origins.

  • The Service Worker (batchsdk-worker-loader.js) hosted at the root of each subdomain.

  • The same JavaScript tag on every subdomain.

For targeting:

  • To target the users of one specific subdomain, plan a dedicated custom attribute in your tagging plan, for example domain_visited = "fr".

  • An opt-in request appears on each subdomain. If users accept the request on two subdomains and you send a full-base campaign, these users receive the push twice.

Case 2: Subdomains with distinct userbases and purposes

Examples include a corporate site alongside an e-commerce site, two sister brands on separate subdomains, or two independent products.

Recommended architecture:

  • One project per subdomain, each with its own userbase.

  • The Service Worker hosted on each subdomain.

  • A different JavaScript tag on each subdomain.

With this setup, a separate opt-in request appears on each subdomain, and you target users of a given subdomain through their own project.

Use this when you want to collect push opt-ins only on one subdomain, for example the home page, while still routing notification clicks to a secondary store subdomain.

Recommended architecture:

  • A single project linked to a single subdomain.

  • The Service Worker and the JavaScript tag deployed only on the subdomain where opt-in is collected and data is reported.

Deeplinks inside the notifications can still send users to any subdomain. Opt-in collection and click destination are independent.

Last updated