← Back to Blog·Mar 16, 2026·9 min read
Verticals

Web Analytics for Developers: API-First, Privacy-First

Developers don't want dashboards they have to click through. They want APIs they can query, scripts that don't slow down their sites, and analytics that respect user privacy without consent banners. Here's how to get there.

Developer-focused web analytics with API integrations and code editor

What Developers Actually Want from Analytics

Most analytics tools were built for marketers. They assume you want funnels, heatmaps, session recordings, and A/B testing dashboards. For developers, the requirements are fundamentally different. You want data you can programmatically access, scripts that don't degrade page performance, and privacy guarantees that mean you never have to think about consent banners.

Traditional analytics

Built for<strong>marketers and product managers</strong>. Dashboards you click through, funnels you configure in a GUI, vendor onboarding calls, and heavy scripts that block the main thread.

Developer-first analytics

Built for<strong>engineers who live in terminals</strong>. REST APIs you can<code>curl</code>, sub-5 KB scripts, no cookies, and data you can pipe into your own toolchain.

After surveying hundreds of developer-focused teams, the same requirements come up again and again:

Well-documented REST API

Query pageviews, referrers, top pages, and custom events programmatically. If you can't<code>curl</code>it, it doesn't exist.

Lightweight tracking script

Under 5 KB, ideally under 1 KB. No blocking the main thread, no layout shifts, no third-party cookie jars.

No cookies required

Cookie-free analytics means no consent banners, no GDPR pop-ups, and no legal review before deploying a script tag.

Self-hosting option

Many teams want analytics running on their own infrastructure, behind their own firewall, with full data ownership.

npm or script-tag install

Two lines of code to get started. No vendor onboarding calls, no sales demos, no “schedule a meeting” CTAs.

Data export

CSV, JSON, or API-based export so you can pipe analytics into your own data warehouse, Grafana, or Jupyter notebooks.

The tools that meet these criteria are a small subset of the analytics market. Let's walk through the four best options for developer teams.

Copper Analytics: Built for Developers from Day One

Copper Analyticswas designed with developer ergonomics as a first-class concern. The tracking script is a single async tag, the REST API covers every metric visible in the dashboard, and the entire platform works without cookies or personal data collection.

<4 KB

Script size

Full

REST API

Zero

Cookies

Free

Permanent tier

Full REST API

Query pageviews, visitors, referrers, top pages, devices, browsers, and countries. Filter by date range, path, or referrer domain.

AI crawler tracking

See which bots (GPTBot, ClaudeBot, Perplexity, Bytespider) are crawling your site, how frequently, and which pages they target.

Core Web Vitals

LCP, CLS, INP, FCP, and TTFB tracked automatically — no separate performance monitoring tool needed.

Data export

Export any time range as CSV or JSON via the API. Connect to your own data pipelines. See thedata export feature page.

Lightweight script

Under 4 KB, async-loaded, no cookies, no personal data, no layout shift.

Free tier

Not a trial — a permanent free plan for smaller sites and side projects.

Developer Tip

Copper Analytics's API uses standard Bearer token authentication. Generate an API key from your dashboard settings and start querying within minutes. No OAuth flows, no webhook registration — just a token and a<code>GET</code>request.

Plausible Analytics: Open Source with a Stats API

Plausibleis the go-to open-source privacy analytics tool. Its tracking script is under 1 KB — the smallest in the industry — and the Stats API lets you pull aggregate data for any metric and time range. The self-hosted option (via Docker) gives you complete data ownership.

<1 KB

Script size

AGPL

License

Docker

Self-host

$9

Cloud from/mo

Stats API

Query timeseries, aggregate, and breakdown endpoints for visitors, pageviews, bounce rate, visit duration, sources, pages, and more.

Sites API

Programmatically create, update, and delete sites — useful for agencies or SaaS platforms managing many domains.

Self-hosting

