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.
Endpoint
POST https://revlytics.co/api/event
Request
Send a JSON body with the event data:
curl -X POST https://revlytics.co/api/event \
-H "Content-Type: application/json" \
-d '{
"type": "pageview",
"site_id": "YOUR_SITE_ID",
"session_id": "unique-session-id",
"url": "https://example.com/pricing",
"path": "/pricing",
"hostname": "example.com",
"title": "Pricing - Example",
"referrer": "https://google.com",
"timestamp": "2025-01-15T10:30:00Z",
"screen": {
"width": 1920,
"height": 1080,
"viewport_width": 1440,
"viewport_height": 900,
"pixel_ratio": 2
},
"language": "en-US",
"user_agent": "Mozilla/5.0..."
}'
Event types
| Type | Description |
|---|
pageview | Page load or SPA navigation |
pageleave | User leaves a page (includes duration) |
custom_event | Custom event (includes event_name and properties) |
web_vitals | Performance metrics (includes vitals object) |
external_link | Click on an external link |
error | JavaScript error |
payment | Payment completion |
identify | User identification |
button_click | Button click |
form_submit | Form submission |
copy | Text copied to clipboard |
Required fields
| Field | Type | Description |
|---|
type | string | Event type (see above) |
site_id | string | Your site identifier |
session_id | string | Unique session identifier |
Optional fields
| Field | Type | Description |
|---|
visitor_id | string | Persistent visitor identifier |
user_id | string | Your app’s user identifier |
timestamp | string | ISO 8601 timestamp |
url | string | Full page URL |
path | string | URL path |
hostname | string | Domain name |
title | string | Page title |
referrer | string | Referring URL |
language | string | Browser language |
user_agent | string | Browser user agent |
screen | object | Screen dimensions |
utm | object | UTM parameters (source, medium, campaign, term, content) |
ad_click_ids | object | Ad click IDs (gclid, fbclid, msclkid, etc.) |
duration | number | Time on page in ms (for pageleave) |
event_name | string | Custom event name (for custom_event) |
properties | object | Custom event properties |
vitals | object | Web Vitals (lcp, fid, cls, fcp, ttfb) |
error_name | string | Error type name |
error_message | string | Error message |
error_stack | string | Stack trace (max 2KB) |
provider | string | Payment provider name |
Response
Success
Status code: 202 Accepted
Error
{ "error": "Missing required fields: site_id, type, session_id" }
Status code: 400 Bad Request or 500 Internal Server Error
Server-side tracking
You can send events from your backend (e.g., for server-side rendered pages or API events):
await fetch("https://revlytics.co/api/event", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
type: "custom_event",
site_id: "YOUR_SITE_ID",
session_id: "server-" + Date.now(),
event_name: "api_signup",
properties: { source: "api" },
timestamp: new Date().toISOString(),
}),
});