Skip to main content

capture

Function capture 

Source
pub async fn capture(
    distinct_id: impl Into<String>,
    event: impl Into<String>,
    properties: Value,
)
Expand description

Fire-and-forget event capture. Sends event with properties attributed to distinct_id to PostHog. The HTTP send happens in a background task; this function returns immediately and analytics failures never affect the caller.

When no API key is configured (no ambient client), this is a clean no-op.

§Example

capture("user_42", "purchase", serde_json::json!({ "amount_cents": 999 })).await;