Self-hosting

Self-hosted analytics on Cloudflare Workers, explained

Ownlytics team · · 6 min read

Self-hosted analytics on Cloudflare Workers means the whole app, the dashboard, the API and the tracking script, runs as a Worker in your own Cloudflare account, with a D1 database next to it. There is no VPS to patch and no container to keep alive. You own the account, so you own the data.

yourapp.comToday7d30d9 online
Visitors3,619+42.1%
Revenue$2,226+67.0%
Conversion0.41%+8.4%
Revenue/visitor$0.11+17.6%
1.4k7000
SourceVisitorsSalesRevenue
Xx.com6,2479$441
Ggoogle.com4,43314$686
@newsletter1,1307$343
Ynews.ycombinator.com2,0153$147
Cchatgpt.com1,4114$196
↗Direct · typed or bookmark1,2092$98

Fig.The dashboard served from your own Cloudflare Worker. Sample data, not a real site.

What actually gets installed?

"Self-hosted" usually brings to mind a rented Linux box, a Docker file and a Postgres instance you now have to back up. The Cloudflare version is much smaller. When you install Ownlytics, three things appear in your account:

That is the whole list. The installer is one command, npx ownlytics@latest, and it needs Node.js 22 or newer plus a Cloudflare account. It asks for your license key, opens a Cloudflare sign-in tab where you click Allow, creates the database, downloads the release and verifies its checksum, deploys, and waits until the dashboard answers. Our install docs walk through every step, and the whole thing takes about three minutes.

Why a Worker instead of a server?

A traditional server is a machine that sits there waiting. A Worker is code that Cloudflare runs when a request arrives. For analytics that fits well, because the workload is a stream of tiny requests: a pageview here, a goal there, a sale webhook once in a while.

The practical consequences for you:

What you do take on is an account relationship with Cloudflare and the limits that come with your plan. We cover that below, and in the companion post on what fits on the Cloudflare free plan.

Monthly tool
$1,080 / 3 yrs
Hosted from $9/mo
$324 / 3 yrs
Pay once
$49 once

Fig.Illustrative: a $30/month tool over 36 months against Ownlytics pricing. Check each vendor’s current price.

Where does your data live?

In your Cloudflare account, in your D1 database. Visitors, payments, settings and API keys do not pass through our servers. The install talks to us in only two ways: a license check when you install or update, and a once-a-day "is there a new version?" request. If our site were unreachable tomorrow, your dashboard would keep running. The license docs spell this out.

That matters for two reasons. First, there is no third party sitting between your visitors and your numbers. Second, you decide retention. In the dashboard settings you can keep raw traffic for 30, 90 or 180 days, one to three years, or forever. Payments and their attribution are never removed by retention. See data retention.

What do you still have to manage?

Less than a server, more than a hosted tool. Honestly:

  1. Updates. One command, npx ownlytics@latest update. Updates are free, and your data and settings stay put. Nobody does it for you, so put it on a calendar if you care.
  2. Your Cloudflare plan. The free plan has daily limits. If you pass them, requests fail until the next reset, and you lose tracking for the rest of that day.
  3. Your Cloudflare login. If you lose access to the account, you lose access to the dashboard. Treat that account like any other important login.
  4. Backups, if you want them. Think about whether you need an export routine for data you could not recreate.

The trade is simple: you give up a little convenience in exchange for owning the database and paying no monthly fee to the analytics vendor.

Example (made-up numbers for illustration)

Say you run a small product with three sites. Together they get 6,000 pageviews on a normal day. Each pageview is one Worker request, so that is roughly 6,000 requests, plus heartbeats from open tabs, plus a background job once a minute. Our docs give a rule of thumb of roughly 20,000 pageviews a day across all your websites on the free plan, so this would sit well inside it, though you should check Cloudflare's current limits before you rely on the numbers. If a launch pushes one day to ten times that, you would want to look at the paid plan beforehand rather than after.

When this setup is not a good fit

If you do not want any Cloudflare account, or you do not want to run a command in a terminal, self-hosting is the wrong tool. Ownlytics Hosted is the same app run by us, with nothing to install or update. Also, if your organization requires a vendor to sign a contract and carry the support burden, a self-install shifts that burden to you.

If you are still deciding between the two, read do you need your own analytics server. It argues the "no" side as hard as the "yes" side.

At a glance

QuestionAnswer
What runs the app?A Cloudflare Worker in your account
Where is the data?A D1 database in your account
Installnpx ownlytics@latest, about three minutes
NeedsNode.js 22+, a Cloudflare account (free plan is fine)
UpdatesOne command, free for life
Custom domainYes, a subdomain of a site on your Cloudflare account
Main ongoing taskWatch your Cloudflare plan limits

If you want the full picture of the self-hosted product, the self-hosted analytics on Cloudflare page covers what is included. To see the dashboard before you install anything, open the live demo.

FAQ

Do I need a server to self-host analytics on Cloudflare?

No. The app runs as a Worker with a D1 database in your Cloudflare account. There is no VPS, Docker or database server for you to maintain.

Is Cloudflare's free plan enough?

For many small sites, yes. Our docs say the free plan comfortably handles sites up to roughly 20,000 pageviews a day across all your websites. Cloudflare sets and changes its own limits, so check Cloudflare's current pricing page.

Who pays Cloudflare?

You do, directly. We do not bill for Cloudflare usage. If you stay on the free plan, there is nothing to pay them.

Can I move off it later?

Yes. You can uninstall from your account whenever you like, and removing it frees its license activation. Copy out anything you want to keep first.

See the live demo · View pricing

Keep reading