Tracking
Add the script
Each website in the dashboard has its own tag. It looks like this:
<script defer src="https://your-instance.example/script.js" data-website-id="…"></script>Replace the host with your instance and the id with the one shown for your website. The script
records a pageview on load and on client-side navigation (pushState, replaceState and
popstate).
Options
Set these as data- attributes on the script tag.
| Attribute | Effect |
|---|---|
data-website-id |
Required. The website’s id. |
data-host-url |
Send data to this host instead of the host the script was loaded from. |
data-auto-track |
Set to false to turn off automatic pageviews. Track them yourself with conveyor.track(). |
data-exclude-search |
Set to true to drop the query string from tracked URLs. |
data-exclude-hash |
Set to true to drop the #hash from tracked URLs. |
data-do-not-track |
Set to true to respect the browser’s Do Not Track and Global Privacy Control signals. |
data-domains |
Comma-separated hostnames. Only track when the page is served from one of them. |
data-tag |
A free-form tag added to every event, for example to segment A/B tests. |
data-before-send |
Name of a global function that receives (type, payload) and returns the payload to send, or a falsy value to drop the event. |
Custom events
Call conveyor.track() from your own code:
conveyor.track('signup');conveyor.track('signup', { plan: 'pro' });With no arguments, conveyor.track() records a pageview. You can also pass an object to override
the payload, or a function that receives the current payload and returns the fields to change.
Event attributes
Add data-conveyor-event to any element to track clicks on it. Extra
data-conveyor-event-* attributes become event properties:
<button data-conveyor-event="signup" data-conveyor-event-plan="pro">Sign up</button>An element with an empty event name is ignored.
Identify
conveyor.identify() attaches your own data to the current visitor. Pass an id, data, or both:
conveyor.identify('user-123');conveyor.identify('user-123', { plan: 'pro' });conveyor.identify({ plan: 'pro' });The id is whatever you provide. Only use values you are allowed to store.
Umami compatibility
The script accepts Umami’s data-website-id snippet and its other data attributes listed above. It
also exposes umami.track() and umami.identify() as aliases, and understands
data-umami-event and data-umami-event-* attributes. The request format matches Umami’s, so an
existing setup can point at a Conveyor instance without code changes.
What is collected
For each pageview or event the tracker sends the website id, hostname, URL path, page title, referrer, screen size and browser language, plus the event name and properties if there are any. The server derives browser, OS, device class and location from the request and discards the IP address and raw user agent. The tracker sets no cookies. See Privacy for the full list.
Opting out and bots
The script does nothing in automated browsers (navigator.webdriver). A visitor can opt out by
running localStorage.setItem('conveyor.disabled', '1') in their browser. Requests from known
bots and crawlers are dropped by the server.
Requests are sent with fetch as text/plain with keepalive, so no CORS preflight is needed.