Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

1.2 KB
Raw Blame
from products.warehouse_sources.sources.sdk import frozen

DEFAULT_BASE_URL = "https://api.umami.is/v1"
PAGE_SIZE = 100
DAY_MS = 24 * 60 * 60 * 1000


@frozen
class UmamiEndpoint:
    path: str
    primary_keys: tuple[str, ...]
    partition_key: str = "createdAt"
    window_size_ms: int | None = None
    description: str = ""


# Date filters follow the public docs. Incremental sync needs confirmation against a live account.
ENDPOINTS: dict[str, UmamiEndpoint] = {
    "websites": UmamiEndpoint(
        path="websites",
        primary_keys=("id",),
        description="Websites available to the account, including team websites.",
    ),
    "sessions": UmamiEndpoint(
        path="websites/{website_id}/sessions",
        primary_keys=("websiteId", "id"),
        # Session counts depend on the requested range, so splitting it would overwrite partial totals.
        description="Visitor sessions and their activity counts across the available history.",
    ),
    "events": UmamiEndpoint(
        path="websites/{website_id}/events",
        primary_keys=("websiteId", "id"),
        window_size_ms=DAY_MS,
        description="Individual pageviews and custom events.",
    ),
}