# Analytics & tracking

> Configure provider-level Google Analytics 4, Microsoft Clarity and PostHog tracking, including consent behavior and measurement checks.

Canonical: https://komashi.com/docs/provider/Settings/13analytics/
Language: en

Open **Control Center → Integration → Analytics** to connect visitor measurement for the selected provider. The page supports **Google Analytics**, **Microsoft Clarity** and **PostHog**.

Video (English narration): [Analytics and tracking](https://www.youtube.com/watch?v=eSbEa4IUHvo)

[![Analytics & Tracking page with Google Analytics, Microsoft Clarity and PostHog](https://komashi.com/docs/assets/images/integrations-analytics.png)](/assets/images/integrations-analytics.png)

These settings connect your own analytics projects. View reports in the corresponding analytics service; this page stores the integration configuration. The Control Center's business dashboard and outgoing webhooks serve different purposes.

## Google Analytics 4

1. Open the intended GA4 property's web data stream and find its **Measurement ID**.
2. In Komashi, click **Edit tracking** next to **Google Analytics**.
3. Enter the **Google Analytics ID**, in the `G-XXXXXXXXXX` format.
4. Click **Save changes**.

Use the Measurement ID, not a property number or Google Tag Manager container ID. The field accepts up to 12 characters. To disable this provider's GA integration, clear the value and save.

## Microsoft Clarity

1. Find the **Project ID** for your Clarity project.
2. Click **Edit tracking** next to **Microsoft Clarity**.
3. Enter the **Microsoft Clarity Project ID**.
4. Click **Save changes**.

Enter the ID itself, not the complete embed script or a dashboard URL. The field accepts up to 10 characters. Clear the value and save to disable this provider's Clarity integration.

Clarity supplies its own visitor behavior and session-insight features. Data availability depends on the project configuration, visitor consent and whether the tracking script can load.

## PostHog

PostHog configuration requires both a **public project key** and an **ingestion host**. Use the values supplied for the same PostHog project and region.

1. Click **Edit tracking** next to **PostHog**.
2. Enter the **PostHog public project key**, beginning with `phc_`.
3. Enter the **PostHog host**, for example `https://eu.i.posthog.com` when that is your project's host.
4. Click **Save changes**.

The host must be an HTTPS origin, optionally with a port. Do not include an ingestion endpoint path, query string or dashboard URL. A personal API key is not the public project key expected here.

Both fields must be supplied together. To disable the integration, clear **both** and save. Saving PostHog settings requires a provider administrator.

### What Komashi sends to PostHog

The provider integration records page views for storefront, service, checkout and customer page categories. It includes the provider identifier and a normalized page category/path.

It does not enable automatic click capture, session recording, heatmaps or person profiles. Actual customer/checkout URLs, query parameters, referrers and page titles are not forwarded as-is; sensitive routes are replaced with generic page-category paths. This configuration is for page measurement, not an automatic full recording of every customer action.

## Consent and measurement

Saving an ID does not by itself mean every visit is measured. Provider tracking is initialized when the visitor has accepted the analytics-inclusive cookie preference. Choosing only necessary cookies prevents analytics initialization. Changing preferences updates the tracking consent state.

A tracking or ad blocker, an incorrect ID/host, or testing on the wrong provider can also explain missing events. Provider tracking is not a measurement of staff activity in the Control Center.

## Check the integration

1. Save the intended provider's values and reopen the page to check them.
2. Open a customer-facing storefront or service page for that provider.
3. Accept the analytics-inclusive cookie preference for your test visit.
4. Check the matching analytics project's realtime/debug or event view.
5. If nothing arrives, check the project and region, script/network blocking, and the visitor's consent state.

Do not use “Not set” as a connection test: it only means the setting has no saved value. Conversely, a visible ID means configuration is saved, not that the external analytics service has confirmed delivery.

| Symptom | Likely check |
| --- | --- |
| GA receives no visits | Correct GA4 Measurement ID, a customer-facing test page, consent and blocking extensions. |
| Clarity remains empty | Correct project ID and successful script loading after consent. |
| PostHog settings will not save | `phc_` public key, matching HTTPS origin, both fields supplied and administrator access. |
| PostHog has page views but no replay | Session recording is disabled in this provider integration. |
| Clearing PostHog fails | Clear both the public key and host together. |

Related: [Developer overview](https://komashi.com/docs/provider/Developers/who-is-a-developer/index.md), [webhooks](https://komashi.com/docs/provider/Settings/11webhooks/index.md), [Storefront rules](https://komashi.com/docs/provider/Settings/02provider-rules/index.md).
