Skip to main content

reflex-privatus

Real visitor numbers for your Reflex app. No cookies, no cookie pop-up, no bots.

You want to know if people use your Reflex app. But Google Analytics uses cookies, so in many countries you must show a cookie pop-up first (the box that asks visitors to say yes to cookies). Many people click no, so they never show up in your numbers. Bots add fake visits on top.

This package adds the Privatus Analytics script to your Reflex app with one line, and gives you a track() helper for button clicks and sales. The script sets no cookies and keeps no IP addresses. Bots are filtered out before they are counted.

So you see how many real people came, which pages they looked at and where they came from, on one simple dashboard. A report comes to your inbox each week, and you can set alerts for when traffic jumps or drops. And you don't need a cookie pop-up for your analytics.

Free plan, no card: 10,000 events a month (an event is a page view or an action you track) on up to 3 sites. Start free at privatusanalytics.com.

  • No cookies. No cookies and no hidden IDs on your visitors' devices, and no IP addresses are kept. Laws differ by country, so check your own legal advice.
  • Real people, not bots. Known bots, data centers and spam visits are left out on every plan.
  • Small and fast. The script is about 3 KB when compressed.

Requirements

  • Python 3.10 or later.
  • Reflex 0.9.12 or later.
  • A Privatus Analytics site id (it starts with pa_). You find it under Site settings, Tracking.

Install

pip install reflex-privatus

Add the script

Put privatus_analytics() in your app's head components. It loads once, on every page.

import reflex as rx
from reflex_privatus import privatus_analytics

app = rx.App(
    head_components=[
        privatus_analytics("pa_YOURSITEID", modules=["engage", "auto", "vitals", "clicks", "ask"]),
    ],
)

This adds the same tag you would paste by hand:

<script defer src="https://privatusstats.com/js/pa.js" data-site="pa_YOURSITEID" data-modules="engage,auto,vitals,clicks,ask"></script>

Reflex changes pages without a full reload. The script follows those changes by itself, so every page view is counted.

You can leave out the site id and set it with an environment variable instead:

export PRIVATUS_SITE_ID=pa_YOURSITEID

When no site id is set, nothing is added and a warning is logged.

Settings

Argument What it does
site_id Your site id. Falls back to PRIVATUS_SITE_ID.
modules Extra features: engage (time on page and scroll), auto (outbound links, downloads, form sends), vitals (Core Web Vitals), clicks (heatmaps), ask (short on-site surveys). Leave it out to get just engage.
excluded_paths Pages never counted, like ["/admin/*"].
domains Hostnames to count. Leave it out to count every host.
spa How page changes are followed: auto (default), history, hash or off.
manual True turns off the automatic page view.
enabled False leaves the script out, for example in tests.
script_host Only needed if you serve pa.js yourself. Falls back to PRIVATUS_SCRIPT_HOST.
extra_attributes Any other data-* setting from the tracker docs.

Visits from localhost are not counted, so local testing does not mix with real numbers.

Track events

Use track() as an event trigger:

from reflex_privatus import track

rx.button("Sign up", on_click=track("Signup", {"plan": "pro"}))

Record money with revenue and currency:

rx.button("Buy", on_click=track("Purchase", {"plan": "pro"}, revenue=49, currency="USD"))

Or return it from an event handler, after your own code runs:

class State(rx.State):
    @rx.event
    def join(self):
        # ...save the sign-up
        return track("Newsletter signup")

Events run in the visitor's browser, never on your server. Calls made before the script loads are queued, so none are lost. Create a goal for the event name in your dashboard to see how often it happens and where those visitors came from.

Never put names, emails or other personal data in event details.

Try the demo

pip install -e ".[test]"
cd demo
reflex run

Develop

pip install -e ".[dev]"
pytest
ruff check . && ruff format --check .

Privacy

The tracker sets no cookies and uses no device ids. This package only loads it. See the privacy documentation for what is collected.

If you have a privacy policy, it should say which tools handle your visitors' data. You can paste this:

This website uses Privatus Analytics to count visits. It does not use cookies and does not follow you from one website to another. Your IP address is used for a moment to count visits and is never stored.

License

MIT

Metadata

Release files for reflex-privatus 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for reflex-privatus 0.1.0
File Size Uploaded Provenance
reflex_privatus-0.1.0.tar.gz 8.1 kB With provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for reflex-privatus 0.1.0
File Interpreter ABI Platform
reflex_privatus-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.7 kB

Release files / reflex_privatus-0.1.0.tar.gz

Download URL reflex_privatus-0.1.0.tar.gz
Size 8.1 kB
Tags Source
SHA-256 checksum
How to use checksums
77c5cfac1fbd8781350472b4347bf5d881d842e9d9ed51f14747264640587169
BLAKE2b-256 checksum
How to use checksums
3e9881a08e291c30bc66f0ac4f6c6806e7c18489a972fd4fe54440d803c4a86a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Release files / reflex_privatus-0.1.0-py3-none-any.whl

Download URL reflex_privatus-0.1.0-py3-none-any.whl
Size 7.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
cb660919242891f3fb3fe12b6908587e21bd5622265d967ce14c20b065a3c27e
BLAKE2b-256 checksum
How to use checksums
9f5a15f1e4711e3331050782457ffc96fd80db23659000609c1daae9b41719ee
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

Security for reflex-privatus 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for reflex_privatus-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 28, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files Full provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page