---
title: "Plausible"
description: "Use Plausible for MainSDK product analytics - site setup, main.yaml, page views and custom events, consent, local testing and swapping."
section: "integrations"
canonical: "https://mainsdk.dev/docs/integrations/plausible"
updated: "2026-10-28"
---

# Plausible

> Use Plausible for MainSDK product analytics - site setup, main.yaml, page views and custom events, consent, local testing and swapping.

Canonical: https://mainsdk.dev/docs/integrations/plausible · Updated: 2026-10-28

Plausible is a lightweight, privacy-focused web analytics tool. Behind [`analytics`](https://mainsdk.dev/docs/interfaces/analytics), it receives your app's page views and custom events and shows them as aggregate traffic and goal reports. Pick Plausible when you want simple traffic numbers and conversion goals rather than per-user funnels, and when you want as little personal data as possible in your analytics.

> **Note:** `analytics` has no spec yet. The options on this page are provisional, taken from the catalog and the product requirements, and may change when the spec lands.

## Interfaces it serves

### Product analytics (`analytics`)

- Status: Building for 0.3 · ships as a beta API
- Driver: `plausible` (Plausible). later
- Docs: https://mainsdk.dev/docs/interfaces/analytics.md

```yaml
analytics:
  driver: plausible
```

Swap to another provider: `builtin`, `posthog`, `otel`.

## Before you start

1. **Create a Plausible account,** on Plausible's hosted service or a self-hosted Community Edition instance.
2. **Add your site** by its domain. Events are counted per site.
3. **Set up goals** for the custom events you want to report on, such as `checkout.started`. Plausible reports custom events once a matching goal exists.
4. **Create an API key** if the driver needs one for your setup, and store it in your secrets manager.

## Configure

```yaml title="main.yaml"
analytics:
  driver: plausible
  # [TBD] site domain, and an API key as secret:PLAUSIBLE_API_KEY if one is needed
```

Consent signals come from [`privacy`](https://mainsdk.dev/docs/interfaces/privacy), so the same consent rules apply whichever analytics driver you use.

## Use it

```ts title="app/checkout/actions.ts"
"use server";
import { analytics, auth } from "mainsdk";

export async function startCheckout(req: Request, plan: string) {
  const session = await auth.require(req);
  analytics.track("checkout.started", { plan }, { for: session.user });
}
```

Call `analytics.page()` on each route change in the browser to record page views. Plausible does not keep per-user profiles, so how the driver treats `analytics.identify()` is [TBD].

## Local development and testing

- **A separate site:** add a second site in Plausible for development and stage so test traffic stays out of production numbers.
- **Tests:** `createTestApp()` from `@mainsdk/testing` runs `analytics` on an in-memory fake, so tests send nothing to Plausible. `chaos.on("analytics", { outage: true })` simulates Plausible being unreachable.

## What MainSDK adds on top

- Nothing is sent without consent where it is required.
- Only pseudonymised user IDs leave your app.
- The same `track` and `page` calls work if you later move to another analytics tool.

See [Product analytics](https://mainsdk.dev/docs/interfaces/analytics) for the full contract.

## Limits and notes

- Planned driver from the product requirements; `analytics` has no spec yet.
- Plausible is built for aggregate web analytics, not user-level funnels or cohorts. If you need those, PostHog fits better.
- Keep personal data out of event properties.
- MainSDK regions are US, EU and India. Check where your Plausible instance stores data; self-hosting puts it where you run it.

## Swap to or from it

```yaml title="main.yaml"
analytics:
  driver: plausible   # was posthog
```

Your calls stay the same. Past events stay in the old tool; Plausible starts counting from the switch.

## FAQ

**Do I still need a consent banner with Plausible?** Use [`privacy`](https://mainsdk.dev/docs/interfaces/privacy) to record consent; MainSDK sends events only where the rules allow. Whether your market needs consent for your setup is a legal question for your team.

**Can I add Plausible's own script too?** You can, but events it sends skip MainSDK's consent and pseudonymisation. Track through `analytics` instead.

## Next

- [Product analytics](https://mainsdk.dev/docs/interfaces/analytics)
- [PostHog](https://mainsdk.dev/docs/integrations/posthog) and [Google Analytics](https://mainsdk.dev/docs/integrations/google-analytics)
- [Swap a driver](https://mainsdk.dev/docs/guides/swap-a-driver)
