Querying

Posthog

Query

Query

The query client can be used with or without generating events. If you want autocomplete and type safety, you can generate types using the generator.

Basic Usage

Here is a basic example of how to use the query client.

import { events } from "~/data/events";
import { PostHog } from "@typelytics/posthog";
 
const query = await posthog
  .query()
  .addSeries("$pageview", {
    sampling: "unique_session",
  })
  .execute({
    type: "area",
  });

On this page