# Datarevly
> Privacy-first web analytics that shows which traffic sources, campaigns and pages bring in revenue. Cookie-free by default, with Stripe, Polar and Paddle revenue attribution, AI assistant and AI crawler tracking, and an MCP server for agents.
## Get started
- [Docs](https://datarevly.com/docs): installing the tracking script on any framework, custom events, revenue attribution, server-side events, the first-party proxy, AI traffic, and the API
- Tracking snippet:
- Custom events: window.datarevly("track", "Signup", { plan: "pro" })
- Signed-in users: window.datarevly("identify", userId)
## For agents (MCP)
- Hosted MCP server: https://datarevly.com/api/mcp (Streamable HTTP). Header: Authorization: Bearer
- Claude Code: claude mcp add --transport http datarevly https://datarevly.com/api/mcp --header "Authorization: Bearer "
- Tools: list_sites, get_stats (with previous-period comparison), explain_change, get_timeseries, get_top_pages, get_sources, get_breakdown, list_sessions, get_live_visitors, get_goals, get_revenue, get_mrr_history, get_ad_spend, get_ai_traffic, get_annotations, create_goal, create_funnel, delete_goal, add_ad_spend, create_annotation, delete_annotation
- Ranges: 30m, today, yesterday, week, 7d, 30d, 90d, or YYYY-MM-DD..YYYY-MM-DD
- Filters: page, referrer, country, browser, os, device_type, utm_source, utm_medium, utm_campaign, ai_assistant ("any" or a name such as ChatGPT)
## REST API
All endpoints take Authorization: Bearer , plus ?range= and the filters above.
- GET https://datarevly.com/api/v1/sites/{siteId}/stats: visitors, pageviews, bounce rate, duration, live visitors
- GET https://datarevly.com/api/v1/sites/{siteId}/top-pages: most viewed pages
- GET https://datarevly.com/api/v1/sites/{siteId}/revenue?model=last|first: revenue, MRR, churn, by source, campaign and landing page
- GET|POST https://datarevly.com/api/v1/sites/{siteId}/annotations: chart notes (launches, deploys); POST { "label", "date"? (YYYY-MM-DD or ISO) }. DELETE .../annotations/{id}
- POST https://datarevly.com/api/v1/events: server-side events, { "siteId", "events": [{ "name", "url", "userId" | ("ip" and "userAgent"), "props" }] }, up to 100 per call
- POST https://datarevly.com/api/crawl: report an AI crawler request, { "siteId": "", "path", "userAgent" }
## Packages
- @datarevly/node: server-side tracking (track, trackRequest), a first-party proxy (createProxy) and AI crawler reporting (trackAiCrawler)
- @datarevly/cli: datarevly stats|top-pages|revenue|annotations --site , datarevly annotate "