The segment class
The simplest way to personalize is the body segment class. The widget adds a
single class to your <body> element, one per visitor segment, and you write your
own CSS against it. No changes to your templates, no content managed by us: just
CSS you control.
<!-- What the widget adds for a "rood" (red) visitor: --><body class="bsr-segment-rood"></body>The class is always bsr-segment- + the visitor’s pack slug. Old classes are
removed before a new one is added, so exactly one bsr-segment-* class is present
at a time.
The classes for your pack
Section titled “The classes for your pack”The exact list depends on your pack:
- bsr4:
bsr-segment-rood,bsr-segment-geel,bsr-segment-blauw,bsr-segment-groen - bsr8: the eight color slugs (
bsr-segment-rood,bsr-segment-lime, …) - bsr7lei: the seven leisure slugs (
bsr-segment-avontuurzoekers, …)
Your dashboard’s Styling page lists the exact classes for your tenant and lets you copy them: “these are exactly the classes your visitors get, no more, no less.”
Best-guess visitors also get bsr-segment-unknown (see
fallback).
Example use cases
Section titled “Example use cases”/* 1. Segment-specific CTA color */body.bsr-segment-rood .cta { background: #d33;}body.bsr-segment-blauw .cta { background: #06c;}
/* 2. Swap a hero image with pure CSS (no markup change) */body.bsr-segment-groen .hero { background-image: url("/img/hero-groen.jpg");}
/* 3. Show or hide a USP block per segment */.usp--trust { display: none;}body.bsr-segment-blauw .usp--trust { display: block;}
/* 4. Segment microcopy via ::before */body.bsr-segment-geel .cta::before { content: "Populair bij mensen zoals jij: ";}Showing variants per segment
Section titled “Showing variants per segment”Web copy and blogs your assistant makes through the MCP connection come as one document
with a variant per segment, plus the neutral “General” variant for visitors we do not
recognise. Put all of them in your page and let the segment class show one. Put
every variant in a <section class="bsr-content" data-bsr-segment="…"> and include
the CSS below in your page:
<section class="bsr-content" data-bsr-segment="algemeen">…</section><section class="bsr-content" data-bsr-segment="blauw">…</section><section class="bsr-content" data-bsr-segment="geel">…</section>/* Bluestars: every variant is in the page, this CSS shows one of them. *//* The neutral variant is the default, so nothing is empty before the segment is known. */.bsr-content { display: none;}.bsr-content[data-bsr-segment="algemeen"] { display: block;}body.bsr-segment-blauw .bsr-content[data-bsr-segment="algemeen"] { display: none;}body.bsr-segment-blauw .bsr-content[data-bsr-segment="blauw"] { display: block;}body.bsr-segment-geel .bsr-content[data-bsr-segment="algemeen"] { display: none;}body.bsr-segment-geel .bsr-content[data-bsr-segment="geel"] { display: block;}One pair of rules per segment you generated, not per segment of your pack: a visitor from a segment without a variant keeps reading the general text. General is there from the first paint, so nothing is empty while the segment is still being determined; do reserve the same space for every variant (see below).
Timing & good practice
Section titled “Timing & good practice”The class is added asynchronously, roughly 200 ms after the segment resolves, not on the very first paint.
.cta { background: #333; /* neutral default, visible immediately */ transition: background 0.3s ease;}Reading the class in JavaScript
Section titled “Reading the class in JavaScript”Because it’s added async, read it with a MutationObserver rather than at load:
new MutationObserver(() => { const seg = [...document.body.classList].find( (c) => c.startsWith("bsr-segment-") && c !== "bsr-segment-unknown" ); if (seg) { // e.g. push to your own dataLayer console.log("BSR segment:", seg.replace("bsr-segment-", "")); }}).observe(document.body, { attributes: true, attributeFilter: ["class"] });Bluestars itself sends no events to your analytics. If you want the segment in your own analytics, this is the place to pass it on.