Playground API
DocsStatsBlogStudio
Documentation Tree
Technical BlogFeature Deep Dives
  • Introduction
  • Quickstart
    5 min
  • How It Works
  • Recipes & Cookbooks
  • Platform Comparisons
  • Real-World Showcase
  • Interactive Studio
    Studio
  • GraphiQL IDE
    IDE
  • Session Quotas & Activity
  • Network Chaos Simulator
  • Atomic Sandbox Reset
  • Overview & Models
    Hub
  • Users Resource
  • Posts Resource
  • Comments Resource
  • Todos Resource
  • Custom Collections
    Custom
  • Multipart File Uploads
    Upload
  • Dynamic SVG Avatars
    SVG
  • Image Thumbnails
    CDN
  • Relational Filtering
  • Full-Text Search
  • Dynamic Sorting
  • Offset Pagination
  • Cursor Pagination
    Scroll
  • CSV & Excel Export & Import
    IO
  • Custom Collections
    CRUD
  • Overview & Architecture
    Hub
  • JWT Auth Flow
  • Refresh Token Rotation
    Mutex
  • RBAC Permission Matrix
    Roles
  • Expiry Simulation
  • Clock Skew Drift
  • Password Recovery Loop
  • Dual-Mode Sandboxing
  • GraphiQL IDE
    IDE
  • Relational Queries
  • Stateful Mutations
  • Realtime Subscriptions
  • Overview & Flowcharts
    Hub
  • Hosted Checkout
    Stripe
  • Payment Intents API
  • 3DS Challenge Modal
    Modal
  • Customers Vault
  • Charges & Refunds
  • Test Cards Catalog
  • Overview & Channels
    Hub
  • Virtual Email Mailbox
    Mailtrap
  • Virtual SMS Terminal
    Phone
  • In-App Notifications
  • Message Dispatcher
  • Realtime Studio
    Studio
  • Native WebSocket (/ws)
  • Socket.io Gateway
  • Presence & Echo Bot
  • Server-Sent Events (SSE)
    SSE
  • Analytics Telemetry
  • Webhook Subscriptions
  • HMAC SHA-256 Signatures
  • Delivery Logs
  • Manual Retry Simulator
  • Network Latency Delay
  • HTTP Status Codes
  • Rate-Limit Simulator
    429
  • Flaky Network & Jitter
    Chaos
  • Session Quotas & Activity
  • JSON Snapshots
    JSON
  • Headless CI/CD Testing
    CI
  • Mobile QR Code Sync
  • System Metrics & Health
  • Atomic Sandbox Reset
  • Official TypeScript SDK
  • Multi-Language Generators
  • DevTools Extension
  • OpenAPI 3.1 Spec
    JSON
  • Postman Collection v2.1
  • Bruno Collection
  • Insomnia Workspace
  • TypeScript .d.ts
    .d.ts
  • AI Prompt Rules
    Rules
  • Context Index (llms.txt)
  • Full Schema (llms-full.txt)
  • Manifest (product.json)
  • All Feature Articles
    Blog
  • React CRUD Without Backend
    Deep Dive
  • Why Static APIs Fail
  • Mocking Stateful Auth
  • WebSockets & SSE Guide
Technical Blog
Articles

In-depth articles explaining stateful mock APIs, WebSockets, payments, and frontend resilience.

Read Articles
PreviousServer-Sent Events (SSE)
NextWebhook Subscriptions
Realtime & WebSockets

Analytics & Telemetry Ingestion

Track pageviews, button clicks, user conversion funnels, and performance beacons. Ingest events singly or in batches, and query aggregated session summaries in real time without external analytics vendor tracking.

Interactive Telemetry Workbench

Select a telemetry scenario below to send live tracking beacons or inspect aggregated session metrics:

Track Pageview Beacon

Ingests a single pageview event with route path, referrer, and user device properties.

POST
response.json
1
{
2
// Click "Send" above to execute this request against the live server.
3
}

Telemetry Event Payload Schema

The /analytics/track endpoint accepts structured JSON beacons:

FieldTypeRequiredDescription
eventstringYesUnique event identifier (e.g. pageview, checkout_completed).
propertiesobjectOptionalArbitrary key-value metadata dictionary (route path, currency, user agent).
timestampstring (ISO-8601)OptionalClient-side event capture time (defaults to server receipt time if omitted).

Client Integration Code

Production patterns for guaranteed unload delivery and batching:

1
// Browser Telemetry with navigator.sendBeacon (Guaranteed On-Unload)
2
export function trackBeacon(eventName: string, properties: Record<string, any> = {}) {
3
const url = 'https://playground.nileslabs.com/api/v1/analytics/track';
4
const payload = JSON.stringify({
5
event: eventName,
6
properties,
7
timestamp: new Date().toISOString(),
8
});
9
10
if (typeof navigator !== 'undefined' && navigator.sendBeacon) {
11
const blob = new Blob([payload], { type: 'application/json' });
12
navigator.sendBeacon(url, blob);
13
} else {
14
fetch(url, {
15
method: 'POST',
16
headers: { 'Content-Type': 'application/json' },
17
body: payload,
18
keepalive: true,
19
}).catch(() => {});
20
}
21
}