
PostHog Capture
CertifiedCapture a PostHog event
PostHog Capture
Capture a PostHog event
Sends a custom analytics event for a distinctId, with optional properties and timestamp. Uses the project API key (phc_).
type: io.kestra.plugin.posthog.CaptureExamples
Capture a custom event when a pipeline completes
id: pipeline_completed_event
namespace: company.analytics
inputs:
- id: user_id
type: STRING
- id: pipeline_name
type: STRING
tasks:
- id: capture_completion
type: io.kestra.plugin.posthog.Capture
apiKey: "{{ secret('POSTHOG_API_KEY') }}"
host: "https://us.i.posthog.com"
distinctId: "{{ inputs.user_id }}"
event: pipeline_completed
properties:
pipeline_name: "{{ inputs.pipeline_name }}"
kestra_execution_id: "{{ execution.id }}"
environment: production
Properties
apiKey *string
PostHog project API key
The project API key (starts with phc_). Use a Kestra secret, e.g. {{ secret('POSTHOG_API_KEY') }}.
distinctId *string
Distinct ID
The distinct ID of the user performing the event.
event *string
Event name
The name of the event to capture, e.g. pipeline_completed.
assets
Assets this task consumes as inputs or produces as outputs, for lineage tracking and the asset graph (Enterprise Edition). A flow declaring this property on a task is rejected in the open-source edition.
io.kestra.core.models.assets.AssetsDeclaration
IGNOREFAILWARNAsset failure behavior
Behavior applied to the task state when a declared asset fails to render, emit, or be persisted (e.g. a lock conflict): FAIL escalates it to FAILED, WARN (default) warns it if it would otherwise succeed, IGNORE leaves the state untouched.
Whether to auto-register assets referenced dynamically at runtime that are not statically declared in inputs or outputs.
The assets consumed as inputs.
io.kestra.core.models.assets.AssetIdentifier
1The assets produced as outputs.
io.kestra.plugin.ee.assets.Dataset
1150{}1150io.kestra.plugin.ee.assets.File
1150{}1150io.kestra.plugin.ee.assets.Table
1150{}1150io.kestra.plugin.ee.assets.VM
1150{}1150io.kestra.core.models.assets.External
1150{}1150io.kestra.core.models.assets.Custom
11501Custom asset type
{}1150host string
PostHog host
The PostHog ingestion host, e.g. https://us.i.posthog.com (US Cloud), https://eu.i.posthog.com (EU Cloud) or a self-hosted URL. Defaults to US Cloud when empty.
properties object
Event properties
Optional properties to attach to the event.
timestamp string
Event timestamp
Optional time at which the event happened, as an ISO-8601 instant (e.g. 2026-01-01T00: 00: 00Z). Defaults to the time the event is captured.