| Name | Type | ID | Data Handling |
|---|---|---|---|
| PostHog | Analytics | analytics-posthog | Client |
PostHog 🦔 records page visits and product analytics with the official. The adapter injects dedicated snippet into the document head while the page is rendering on the server, using the project API key and ingest host you provide.
Limited capabilities
Currently, the adapter is limited to track basic page views and product analytics. It doesn't support tracking errors, custom events or properties. Hence, this has a strong priority on our roadmap and will be delivered in the near future.
In your PostHog project settings, find the Project Token and copy the value. It starts with phc_. For cloud, the default ingest host is https://eu.i.posthog.com (EU). Then register the adapter under the analytics key in app.config.ts.
The adapter is an effect, so call it from script setup of a component that is part of the server render. app.vue runs once for the whole application, which is the usual place for a site-wide tag:
During that setup, the adapter pushes the PostHog snippet onto the server context, then including those scripts in the HTML response. When using multiple analytics adapters, call them from an array.
The project token is public client-side configuration, and DocLayer does not add API routes for this adapter. The snippet is part of the rendered page.
Configuration
Below you can find the list of available configuration options.
| Option | Required | Description |
|---|---|---|
token | Yes | PostHog project project token. |
apiHost | No | Ingest host: |
defaults | No | Snippet defaults version (default |
optOut | No | Opt out capturing by default (default |
personProfiles | No |
|
Use environment variable for token when you want different keys per deployment.
