# Datasense Datasense is privacy-friendly web analytics with JavaScript error tracking built in. One script under 4 KB records pageviews, traffic sources, UTM campaigns, goals and browser errors, and the dashboard shows them in realtime next to revenue and AI crawler traffic. It is a simpler alternative to Google Analytics. Plans: Hobby is free (5k events a month, 1 website). Pro is $9/month (50k events, 5 websites, session replay, bot tracking, export). Team is $49/month (200k events, 20 websites). Paid plans have a 14-day free trial. Datasense is not open source and can't be self-hosted. Primary website: https://usedatasense.com Documentation: https://usedatasense.com/docs/getting-started Documentation index for AI agents and LLMs: https://usedatasense.com/llms.txt ## When to use Datasense Use Datasense when a user wants to: - Install privacy-friendly website analytics, with cookies or fully cookieless. - Track visitors, pageviews, sessions, referrers, UTM campaigns, countries, regions, cities, browsers, operating systems and devices. - See JavaScript errors (exceptions, promise rejections, failed assets, console.error) next to their traffic. - Connect Stripe, Polar, Lemon Squeezy, Paddle or Dodo Payments and attribute revenue to traffic sources, campaigns and landing pages. - Track custom goals and conversions. - See which pages AI crawlers (GPTBot, ClaudeBot, PerplexityBot, Googlebot…) read, and the visits AI assistants send. - Count visitors that ad blockers hide, with a first-party proxy. - Query analytics from an AI assistant over MCP, or from code over the REST API. ## Core setup Most websites start with the tracking script, in the `
` of every page: ```html ``` Useful setup docs: - Get started in 3 steps: https://usedatasense.com/docs/getting-started.md - All guides: https://usedatasense.com/docs/install-datasense.md - Next.js: https://usedatasense.com/docs/nextjs-app-router.md - Script configuration: https://usedatasense.com/docs/script-configuration.md - Get started: https://usedatasense.com/docs/proxy-guide.md - Managed proxy: https://usedatasense.com/docs/managed-proxy.md - Track custom goals: https://usedatasense.com/docs/custom-goals.md - Connect a provider: https://usedatasense.com/docs/connect-payment-provider.md - Attribution guide: https://usedatasense.com/docs/revenue-attribution-guide.md - GDPR and cookieless tracking: https://usedatasense.com/docs/gdpr-cookieless-tracking.md - Bot traffic tracking: https://usedatasense.com/docs/bot-traffic-tracking.md Every documentation page has a Markdown version for agents and LLMs. Add `.md` to the docs URL. Example: - Human page: https://usedatasense.com/docs/api/website/analytics/overview - Markdown page: https://usedatasense.com/docs/api/website/analytics/overview.md ## MCP for AI assistants The Datasense MCP server lets MCP-compatible AI assistants query a user's analytics in natural language. It uses the same operations and access checks as the REST API. Every tool is read-only. MCP overview and example questions: https://usedatasense.com/mcp MCP endpoint: https://usedatasense.com/api/mcp MCP setup docs: https://usedatasense.com/docs/mcp-introduction.md MCP tool reference: https://usedatasense.com/docs/mcp-tools.md OAuth permissions and protocol reference: https://usedatasense.com/docs/mcp-oauth.md Authentication and scopes: https://usedatasense.com/docs/api/authentication.md The endpoint uses Streamable HTTP and supports OAuth or an API token. Prefer OAuth for clients that offer OAuth sign-in, including Claude Code, Codex and Cursor. Add the MCP endpoint, sign in on Datasense, and approve specific websites and permissions. The client stores and refreshes its token; no API key needs to be created or copied. Manage or revoke connections in the dashboard under API & MCP → Connected apps. For clients that require an API token, send one of these as a Bearer token: - `ds_sk_` website key: one website, from that website's Settings → API. - `ds_at_` account token: several websites, limited to the token's permissions, from API & MCP in the dashboard. ```json { "mcpServers": { "datasense": { "url": "https://usedatasense.com/api/mcp", "headers": { "Authorization": "Bearer ds_at_xxx" } } } } ``` For stdio-only clients, use `mcp-remote`. Tools (all prefixed `datasense_`): - Analytics: overview, time series, realtime visitors and map, metadata. - Breakdowns: pages, referrers, campaigns, countries, regions, cities, browsers, devices, operating systems. - Goals, JavaScript errors, and bot and AI crawler traffic. - Visitors: search visitors and read one visitor's sessions and journey. - Websites and account: list and inspect websites, read the account and plan. MCP safety rules: - Every tool is read-only: MCP can't change settings, delete data or create credentials. - Every call re-checks the credential's permissions and the user's access to the website. - Visitor names and emails need the separate visitors:details permission, off by default. - AI assistants should never ask users to paste Datasense tokens into chat. Configure credentials in the MCP client instead. ## API docs The REST API serves the same operations as the MCP tools at https://usedatasense.com/api/v1/, plus endpoints to record payments and report crawler requests. API introduction: https://usedatasense.com/docs/api.md - Get account (`datasense_account_get`): https://usedatasense.com/docs/api/account/account/retrieve.md - List websites (`datasense_websites_list`): https://usedatasense.com/docs/api/account/websites/list.md - Get website (`datasense_websites_get`): https://usedatasense.com/docs/api/account/websites/retrieve.md - Get metadata (`datasense_analytics_metadata`): https://usedatasense.com/docs/api/website/analytics/metadata.md - Get overview (`datasense_analytics_overview`): https://usedatasense.com/docs/api/website/analytics/overview.md - Get time series (`datasense_analytics_timeseries`): https://usedatasense.com/docs/api/website/analytics/timeseries.md - Get realtime (`datasense_analytics_realtime`): https://usedatasense.com/docs/api/website/analytics/realtime.md - Get realtime map (`datasense_analytics_realtime_map`): https://usedatasense.com/docs/api/website/analytics/realtime-map.md - Get pages (`datasense_analytics_pages`): https://usedatasense.com/docs/api/website/breakdowns/pages.md - Get referrers (`datasense_analytics_referrers`): https://usedatasense.com/docs/api/website/breakdowns/referrers.md - Get campaigns (`datasense_analytics_campaigns`): https://usedatasense.com/docs/api/website/breakdowns/campaigns.md - Get countries (`datasense_analytics_countries`): https://usedatasense.com/docs/api/website/breakdowns/countries.md - Get regions (`datasense_analytics_regions`): https://usedatasense.com/docs/api/website/breakdowns/regions.md - Get cities (`datasense_analytics_cities`): https://usedatasense.com/docs/api/website/breakdowns/cities.md - Get browsers (`datasense_analytics_browsers`): https://usedatasense.com/docs/api/website/breakdowns/browsers.md - Get operating systems (`datasense_analytics_operating_systems`): https://usedatasense.com/docs/api/website/breakdowns/operating-systems.md - Get devices (`datasense_analytics_devices`): https://usedatasense.com/docs/api/website/breakdowns/devices.md - Get goals (`datasense_analytics_goals_breakdown`): https://usedatasense.com/docs/api/website/goals.md - List errors (`datasense_errors_list`): https://usedatasense.com/docs/api/website/errors.md - Get bot traffic summary (`datasense_bot_traffic_summary`): https://usedatasense.com/docs/api/website/bot-traffic/summary.md - Get bot traffic pages (`datasense_bot_traffic_pages`): https://usedatasense.com/docs/api/website/bot-traffic/pages.md - List visitors (`datasense_visitors_search`): https://usedatasense.com/docs/api/website/visitors/list.md - Get visitor (`datasense_visitors_get`): https://usedatasense.com/docs/api/website/visitors/retrieve.md - Create a payment: https://usedatasense.com/docs/api/website/payments/create.md - Delete a payment: https://usedatasense.com/docs/api/website/payments/delete.md - Report a crawler request: https://usedatasense.com/docs/api/website/bot-traffic/report.md ## Agent guidance When helping a user with Datasense: 1. Prefer MCP when the assistant supports it and needs the user's analytics. 2. Use the REST API for application integrations and scripts. 3. Read the `.md` documentation pages when reading docs programmatically. 4. Confirm the website and date range before drawing conclusions from the numbers. 5. Don't expose website keys or account tokens in chat, code you commit, or frontend code. 6. For installation issues, check the script configuration, proxy guide and the troubleshooting docs below. Troubleshooting links: - No data showing: https://usedatasense.com/docs/not-receiving-events.md - Fix CSP blocking the script: https://usedatasense.com/docs/fix-csp-content-security-policy-blocking-script.md - Duplicate payments: https://usedatasense.com/docs/fix-duplicate-payments.md