PostHog / PostHog/posthog-android

Add action-based survey targeting

Open
#394 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement Survey
Dominant language
Kotlin
Stars
90
Forks
49
Avg merge
2d 5h
Merged PRs (30d)
61

Description

🚨 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: https://github.com/PostHog/posthog/issues/45658

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in getActiveMatchingSurveys() and inspect how the Survey model exposes conditions.actions. Compare the intended matching behavior with packages/browser/src/extensions/surveys/ActionMatcher.ts and the referenced React Native path. Done means captured events are matched against server-defined event names and property filters, and the survey appears only after a matching action.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, javascript, kotlin, react-native
Domain
analytics, mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.