Web Statistics for Reverse Proxy

Do you need web statistics for sites that are not editable? Your reverse proxy is the method for adding the code. It puts the StatJolt tracking code into every page on its way to the visitor. You don't touch the app at all.

Some apps have no method for adding a badge or tracking code. Bookorbit and Grimmory for hosting eBooks/audiobooks are good examples. If you use Caddy for reverse proxy, or Nginx, Apache or Traefik, this page gives you the config.

Make your config

  1. Sign up and copy your StatJolt code. Under a minute. No credit card.
  2. Paste your code into the field below. Type your domain under it.
  3. Choose where your badge goes. Pick the one you've already chosen in your StatJolt account. (On the Badge tab of your site settings.)
    • Floating, bottom right or Floating, bottom left: choose Floating.
    • Next to icon row or New row, centered: choose End of the sidebar or Bottom of the footer.
    • If you've subscribed and ticked the invisible mode, it doesn't matter which one you click.
  4. Open the tab of your proxy and copy the config.
Where should your badge go?

Web Statistics for Caddy

Do you use Caddy for reverse proxy? Caddy needs the replace-response plugin. It changes the page before Caddy sends it out.

  1. Build Caddy with the plugin:

    xcaddy build --with github.com/caddyserver/replace-response

    Do you run Caddy in Docker? Build your own image with this Dockerfile:

    FROM caddy:2-builder AS builder
    RUN xcaddy build --with github.com/caddyserver/replace-response
    
    FROM caddy:2
    COPY --from=builder /usr/bin/caddy /usr/bin/caddy
  2. Put this site block in your Caddyfile. Use your own port:

    example.com {
        replace {
            match {
                header Content-Type text/html*
            }
            </body> `<script async src="https://statjolt.com/measure/c.min.js" data-user="YOUR_ID"></script></body>`
        }
        reverse_proxy localhost:8080 {
            header_up Accept-Encoding identity
        }
    }
  3. Restart Caddy with the new build.

The plugin can't change a compressed page. The header_up line asks your app for an uncompressed page. The match block keeps the change on HTML pages only.

Analytics for not editable sites

Your app sits behind your reverse proxy. Every page goes through the proxy first. The proxy finds the closing </body> tag in the page and puts the StatJolt code right in front of it.

  • Works with any app: Bookorbit, Grimmory and any other self-hosted app with HTML pages.
  • One place to change: you edit only your proxy config.
  • Survives app updates: the app files stay as they are.

Check that it works

Open your app in a private window. You see the StatJolt badge on the page. Click a few pages. Refresh your StatJolt dashboard and see your first visitor without waiting for the data.

If you don't see the badge

Work through these steps in order.

1. Look for the code in the page. Open your app and press Ctrl+U to see the page source. Search for statjolt.

  • Not there? Your proxy didn't change the page. Check the line that asks for an uncompressed page. Then reload your proxy.
  • There? Go to the next step.

2. Check the Content-Security-Policy header. Some apps block scripts from other sites. Open the browser console with F12. Look for an error that names statjolt.com. If you see one, allow https://statjolt.com in script-src and connect-src. With End of the sidebar or Bottom of the footer, also allow 'unsafe-inline' in script-src.

3. Clear your caches. If your domain uses Cloudflare or another cache, clear it. Then open the page again in a private window.

What your dashboard looks like

Once you log in, everything is clickable. There are more tabs if you want to dig deeper. You can also click on a page to see which channels brought the most visitors there. Combine these with mobile, country or almost anything. You can easily delete any of these filters with simple close buttons on them.

yourwebsite.com Last 7 days
Unique Users 3,562 +8.2%
Pageviews 8,644 +11.4%
Sessions 4,691 +6.7%
Bounce Rate 39.8% -3.1%
Visit Duration 2:54 +19s
Conversions 139 +14.9%

Acquisition

NameVisitsShareChange
Google2,331+12.4%
direct1,140+4.1%
pinterest.com596+31.8%
facebook.com371-6.2%
bing.com169+2.9%
duckduckgo.com840.0%

Pages

NameVisitsShareChange
/2,732+9.7%
/recipes1,495+18.2%
/blog/starter-care1,167+6.4%
/blog/sourdough-starter1,020+44.1%
/recipes/bread787-2.3%
/recipes/pizza-dough545+7.8%

Everything you need, not just the basics

StatJolt covers the basics behind your reverse proxy: visitors, sources, pages and devices.

Plus! Included too:

  • User journeys: the path a visitor takes through your app.
  • Core Web Vitals: the same speed score Google uses to rank you. The difference is real measurement, not a simulation. It catches it if one of your pages slows down.
  • JS error tracking: catch broken code without a separate tool.
  • Funnels: free, not locked behind a paid plan.

Simple web analytics behind a reverse proxy

StatJolt is a simple web analytics tool for self-hosted apps. The statistics are cookieless. So you don't need a cookie banner, because there is no personal data. You still get every number.

FAQ for reverse proxy web statistics

How do I use StatJolt for sites that are not editable?

Use your reverse proxy. It adds the StatJolt code to every HTML page of the app. You don't touch the app itself.

Does it work with Bookorbit and Grimmory?

Yes. Both serve normal HTML pages, so your reverse proxy can add the code to them. The same goes for other apps for hosting eBooks/audiobooks.

I use Caddy for reverse proxy. Is there a method for adding the code that way?

Yes. Build Caddy with the replace-response plugin. Then copy the config from the Caddy tab above.

Where does my badge go?

A floating badge stays in its corner of the screen. With End of the sidebar the badge goes at the end of your page's <aside> element. With Bottom of the footer it goes at the end of your page's last <footer> element.

Does it count page changes inside the app?

Yes. Many apps change the page without a full reload. StatJolt counts these page views too.

Do I need a cookie banner?

No. StatJolt sets no cookies. It collects no personal data.

Does it slow my site down?

No. The script is small. It never blocks the page from loading.

Replace GA4 in 2 minutes

Just paste the code and see how much clearer it gets. No cookies, no consent tool. €0 until 11 April 2027 23:59:59, at any traffic level. Later, for small sites it still costs €0.

Get my free account