Skip to content
kymoDocs
Reference

beat.js

beat.js is the client tracker. It is roughly 3KB, sets no cookies, and reads no storage except a single owner opt-out flag.

Script attributes

Set on the <script> tag, read via document.currentScript.

FieldTypeRequiredDescription

Because beat.js reads document.currentScript, it must be a parser-inserted tag. Do not load it through a bundler-injected loader like next/script, which leaves currentScript null.

window.kymo

After load, window.kymo is a function for custom goals.

FieldTypeRequiredDescription
window.kymo('signup');
window.kymo('purchase', { revenue: 49 });

If the owner opt-out is active, window.kymo is still defined but is a no-op, so your calls never error.

The beacon payload

Each event is a text/plain POST to /api/beat via navigator.sendBeacon (falling back to fetch with keepalive). The body is JSON:

FieldTypeRequiredDescription

The payload carries no cookie and no identifier you set. See /api/beat for what the server does with it.

Automatic behavior

  • Pageviews fire on load and on every history.pushState and popstate, de-duplicated on identical path plus query.
  • Outbound clicks — a click on a link to a different hostname sends an outbound event.
  • Auto-goalstel:, mailto:, WhatsApp links, and form submits fire goals with no configuration.

Opt-out and local development

  • ?kymo=ignore sets a per-browser localStorage flag that stops sending; ?kymo=track clears it.
  • On localhost, 127.*, and 192.168.*, beat.js does nothing.