Welcome to Vanilla Breeze
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
This bell pulls live notifications from /go/notify/messages — the same contract documented at /docs/concepts/service-contracts/. Static articles like this one are the no-JS / no-backend fallback.
Declarative analytics — fire a normalised analytics event on click without writing JavaScript. Properties via data-vb-event-* siblings.
The data-vb-event attribute turns any interactive element into an analytics tracking point. When the element (or a descendant) is clicked, the Vanilla Breeze analytics runtime fires a single normalised event through Analytics.track() — no JavaScript authored per element, no glue code per page.
Applies to: any element (the runtime uses a single delegated click listener on document).
Requires: vanilla-breeze-core.js (the analytics runtime auto-wires this attribute on boot).
Put the attribute on any element users can click. The value becomes the analytics event name.
<button data-vb-event="signup_click">Create account</button> <a href="/pricing" data-vb-event="pricing_nav">See pricing</a> <article data-vb-event="card_open"> <h3>Getting Started</h3> <p>Click anywhere on the card.</p></article>
Clicking any of these elements fires one Analytics.track(name, props) call. The runtime is idempotent and safe to put on elements that already have their own handlers.
Add any number of data-vb-event-* attributes to attach named properties. The attribute name is lower-camelised into the props object.
<button data-vb-event="signup_click" data-vb-event-plan="pro" data-vb-event-source="hero" data-vb-event-variant="green"> Start Pro Plan</button> <!-- Fires: Analytics.track('signup_click', { plan: 'pro', source: 'hero', variant: 'green' }) -->
Property values are always strings — the runtime does not parse numbers or booleans. Keep values short and enumerable (categories, IDs, slugs) rather than raw user input.
Vanilla Breeze normalises event names using a category.action_detail pattern. For custom events, follow the same convention so your data groups cleanly in dashboards alongside the auto-wired VB events.
<!-- Good -->data-vb-event="form.submit_pricing"data-vb-event="nav.docs_click"data-vb-event="cta.download_theme" <!-- Avoid (too generic) -->data-vb-event="click"data-vb-event="button1"data-vb-event="event42"
pingThe native ping attribute sends a fixed POST body to a URL on link click. data-vb-event fires a structured event through the analytics pipeline — richer payload, browser-agnostic, works on any element.
ping | data-vb-event | |
|---|---|---|
| Works on | <a> only | Any element |
| Requires JavaScript | No | Yes |
| Payload | Fixed PING body | Structured event + props |
| Fires in Firefox | No (disabled by default) | Yes |
| Respects opt-out | No (always sends) | Yes (GPC / DNT / session opt-out) |
The two compose well — use ping on outbound anchors for zero-JS attribution, and add data-vb-event for richer event data when JavaScript is available.
To prevent an element (and its descendants) from firing any analytics — including both data-vb-event and the auto-wired VB events — add data-vb-no-track to an ancestor. Exclusion wins over event declaration.
<section data-vb-no-track> <!-- No analytics from anything in here, even with data-vb-event --> <button data-vb-event="admin_action">Admin Action</button></section>
For events that don't originate from a click — form submissions, timers, custom component state — call Analytics.track() directly.
import { Analytics } from 'vanilla-breeze'; Analytics.track('wizard.step_skipped', { step: 2 });Analytics.track('timer.idle_30s');
Both paths share the same envelope, opt-out gates, transport, and URL masking — they are interchangeable and can coexist on the same element.
data-vb-event firings respect the same opt-out precedence as direct Analytics.track() calls: session opt-out → Global Privacy Control (navigator.globalPrivacyControl) → Do Not Track → app-supplied consent function.document for click.data-vb-no-track — opt an element and its descendants out of analyticsping — native link-click trackingreferrerpolicy — control referrer leakage on analytics requests