Skip to content

Add capture per-event context options (distinctId, groups, timestamp) #445

Description

@marandaneto

Feature request

Add Flutter SDK support for the mobile capture spec's optional per-event context fields:

  • distinctId override
  • groups context
  • timestamp override

Why

The sdk-specs capture mobile variant includes optional per-event identity override, group context, and timestamp. These are useful for backfilled/offline/domain events where the event context differs from the SDK's current ambient user/session state.

Spec: https://github.com/PostHog/sdk-specs/blob/main/openspec/specs/capture/spec.md

Current Flutter behavior

Posthog().capture() currently only accepts:

  • eventName
  • properties
  • userProperties
  • userPropertiesSetOnce

The platform interface also has a TODO noting missing capture parameters:

  • posthog_flutter/lib/src/posthog.dart
  • posthog_flutter/lib/src/posthog_flutter_platform_interface.dart

Desired outcome

Expose and forward the missing optional context fields through the Dart API and platform bridges, preserving existing behavior for callers that do not provide them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions