The tracking snippet
The whole installation is one line: a deferred script under 1KB. This article explains each attribute, where the tag goes, and the optional settings most sites never need.
- Key takeaways
- One deferred script under 1 KB in ; that's the entire install.
- data-spa, data-hash, data-outbound, data-downloads, data-exclude cover the edge cases.
- Never wrap the snippet in a consent gate, it needs no consent and gating only loses data.
The snippet
<script defer data-site="YOUR_SITE_ID" src="https://cdn.bobray.com/b.js"></script>Paste it into the <head> of every page, or your site-wide layout/template so it appears once. defer means it never blocks rendering; your Core Web Vitals are unaffected.
Attribute reference
data-site(required): your site ID from the dashboard.data-spa="off": disable automatic route-change tracking in single-page apps if you prefer manual calls.data-outbound="off": disable automatic outbound-link click events.data-hash="on": treat#/routehash changes as pageviews, for hash-routed apps.
Where it must not go
Not in the <body> footer (late loads undercount fast bounces), not inside a tag manager that itself waits for consent (BobRay needs no consent, wrapping it in a consent gate only loses you data), and not duplicated, two copies double-count.
Confirming it works
Follow Verifying your installation. The request you should see in DevTools is a single POST to api.bobray.com/e per pageview, around 300 bytes.
Common pitfalls
The mistakes we see most often on this topic, so you can skip them entirely.
- Pasting the tag in the footer, late loads undercount fast bounces.
- Loading it twice via theme + tag manager, every view counts double.
- Copying the snippet from another site in your account and reporting into the wrong dashboard.
Quick reference
| Weight | < 1 KB, deferred |
| Required attr | data-site only |
| Beacon size | ~300 bytes per view |
| Placement | , once, site-wide |