AGPL-licensed, Docker-based deployment. Full data sovereignty on your own infrastructure.

Custom events

Track button clicks, form submissions, or any user action with theplausible()JavaScript function.

Plausible's main limitation for developers is the lack of user-level or session-level data — everything is aggregate. If you need individual user tracking (for product analytics), you'll need a different tool.

Umami: Self-Hosted Analytics with a Modern Stack

Umamiis a fully open-source analytics tool built with Next.js and PostgreSQL (or MySQL). It appeals to developers who want a modern tech stack they can understand, fork, and extend. Umami offers both a cloud-hosted service and a self-hosted option with one-click deployment to Vercel, Railway, or Docker.

~2 KB

Script size

MIT

License

Next.js

Tech stack

1-Click

Deploy

REST API

Comprehensive endpoints for websites, sessions, events, pageviews, and metrics. Token-based authentication.

Modern stack

Built on Next.js, Prisma, and PostgreSQL. Easy to contribute to or customize if you fork the repo.

One-click deploy

Deploy to Vercel, Railway, DigitalOcean, or Docker Compose in minutes.

Event tracking

Track custom events with theumami.track()function, including event properties for segmentation.

Umami's weakness is scale. Self-hosting with PostgreSQL requires careful tuning at high traffic volumes, and the cloud offering is relatively new compared to Plausible's managed service.

PostHog: Full Product Analytics for Engineering Teams

PostHogis the heavy hitter. It goes far beyond web analytics into product analytics, feature flags, session recordings, A/B testing, and surveys — all self-hostable. If your team needs to understand not just traffic but in-product user behavior, PostHog is the most developer-friendly option in that category.

60–90 KB

Script size

MIT

License

11+

SDKs

HogQL

Query lang

Comprehensive API

Query events, persons, insights, feature flags, and experiments programmatically. HogQL for ad hoc SQL-like analysis.

Self-hosting

Deploy with Docker or Kubernetes on your own infrastructure. Open source under MIT license.

SDKs everywhere

Official SDKs for JavaScript, React, React Native, Node.js, Python, Go, Ruby, PHP, Android, iOS, and Flutter.

Feature flags

Roll out features to a percentage of users and measure impact without a separate feature-flag service.

The tradeoff: PostHog's tracking script is significantly larger (around 60–90 KB depending on features loaded), and the self-hosted deployment is complex (Kubernetes recommended for production). It also uses cookies by default, though cookieless mode is available.

When to Choose PostHog

If you need<strong>product analytics</strong>(funnels, retention, cohorts, user paths) alongside web analytics, PostHog is the only open-source tool that covers both. For pure web analytics, it's overkill.

Bring External Site Data Into Copper

Pull roadmaps, blog metadata, and operational signals into one dashboard without asking every team to learn a new workflow.

Installation: npm, Script Tag, or Both

Developers expect two installation paths: a script tag for static sites and an npm package for frameworks like Next.js, Nuxt, Remix, or SvelteKit. Here is how each tool handles installation.

Every tool on this list supports a single script tag in your HTML . For most sites, this is the fastest path to working analytics:

For React-based frameworks, you can load the script dynamically or use an official package. Here is a Next.js example using the Copper Next.js integration:

Plausible, Umami, and PostHog all follow a similar pattern. PostHog offers a dedicatedposthog-jsnpm package with React hooks for feature flags and event tracking. Umami provides@umami/trackerfor framework integration.

Code Examples: Fetching Analytics Data via API

The real power of API-first analytics is programmatic access. Below are practical examples for fetching data from each tool's API.

Fetch your site's top pages for the last 7 days:

Query aggregate visitor stats for a specific date range:

Retrieve website metrics from a self-hosted Umami instance:

Run a HogQL query to get pageview counts grouped by path:

Headless Analytics: No Dashboard Needed

