---
title: "Connect analytics"
description: "Configure the Payload analytics dashboard and verify visitor tracking separately."
requested_language: cs
language: en
translation_notice: "This page isn't translated yet"
url: https://docs.systhema.app/cs/guides/recipes/connecting-analytics
version: unreleased (main)
docs_index: https://docs.systhema.app/cs/llms.txt
---
> This page isn't translated yet. Showing English.


## Goal

Show the client analytics in Admin. The Systhema analytics dashboard reads a provider's API; it does not install that provider's visitor tracking script.

## 1. Choose the provider

The built-in providers are GA4, Plausible, Umami, Matomo and Fathom. Read [Analytics providers](https://docs.systhema.app/cs/payload/analytics/providers.md) for credentials and metric availability.

The Payload starter's `src/payload/analytics.ts` reads the environment and supplies a typed provider. For Plausible, configure:

```bash title=".env"
SYSTHEMA_ANALYTICS_PROVIDER=plausible
SYSTHEMA_ANALYTICS_SITE_ID=example.com
SYSTHEMA_ANALYTICS_API_KEY=replace-with-private-stats-api-key
```

Use the domain registered with the provider. Keep the API key server-side; it is not a `NEXT_PUBLIC_*` variable.

## 2. Forward the configuration

The starter already imports `analytics` and places it in `userSysthemaConfig`. In an older project, add a module like this and import its export there:

```ts title="src/payload/analytics.ts"
import type { SysthemaAnalyticsOptions } from '@systhemaui/payload'

export const analytics: SysthemaAnalyticsOptions | false =
  process.env.SYSTHEMA_ANALYTICS_API_KEY && process.env.SYSTHEMA_ANALYTICS_SITE_ID
    ? {
        provider: {
          source: 'plausible',
          apiKey: process.env.SYSTHEMA_ANALYTICS_API_KEY,
          siteId: process.env.SYSTHEMA_ANALYTICS_SITE_ID,
        },
      }
    : false
```

This module intentionally configures only Plausible. Preserve the starter's provider switch if the deployment must support several providers. A bare `analytics: true` cannot provide credentials.

## 3. Verify collection and consent separately

Follow the provider's current installation instructions for visitor tracking. Add only the tracking requested for the project and integrate its consent behavior with the site's banner.

Read [Cookie consent](https://docs.systhema.app/cs/guides/cookie-consent.md) and [Cookie scanner](https://docs.systhema.app/cs/guides/cookie-consent/scanner.md). Static scanning cannot see every cookie created by a script at runtime. Inspect a fresh session before and after consent, including relevant widget interactions.

Do not put private Stats API credentials in a visitor script. A dashboard API connection and a tracking script have different credential requirements.

## 4. Verify the dashboard

```bash
pnpm sync
systhema doctor
```

Restart the application after changing environment values. Sign in with an account allowed to view analytics. Choose a period that has data and compare the numbers with the provider dashboard. Unsupported metrics may be unavailable rather than zero.

## Check your work

- The selected provider and site identifier match the client property.
- No API secret appears in frontend code or public environment variables.
- Tracking fires under the intended consent conditions.
- Admin metrics correspond to the selected period and site.
- The client owns the provider account and recovery details.

See [Analytics dashboard](https://docs.systhema.app/cs/payload/analytics.md) and [Analytics reference](https://docs.systhema.app/cs/payload/analytics/reference.md).
