Developer Documentation
Build on VeritaMetrics
Everything you need to integrate privacy-first analytics into your application. Track custom events, consume webhooks, query the REST API, and deploy self-hosted.
Tracking API
The client-side tracking API is available on any page that includes the VeritaMetrics snippet. Pageviews are tracked automatically — use the API to track custom events, revenue, and goals.
Custom Events
Track any user action with a name and optional metadata. Events appear in your dashboard within seconds.
Revenue Tracking
Attach order IDs, amounts, and currency to attribute revenue to traffic sources and campaigns.
No-Code Goals
Add data-verita-event-name="Signup" to any HTML element. Clicks are tracked automatically — no JavaScript required.
// Track a custom event
window.verita("trackEvent", {
name: "form_submit",
props: {
formId: "contact",
source: "homepage"
}
}); // Track a purchase with revenue
window.verita("trackEvent", {
name: "purchase",
revenue: {
amount: 49.99,
currency: "USD",
orderId: "ORD-1234"
}
}); <!-- No JavaScript needed -->
<button data-verita-event-name="Signup">
Create Account
</button> import crypto from "crypto";
function verifySignature(
payload: string,
signature: string,
secret: string
): boolean {
const expected = crypto
.createHmac("sha256", secret)
.update(payload)
.digest("hex");
return crypto.timingSafeEqual(
Buffer.from(signature),
Buffer.from(expected)
);
}
// In your handler:
const sig = req.headers["x-verita-signature"];
const isValid = verifySignature(
req.body, sig, WEBHOOK_SECRET
); Retry Policy
Failed deliveries are retried up to 3 times with exponential backoff (1s, 4s, 16s). Every attempt is logged with full request/response details in the delivery log.
Webhook API
Receive real-time events from VeritaMetrics via HTTP POST. Every payload is signed with HMAC-SHA256 using your endpoint's secret so you can verify authenticity.
Signature Verification
Each request includes an X-Verita-Signature header. Compute the HMAC-SHA256 hex digest of the raw request body using your secret and
compare.
Event Types
-
alert.triggered— anomaly or threshold alert fired -
goal.completed— a tracked goal was achieved -
report.ready— a scheduled export is available -
test— manual test delivery from settings
REST API
Query your analytics data programmatically. All endpoints return JSON and require authentication via API key.
| Method | Endpoint |
|---|---|
| GET | /api/sites/:id/stats |
| GET | /api/sites/:id/events |
| GET | /api/sites/:id/funnels |
| POST | /api/sites/:id/webhooks |
| GET | /api/sites/:id/alert-rules |
| POST | /api/sites/:id/export |
Framework Guides
Deep integration guides for popular frameworks. Each guide covers installation, route tracking, custom events, and platform-specific features.
Next.js
App Router client component with automatic route change tracking.
- App Router compatible
- Automatic SPA navigation
- Server-side pixel fallback
Astro
Native component with View Transitions support across MPA and SPA modes.
- View Transitions support
- Island architecture
- Zero client JS option
React
React component with React Router integration and custom event hooks.
- React Router integration
- Automatic route tracking
- Custom event hooks
WordPress
Add via functions.php or a code-snippets plugin. WooCommerce revenue support.
- Server-side pixel
- WooCommerce revenue
- No plugin dependency
Shopify
Liquid snippet in theme.liquid. Tracks product views, carts, and purchases.
- Revenue tracking
- Checkout funnel
- Product page analytics
Flutter
Dart NavigatorObserver for Flutter web apps with automatic route tracking.
- Navigator observer
- Automatic routes
- Web platform support
Self-Hosting
For teams that need maximum control over their data. Deploy VeritaMetrics on your own infrastructure with our self-hosting package.
Full Data Sovereignty
All analytics data stays on your servers. Nothing leaves your network.
Docker Deployment
Ship as a Docker container with PostgreSQL. One command to deploy.
Same Feature Set
Every feature available in the cloud version, running on your infrastructure.
Premium Support
Available for premium plan customers needing specific compliance or security setups.
Data Model
Understanding how VeritaMetrics processes and stores your analytics data — and what gets pseudonymized.
Visits
Each pageview or event hit creates a visit record. Visits are attributed to a pseudonymous daily visitor hash — unique within a 24-hour window, not across days.
Events
Custom events carry a name and optional properties (key-value metadata). Revenue events additionally store amount, currency, and order ID.
Funnels
Define multi-step conversion funnels from pageviews or events. The engine computes step-by-step conversion rates, drop-off points, and overall completion.
Pseudonymization
IP addresses are used momentarily for geo-lookup and generating a daily salted hash, then immediately discarded. No raw IPs are ever stored.
Retention
Configure per-site retention periods. Raw visit data is automatically purged after expiry; aggregated reports are preserved for long-term trend analysis.
Aggregation
Daily and hourly aggregates power the dashboard. These include visitor counts, pageview totals, bounce rates, engagement metrics, and geographic breakdowns.
Start Building With VeritaMetrics
Sign up for free and get your site ID and tracking snippet in under a minute.