Appearance
Tracking events
js
vectelle.track(name, properties)Vectelle only records the events you send. There's no automatic capture of clicks or form input, so you decide exactly what's collected.
Names
Event names must be lower_snake_case: start with a letter, then letters, digits and underscores, up to 64 characters.
| Good | Rejected |
|---|---|
item_viewed | Item Viewed |
search_performed | search-performed |
video_progress | 2fa_enabled |
Name events as object + past-tense verb (item_viewed, cart_updated), and use the recommended events where one fits. Consistent names let reports and recommendations work without configuration.
An invalid name is dropped in the browser. With debug mode on, the console tells you why.
Properties
Properties are a JSON object describing the event:
js
vectelle.track('add_to_cart', {
item_id: 'sku_123',
price: 19.99,
currency: 'USD',
quantity: 2,
})Limits per event:
| Limit | Value |
|---|---|
| Serialized size | 8 KB |
| Keys | 100 |
| Nesting depth | 3 levels |
Events over a limit are rejected by the server. Values JSON can't represent, such as functions, are left out. An object that can't be serialized at all, such as one with a circular reference, drops the event.
Always send item_id for anything a user can view, watch or buy, and item_type if your site has more than one kind of item.
Properties on every event
Use register() for values that should be attached to every event that follows, such as the variant of an experiment the visitor is in:
js
vectelle.register({ 'exp.checkout_v2': 'B', plan: 'pro' })
vectelle.unregister('plan')Registered properties are saved on the device and kept across page loads until unregister() or reset(). Values must be strings, numbers, booleans or null, with up to 50 keys. Anything else makes the server reject every event in the batch, so keep registered values flat.
What's added automatically
Every event carries context you don't need to send yourself:
- Page: URL, path, title and referrer
- Campaign:
utm_source,utm_medium,utm_campaign,utm_termandutm_contentfrom the URL - Device: screen size, browser language and time zone
- Identity: an anonymous visitor id, your user id after
identify(), and a session id. A session ends after 30 minutes without activity. - On the server: the time received, browser and operating system, a bot flag, and the country if available. The IP address is used for this and then discarded. It's never stored.
When events are sent
Events are queued and sent in batches: when 20 are waiting, or 5 seconds after the first, whichever comes first. You can change both with the flushAt and flushIntervalMs options. When the page is hidden or closed, what's left is handed to the browser's sendBeacon, which finishes sending after the page is gone.
If a send fails because of the network or a server error, the SDK keeps the events (up to 1,000, saved on the device) and retries with increasing delays. Every event has a unique id, so an event that's accidentally sent twice is stored once.
To send immediately, for example before navigating away in code:
js
await vectelle.flush()Don't send personal data
Don't put emails, names, phone numbers, addresses, card or bank details, passwords, tokens, or health, religion, sexuality or political data in event names or properties.
The server scrubs common patterns such as emails and card numbers as a safety net. It's not a reason to send them.