Observability

PostHog analytics

PostHog is an open-source product analytics platform. Track compression metrics as events to understand usage patterns and cost savings.

By Arjun Shah - Creator of SuperCompress - Updated 2026-07-03

PostHog integration

from posthog import PostHog
from supercompress import Compressor

ph = PostHog(api_key="...")
comp = Compressor()

def compress_and_track(context, query, user_id):
    result = comp.compress(context, query)
    ph.capture(user_id, "prompt_compressed", {
        "original_tokens": result.original_tokens,
        "kept_tokens": result.kept_tokens,
        "savings_pct": round(
            (1 - result.kept_tokens / max(result.original_tokens, 1)) * 100, 1
        )
    })
    return result

Frequently asked questions

Can I build a dashboard for compression savings?

Yes. PostHog's insight builder can aggregate token savings by user, day, or use case.

Does PostHog handle high-volume events?

Yes. PostHog is designed for high-volume event ingestion.

Try it yourself

Paste your long prompt into the playground, ask a question, and see what SuperCompress keeps and removes. Free, no signup needed.

Open the Playground Embed the badge