Skip to main content

Documentation Index

Fetch the complete documentation index at: https://revlytics.co/docs/llms.txt

Use this file to discover all available pages before exploring further.

JavaScript API

Use the revlytics.track() method to send custom events:
revlytics.track("event_name", { property: "value" });

Examples

// Track a signup
revlytics.track("signup", { method: "google" });

// Track a purchase
revlytics.track("purchase", { plan: "pro", value: 29, currency: "USD" });

// Track a feature usage
revlytics.track("feature_used", { feature: "dark_mode" });

// Track a search
revlytics.track("search", { query: "analytics dashboard" });

HTML attributes

Track events declaratively without writing JavaScript:
<button
  data-revlytics-event="signup_click"
  data-revlytics-prop-plan="pro"
  data-revlytics-prop-source="hero"
>
  Start Free Trial
</button>
The data-revlytics-event attribute specifies the event name. Additional properties are passed via data-revlytics-prop-* attributes.
The attribute tracker walks up the DOM tree to find the closest element with data-revlytics-event. This means you can place the attribute on a parent container.

Command queue

If you need to track events before the script loads, use the command queue:
<script>
  window.revlytics = window.revlytics || { q: [] };
  revlytics.q.push(["track", "early_event", { source: "inline" }]);
</script>
Events in the queue are processed as soon as the script loads.

Validation rules

RuleLimit
Event nameLowercased, max 50 characters
Properties per eventMax 20
Property value lengthMax 255 characters
XSS protection<>'"&, javascript:, on*=, data: URIs are stripped

Auto-tracked events

In addition to custom events, Revlytics automatically tracks:
  • Button clicks<button>, role="button", <input type="submit">
  • Form submissions<form> submit events with form metadata
  • Copy events — Text copied to clipboard (up to 500 chars)
  • External links — Clicks on links to other domains
  • JavaScript errors — Uncaught errors and unhandled rejections