Analytics & GTM
Bluestars can report each visitor’s resolved BSR segment to your analytics stack so you can segment reports, build audiences, and measure personalization impact.
The bluestars_bsr_segment event
Section titled “The bluestars_bsr_segment event”When a segment resolves, the widget pushes a single event to your dataLayer
(Google Tag Manager) / gtag:
dataLayer.push({ event: "bluestars_bsr_segment", bsr_color_key: "rood", bsr_pack_key: "bsr4", bsr_pack_version: "…", bsr_color_name: "Rood", bsr_color_hex: "#…", bsr_color_origin: "postcode", // or the fallback reason tenant_id: "…", page_url: "https://your-site.nl/…", page_title: "…",});The event name is the same for every tenant, so a single GTM tag or GA4 config works across all Bluestars customers.
Setting it up in GTM / GA4
Section titled “Setting it up in GTM / GA4”- Create a Custom Event trigger on
bluestars_bsr_segment. - Read the fields above with Data Layer Variables (e.g.
bsr_color_key). - Send them to GA4 as event parameters or user properties / custom dimensions.
Because the event carries everything you need, you don’t have to observe the body class yourself — though you still can (see Reading the class in JavaScript).
Consent
Section titled “Consent”The event respects analytics consent:
- It’s gated behind Google Consent Mode (
analytics_storage) or your site’s consent hook. No consent → no event. - If your tenant has analytics disabled, the event is not sent (the widget logs a short note explaining why).