DEV Community

Alex Spinov
Alex Spinov

Posted on

Plausible Has a Free API: Privacy-Friendly Analytics Without Cookies

What is Plausible?

Plausible is a lightweight, open-source web analytics tool that respects user privacy. No cookies, no personal data collection, GDPR/CCPA compliant by default — and the script is under 1KB (vs Google Analytics at 45KB+).

Why Plausible Over Google Analytics?

  • No cookies — no cookie consent banners needed
  • GDPR compliant — by design, not by configuration
  • 1KB script — vs Google Analytics 45KB+ (faster page loads)
  • Clean dashboard — all metrics on one page
  • Open source — self-host for free or use cloud ($9/mo)
  • API access — export all your data programmatically

Quick Start

<!-- Add to your site's <head> — that's it! -->
<script defer data-domain="yourdomain.com" src="https://plausible.io/js/script.js"></script>
Enter fullscreen mode Exit fullscreen mode

Self-Host for Free

# docker-compose.yml
git clone https://github.com/plausible/community-edition plausible
cd plausible

# Configure
cp .env.example .env
# Edit .env: set BASE_URL, SECRET_KEY_BASE

docker compose up -d
# Dashboard at http://localhost:8000
Enter fullscreen mode Exit fullscreen mode

Plausible API

# Get realtime visitors
curl 'https://plausible.io/api/v1/stats/realtime/visitors?site_id=yourdomain.com' \
  -H 'Authorization: Bearer YOUR_API_KEY'

# Get aggregate stats
curl 'https://plausible.io/api/v1/stats/aggregate?site_id=yourdomain.com&period=30d&metrics=visitors,pageviews,bounce_rate,visit_duration' \
  -H 'Authorization: Bearer YOUR_API_KEY'

# Top pages
curl 'https://plausible.io/api/v1/stats/breakdown?site_id=yourdomain.com&period=7d&property=event:page&limit=10' \
  -H 'Authorization: Bearer YOUR_API_KEY'

# Traffic sources
curl 'https://plausible.io/api/v1/stats/breakdown?site_id=yourdomain.com&period=30d&property=visit:source' \
  -H 'Authorization: Bearer YOUR_API_KEY'
Enter fullscreen mode Exit fullscreen mode

Custom Events

// Track custom events
plausible('Signup', { props: { plan: 'pro', source: 'landing-page' } });
plausible('Purchase', { props: { product: 'premium', revenue: '49.99' } });
plausible('Download', { props: { file: 'whitepaper.pdf' } });
Enter fullscreen mode Exit fullscreen mode

Revenue Tracking

// Track revenue events
plausible('Purchase', {
  revenue: { currency: 'USD', amount: 49.99 }
});
// Dashboard shows total revenue, average order value
Enter fullscreen mode Exit fullscreen mode

Plausible vs Alternatives

Feature Plausible Google Analytics Umami Fathom
Script size <1KB 45KB+ 2KB 1KB
Cookies None Multiple None None
GDPR consent Not needed Required Not needed Not needed
Self-host Yes No Yes No
Price (cloud) $9/mo Free* $9/mo $14/mo
API Yes Complex Yes Yes
Open source Yes No Yes No
Dashboard Simple Complex Simple Simple

*Google Analytics is free but you pay with user data.

Real-World Impact

A blog removed Google Analytics and replaced it with Plausible. Results: cookie consent banner removed (cleaner UX), page load time dropped 0.3s (smaller script), and they could still see all the metrics that mattered — traffic, sources, top pages. Plus, 15% of visitors who previously rejected cookies were now tracked (because no cookies = no consent needed).


Implementing privacy-friendly analytics? I help teams set up ethical data tracking. Contact spinov001@gmail.com or explore my data tools on Apify.

Top comments (0)