Docs cipi.yml Web panel API MCP Guides Compare GitHub Telegram channel
  1. Home
  2. Guides
  3. Free, privacy-friendly website analytics with IndieStats
Operations

Free, privacy-friendly website analytics with IndieStats

Replace Google Analytics with IndieStats, a free self-hosted analytics app without cookies or third parties: install it as a Cipi app, add the snippet to your sites, track events and goals, and configure retention and privacy for GDPR, step by step.

By Updated 4 min read

Most websites send every visitor to Google Analytics, with cookies, a consent banner and data leaving the EU. IndieStats gives you the numbers that matter (visitors, pages, sources, campaigns, conversions) from your own server, without cookies or third parties. On Cipi it's one Laravel app.

Key ideas, in plain words#

TermMeaning
PageviewOne page opened by one visitor
Visitor IDA random identifier kept in the browser's localStorage, not a cookie
SnippetA one-line <script> you paste in your site's layout
EventSomething a visitor does that you want to count: signup, purchase
GoalAn event you follow over time, to measure conversions
RetentionHow long raw data is kept before it's deleted
Step 1 of 4Visitor opens a page

The browser loads the IndieStats snippet from your stats domain, asynchronously, so your page doesn't wait.

IndieStats dashboard with several sites, pageviews, unique visitors and live visitors
All your sites in one dashboard, with live visitors.

Before you start#

  • A server with Cipi (it can share a server with other apps, or live on the same one as your Boogle).
  • A subdomain such as stats.example.com pointing at it.
  • A GitHub account to fork IndieStats.

1. Create the app#

Fork github.com/andreapollastri/indiestats, then:

bash
ssh cipi@YOUR_SERVER
sudo cipi app create --user=stats --domain=stats.example.com \
    --repository=git@github.com:YOU/indiestats.git --branch=main --php=8.5

Add the deploy key to your fork, then:

bash
sudo cipi deploy stats
sudo cipi ssl install stats
sudo cipi app artisan stats db:seed --force

IndieStats needs PHP 8.4 or newer. Its built front-end assets are committed to the repository, so no Node build is needed on the server. The seeder creates admin@users.test / password: log in and change it right away.

IndieStats needsOn Cipi
The scheduler every minute (pruning, GeoIP updates)Already on
A queue worker (Excel exports)Created with the app
HTTPScipi ssl install (needed: an HTTP script on an HTTPS site is blocked)

2. Add your site#

Sites → New site: name, and the allowed domains (example.com, www.example.com). IndieStats shows the snippet to copy:

IndieStats site created with the embed code and instructions
Paste the snippet before the closing body tag of every page, or in the shared layout.

3. Paste the snippet#

In a Laravel app, put it in your main layout, before </body>, only in production:

blade
@production
<script async src="https://stats.example.com/i/YOUR-SITE-KEY.js"></script>
<noscript><img src="https://stats.example.com/collect/pixel.gif?k=YOUR-SITE-KEY&p=/" width="1" height="1" alt=""></noscript>
@endproduction

WordPress: paste it in the theme's footer (or a "header and footer scripts" plugin). Static sites: the shared layout. Deploy, open a page, and the visit appears in Real-time within seconds.

IndieStats real-time tab with active visitors and a live feed
Real-time: active visitors and the last pageviews as they happen.

4. Track events and goals#

js
indiestats.track('signup');
indiestats.track('purchase', { plan: 'pro', price: 29.99, currency: 'EUR' });

Up to 20 properties per event. On the site's Events tab, add a goal to follow an event over time (for example signup per day).

5. Make it as private as you can#

bash
sudo cipi app env stats --set=ANALYTICS_RETENTION_DAYS=180
sudo cipi app artisan stats config:cache
SettingWhy
Shorter retentionLess personal data kept (IPs are deleted with their pageviews)
Country only, or no GeoIPThe GeoIP and ASN databases are optional: skip them if you don't need location
Domain allowlist on every siteOnly your sites can send data
Privacy policySay what you measure, why, and for how long
Real visitor IPs behind CloudflareIndieStats reads CF-Connecting-IP; behind other proxies configure Laravel's trusted proxies

This guide isn't legal advice. Cookieless, first-party, self-hosted analytics with short retention is the privacy-friendliest setup, but whether you need consent depends on your jurisdiction. Ask your DPO.

What you'll see#

TabAnswers
SummaryHow many visitors, pageviews, time on page
ContentWhich pages, which on-site searches
TrafficWhere visitors come from
UTMWhich campaigns work
TechnologyDevices, browsers, systems
GeographyCountries and networks (optional databases)
EventsConversions and goals
IndieStats summary tab with charts of visitors and pageviews
One filter bar narrows every tab, chart and export.

Troubleshooting#

ProblemFix
No visits arriveThe site's domain isn't in the allowlist, or the snippet isn't on the page
Browser blocks the scriptMixed content: IndieStats must be on HTTPS (cipi ssl install stats)
Every visitor from one country/networkBehind a proxy without real IP: see Cloudflare guide
Excel export never finishesQueue worker not running: sudo cipi worker list stats
Old data not deletedScheduler off: sudo cipi schedule status stats
Ad blockers hide some visitsExpected for any analytics; a first-party subdomain helps

Questions

What is IndieStats?

A free, open-source (MIT) web analytics app by Andrea Pollastri, built with Laravel. One installation tracks many sites, with real-time data, filters, events, goals and Excel exports, and stores everything on your own server.

Does it use cookies?

No. Visitors get a random ID in the browser's localStorage and a per-tab ID in sessionStorage. No data goes to third parties.

Do I still need a consent banner?

It depends on your country and your setup, so check with your DPO or lawyer. EU rules on storing data on a visitor's device cover localStorage too, not only cookies, and some authorities exempt first-party audience measurement only under conditions (limited purpose, no cross-site tracking, short retention). IndieStats makes those conditions easy to meet; it can't decide for you.

Does it store IP addresses?

Yes, with each pageview, to look up country and network, and they're deleted with the pageview by the retention job (375 days by default). Shorten ANALYTICS_RETENTION_DAYS to keep less.

Can I track several sites?

Yes, as many as you like from one installation, each with its own snippet and domain allowlist.

Will it slow my site down?

The script loads async and sends small requests; there's a <noscript> pixel for visitors without JavaScript.

Can I see conversions?

Yes: send events with indiestats.track('signup') and turn them into goals on the site's Events tab.

Why host it myself instead of a privacy SaaS?

It's free, the data never leaves your servers, and you decide retention. A SaaS is simpler if you'd rather not run anything.

Try it on your own server

Free and open source. One command on a fresh Ubuntu 24.04 or 26.04 VPS.

wget -O - https://cipi.sh/setup.sh | bash
Read the quickstart