A growing pattern among developer teams isheadless analytics— deploying a tracking script and consuming data exclusively through the API, without ever opening the vendor's dashboard. This approach treats analytics like any other data source: something you query, transform, and display in your own tools.

Slack bot integration

A cron job queries the analytics API every morning and posts a summary (visitors, top pages, top referrers) to your team's Slack channel.

CI/CD gating

After deploying a new feature, query the API to check if error page views spike or if a specific conversion event drops below a threshold.

Custom dashboards

Build a Grafana panel, a React dashboard, or a CLI tool that pulls data from the analytics API and displays exactly what your team needs.

Weekly email reports

A serverless function queries the API, renders an HTML email template, and sends it to stakeholders via SendGrid or Resend.

Data warehouse sync

Pipe raw analytics data into BigQuery, ClickHouse, or a Postgres table for cross-referencing with product or revenue data.

The key requirement for headless analytics is a comprehensive, well-documented API. All four tools covered in this guide support this pattern, butCopper Analyticsand Plausible offer the simplest API surface for pure web analytics use cases.

Pro Tip

If you adopt the headless approach, you still get the dashboard as a backup. The point is that the API is the<em>primary</em>interface, not the dashboard. This inversion is what makes analytics fit naturally into an engineering workflow.

Developer Tool Comparison

Here is how all four tools stack up on the criteria developers care about most:

FeatureCopperPlausibleUmamiPostHog
REST APIFullStats + SitesFullFull + HogQL
Script Size<4 KB<1 KB~2 KB60–90 KB
CookiesNoneNoneNoneDefault on (opt-out)
Self-HostableNo (cloud)Yes (Docker)Yes (Docker/Vercel)Yes (Docker/K8s)
Open SourceNoAGPLMITMIT
Free TierYes (permanent)Self-host onlySelf-host or cloud free tierYes (generous limits)
AI Crawler TrackingBuilt-inNoNoNo
Web VitalsBuilt-inNoNoYes (via web-vitals)
Data ExportCSV + JSON APICSV + APIAPIAPI + warehouse sync
Product AnalyticsNoNoNoYes (full suite)

Which Tool Should You Choose?

The right analytics tool for your dev team depends on the scope of what you need to track and how much infrastructure you want to manage.

ChooseCopper Analytics

Fastest path to working analytics with a full API, AI crawler visibility, Web Vitals, and data export — all without managing infrastructure. The free tier makes it zero-risk for side projects and startups.

Choose Plausible

Open source and self-hosting are non-negotiable. The sub-1 KB script is the smallest available, and the Stats API covers the most common web analytics queries.

Choose Umami

Self-host on a modern stack (Next.js + PostgreSQL) and deploy analytics alongside your app on Vercel or Railway.

Choose PostHog

You need product analytics alongside web analytics — funnels, retention, feature flags, and session recordings in one platform. Accept the larger script size as the cost of a full-featured product suite.

For most developer teams building websites, blogs, documentation sites, or SaaS marketing pages, a lightweight web analytics tool (Copper Analytics, Plausible, or Umami) is the right fit. PostHog enters the picture when you cross the line from “I want to know my traffic” to “I want to understand in-product user behavior.”

For a deeper look at setting up Copper in a Next.js project, read our Next.js analytics setup guide. To explore data export options, visit the data export feature page.

The Developer Test

If you can install the tracking script, query the API, and get useful data into your terminal in under 5 minutes, the tool passes. If it requires a sales call, an onboarding wizard, or a 20-page docs deep-dive, keep looking.

Ready to Try the API?

Copper Analytics's REST API is available on all plans, including the free tier. Get your API key and start querying in under 2 minutes.

What to Do Next

The right stack depends on how much visibility, workflow control, and reporting depth you need. If you want a simpler way to centralize site reporting and operational data, compare plans on the pricing page and start with a free Copper Analytics account.

You can also keep exploring related guides from the Copper Analytics blog to compare tools, setup patterns, and reporting workflows before making a decision.