MainSDK
Search⌘K
Integrations

Plausible

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

1 interface1 driverWritten guide
Updated 2026-10-28

Plausible is a lightweight, privacy-focused web analytics tool. Behind 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.

Interfaces it serves

Pick Plausible in main.yaml for any of these. Your calls stay the same, and you can swap later.

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

main.yaml
analytics:
  driver: plausible
  # [to be decided] site domain, and an API key as secret:PLAUSIBLE_API_KEY if one is needed

Consent signals come from privacy, so the same consent rules apply whichever analytics driver you use.

Use it

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 not decided yet.

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 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

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 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

Open questions

Was this page helpful?

↑↓ moveEnter openEsc close

Not decided yet