Skip to content

Add action-based survey targeting #394

@adboio

Description

@adboio

🚨 IMPORTANT

This issue is likely user-facing in the main PostHog app, see surveyVersionRequirements.ts. If you delete or close this issue, be sure to update the version requirements list here.

Summary

The posthog-android SDK does not support action-based survey targeting.

Current State

  • The Survey model may have the actions field in its conditions, but there is no logic to match captured events against configured actions
  • Event-based targeting exists, but action-based targeting is missing from getActiveMatchingSurveys()

Expected Behavior

When a survey is configured with action-based targeting (survey.conditions.actions.values), the Android SDK should:

  1. Match captured events against the configured actions (which are defined server-side as combinations of event name + property filters)
  2. Only show the survey when a matching action is triggered

Reference Implementation

See posthog-js browser: packages/browser/src/extensions/surveys/ActionMatcher.ts
For mobile-specific patterns, see posthog-react-native: packages/react-native/src/surveys/getActiveMatchingSurveys.ts (once implemented there)

The browser SDK uses an ActionMatcher class to match captured events against configured actions.

Tracking

This is tracked in the survey SDK feature parity issue: PostHog/posthog#45658

This issue was generated by Claude using the /survey-sdk-audit skill.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions