Skip to main content

Analytics

Decide how self-hosted Cossistant should handle Tinybird-backed analytics and the optional DataFast script.

Start with the Self-Host overview if you want the broader architecture first. This page focuses on the analytics-specific decisions you need to make for a self-hosted deployment.

What Cossistant uses analytics for

Today, Cossistant uses Tinybird for:

  • inbox analytics
  • live visitor presence
  • live "last seen in app" enrichment in Tinybird-backed dashboard surfaces

Separately, the docs and marketing site include a DataFast script for hosted web analytics.

These are independent concerns:

  • Tinybird powers product analytics and live presence features inside the app
  • DataFast is a third-party site analytics script that can be disabled separately

Runtime switches

For self-hosting, all analytics-related toggles default to true:

.env
TINYBIRD_ENABLED=true
NEXT_PUBLIC_TINYBIRD_ENABLED=true
NEXT_PUBLIC_DATAFAST_ENABLED=true

The parsing is strict:

  • "true" enables the feature
  • any other value disables it

Tinybird enabled path

If you want inbox analytics and live visitor dashboards, keep Tinybird enabled and point the app at your Tinybird instance:

.env
TINYBIRD_ENABLED=true
NEXT_PUBLIC_TINYBIRD_ENABLED=true
TINYBIRD_HOST=https://your-tinybird.example.com
TINYBIRD_TOKEN=...
TINYBIRD_SIGNING_KEY=...
TINYBIRD_WORKSPACE=...

If you want to self-host or self-manage Tinybird itself, start with Tinybird's own guides:

Installing Tinybird alone is not enough. Deploy the Cossistant project files in tinybird/datasources, tinybird/pipes, and tinybird/endpoints; those names are what the API and dashboard query. From the repository's tinybird/ directory, validate the CLI context with tb info, then deploy the project with tb --cloud deploy (or your self-managed equivalent). The local workflow and expected endpoint list are documented in tinybird/README.md.

Verify that inbox_analytics, unique_visitors, online_now, visitor_presence, and presence_locations resolve before enabling the UI.

Tinybird disabled path

If Tinybird is hard to support in your environment, you can disable it cleanly:

.env
TINYBIRD_ENABLED=false
NEXT_PUBLIC_TINYBIRD_ENABLED=false

When Tinybird is disabled:

  • Tinybird ingestion stops on the API side
  • Tinybird JWT/token generation stops
  • inbox analytics UI is hidden
  • live visitors overlay, live presence counts, and Tinybird-backed live maps are hidden

What still works:

  • Postgres-backed visitor and user lastSeenAt timestamps continue updating
  • places in the app that already fall back to database lastSeenAt continue to show those timestamps
  • the rest of the product continues working without Tinybird

Keep TINYBIRD_ENABLED and NEXT_PUBLIC_TINYBIRD_ENABLED aligned. If only the server flag is disabled, the browser can render analytics surfaces that cannot receive tokens/data. If only the browser flag is disabled, the API may continue ingesting events that no dashboard surface displays.

What this does not do:

  • it does not recreate Tinybird analytics on Postgres
  • it does not keep the Tinybird-only dashboards visible with replacement data

DataFast

DataFast is treated as an optional third-party analytics dependency for hosted site analytics. The flag defaults on, so a self-hoster who does not explicitly choose this processor should disable it before the first page load.

To disable it for self-hosting:

.env
NEXT_PUBLIC_DATAFAST_ENABLED=false

When disabled, the root web layout simply omits the datafa.st script.

If you want the simplest self-host path first:

  1. Decide whether you truly need the Tinybird-backed analytics UI on day one.
  2. If not, set TINYBIRD_ENABLED=false and NEXT_PUBLIC_TINYBIRD_ENABLED=false.
  3. Disable NEXT_PUBLIC_DATAFAST_ENABLED unless you explicitly want that third-party script.
  4. Bring Tinybird back later only if you want the inbox analytics and live visitor dashboards.

After either configuration, test the API token endpoint and the dashboard with browser devtools open: enabled mode should return usable data from every named pipe; disabled mode should render no Tinybird/DataFast request or analytics UI.

Was this page helpful?

Open a prefilled documentation issue so the team can act on your feedback.