TrimStats Documentation
Everything you need to install the lightweight tracker on any stack, instrument custom events and goals, understand privacy-first identity, and connect server-verified revenue webhooks.
Drop-in installation snippet
Paste inside your HTML <head> tag. SPAs, outbound links, downloads, and active visit time work automatically.
<script defer src="https://collect.trimstats.com/t.js" data-site="pk_live_your_key"></script>Start with a core guide
Install in 60 seconds
Add one deferred script under 2 KB gzipped and verify live traffic in DevTools and your dashboard.
Dual-mode identity & privacy
Stay strictly cookie-less by default or opt in to first-party IDs and identify() for cohorts and timelines.
Revenue attribution webhooks
Connect Stripe, Paddle, Polar, or custom HMAC webhooks to tie paying orders back to referrers and UTMs.
Funnels, cohorts & UI friction
Measure multi-step drop-off, weekly retention cohorts, rage clicks, dead clicks, and 90% scroll reach.
Browse by category
Structured guides organized from first install to production webhooks and HTTP reference.
Getting Started
3 guidesInstall the sub-2 KB tracker script, wire up your framework or CMS, and verify live events in minutes.
- Quickstart InstallationAdd TrimStats to any website in under 60 seconds with a single deferred script under 2 KB gzipped.
- Framework & CMS GuidesRecommended installation patterns for Next.js, React, Astro, Vue/Nuxt, WordPress, Shopify, Webflow, and Content Security Policy (CSP) headers.
- Verify & TroubleshootConfirm events are reaching ClickHouse and diagnose common setup issues like 403 domain blocks, ad blockers, or missing data attributes.
Tracking & Events
5 guidesConfigure script attributes, automatic SPA and download tracking, custom events, and traffic exclusions.
- Script ConfigurationComplete reference for every HTML data attribute supported by t.js, including first-party mode, UI friction, and custom proxy endpoints.
- Automatic TrackingWhat TrimStats captures automatically out of the box, plus how referrers, Direct traffic ("dark social"), and UTM campaign tags work.
- Custom Events & PropertiesLearn when to use custom events instead of pageviews, how to avoid event explosion with flat properties, and how to inspect property breakdowns.
- Exclusions, Domains & Bot FilteringExclude your own visits, restrict ingestion to approved hostnames, skip specific links, and see how TrimStats drops bots before billing.
- AI Crawler TrackingUnderstand the difference between AI crawlers and human AI referrals, track 39+ AI bots server-side, and capture exact #:~:text= cited passages.
Identity & Privacy
2 guidesUnderstand cookie-less daily hashes, opt-in first-party visitor IDs, user identification, and EU compliance.
- Dual-Mode Identity & User IdentificationChoose per site between zero-storage cookie-less analytics and persistent first-party visitor IDs, plus optional logged-in user identification.
- Privacy, GDPR & Data ResidencyDetails on EU infrastructure in Germany, zero IP storage, sub-processors, GDPR/ePrivacy posture, and automatic retention expiration.
Analytics & Behavior
5 guidesLearn how sessions, goals, multi-step funnels, cohorts, UI click friction, and anomaly alerts work.
- Core Metrics, Sessions & Live ViewLearn how visitors, sessions, bounce rate, and active dwell time work, plus how TrimStats calculates core KPIs and click-to-filter segments.
- Conversion GoalsLearn how conversion goals and conversion rate work, configure exact/wildcard paths or custom events, and monitor automatic conversion dips.
- Funnels & Retention CohortsLearn how multi-step conversion funnels and weekly retention cohorts work, how to spot your biggest drop-off leaks, and how TrimStats computes them in ClickHouse.
- UI Friction TrackingLearn what rage clicks, dead clicks, and deep scroll reach reveal about broken UX, and pinpoint exact offending CSS selectors with zero session-replay bloat.
- Anomaly Insights, Slack, Discord & WebhooksHow TrimStats detects traffic drops, spikes, conversion dips, and friction surges against rolling 7-day baselines and delivers alerts and digests to email, Slack, Discord, and HMAC-signed webhooks.
Revenue Attribution
5 guidesConnect Stripe, Paddle, Polar, or custom payment webhooks to attribute revenue to channels and landing pages.
- Revenue Attribution OverviewConnect payment provider webhooks directly to TrimStats to attribute one-time orders, subscriptions, renewals, and refunds to referrers, UTM campaigns, and landing pages.
- Stripe Revenue WebhookStep-by-step guide to forwarding Stripe checkout sessions, subscription invoices, and refunds to TrimStats with HMAC verification.
- Paddle Revenue WebhookConnect Paddle Billing webhooks and custom_data attribution to track SaaS subscriptions and one-time payments in TrimStats.
- Polar Revenue WebhookAttribute Polar.sh orders, subscription renewals, and refunds using Standard Webhooks signature verification.
- Custom HMAC WebhooksSend revenue events from any payment processor, e-commerce store, or internal billing service using a simple HMAC-SHA256 signed JSON webhook.
Reference & Billing
5 guidesFull JavaScript tracker API, beacon collector HTTP specification, plan event quotas, and data retention windows.
- JavaScript Tracker API ReferenceComplete client-side reference for window.trimstats commands, attribution snapshots, command queueing, and browser storage keys.
- Collector Beacon API ReferenceHTTP specification for POST /v1/collect, payload validation rules, rate/quota responses, and server-side event ingestion.
- Public Stats REST API & API KeysAuthenticate with workspace or single-site Bearer API keys to query overview KPIs, live visitors, revenue, funnels, cohorts, UI friction, insights, and AI traffic from the collector.
- MCP Server (Local Stdio & Remote HTTP)Connect Claude Desktop, Claude Code, Cursor, Codex, or any MCP client to your TrimStats analytics via npx @trimstats/mcp (stdio) or the hosted Streamable HTTP endpoint at /mcp.
- Plans, Event Quotas & Data RetentionCompare Starter, Growth, and Scale limits, see which events count toward monthly quotas, and learn how the 20% spike grace buffer works.
Common implementation questions
Quick answers on installation verification, Content Security Policy headers, and billing webhooks.
How fast can I install and verify the TrimStats tracker script?
Does the TrimStats tracker work with strict Content Security Policy (CSP) headers?
Which server-side payment webhooks are documented for revenue attribution?
Need help with a custom setup or webhook?
Reach out if you are setting up a first-party reverse proxy, strict CSP policy, or custom billing integration.