Black Friday: Sumly for life, one payment from $79 · until 1 Declifetime from $79 →

Move an Android app from PostHog to Sumly

Swap posthog-android for one Kotlin file with no dependencies, call by call, keep both for a week to compare, then bring PostHog's history over. Screens and events stay under the user id RevenueCat knows, so each Google Play purchase shows the screens and the source before it.

Not yet run in a real app. Sumly.kt builds and follows the same rules as the React Native file, which runs in our own apps, but it has not run in a shipped app yet, and the PostHog history import has been tested against PostHog's documented API, not yet against a real PostHog project. Try both in a test build first, and tell us if anything is off.

Moved in five steps

  1. 1

    In Sumly, open Visitors and copy your project's public key (sl_…). Download https://sumly.dev/sdk/Sumly.kt into your app module. Leave posthog-android in for now.

  2. 2

    In Application.onCreate, next to PostHogAndroid.setup(this, config), call Sumly.init(this, siteKey = "sl_…"). Wherever the app calls PostHog.identify, capture, screen or reset, add the Sumly call from the table below, with the same user id.

  3. 3

    PostHog names each Activity by its label by itself; Sumly does not. With Navigation Compose, call Sumly.screen in a NavController listener; with Activities or Fragments, in onResume, with the names your PostHog insights already use.

  4. 4

    Ship that build and leave both running for a week. Compare the numbers in the list below; small gaps are expected, a large one means a call is missing.

  5. 5

    In Sumly, Tracking › Import earlier history › PostHog brings PostHog's months before Sumly. Its feature flags move too: make each one in Visitors › Flags with the same key and rollout (Sumly buckets people the same way, so the same people stay in), then swap the calls from the table. Then remove the posthog-android dependency and its calls.

Call by call

PostHogAndroid.setup(this, PostHogAndroidConfig(apiKey = "phc_…", host = …)) Sumly.init(this, siteKey = "sl_…") The public key from Visitors, in Application.onCreate. No host to choose; endpoint = only for your own domain.
PostHog.capture(event = "trial_started", properties = mapOf(…)) Sumly.track("trial_started", mapOf(…)) Text, numbers and true or false; a few properties, not a whole object.
PostHog.screen(screenTitle = "Paywall") Sumly.screen("Paywall") A screen has its name only.
captureScreenViews (each Activity, on by default) Sumly.screen in a NavController listener, or in onResume Named by you, so Compose screens count too and match iOS and the web.
PostHog.identify(distinctId = "user_42", userProperties = mapOf(…)) Sumly.identify("user_42") The id RevenueCat has (Purchases.sharedInstance.appUserID). Name and e-mail come from your server, with identify and the secret key.
PostHog.alias("…") Not needed Events from before identify move to the first id you give.
PostHog.reset() Sumly.reset() On sign-out, before identify with the next id.
PostHog.register("team_id", 22) and unregister No equivalent No super properties: give the property on the events that need it.
distinctId() Sumly.userId The id events go under now.
config.optOut, PostHog.optIn() and optOut() waitForConsent = true, Sumly.consent(true) and consent(false) consent(false) also empties what waits to be sent.
PostHog.flush() Sumly.flush() Batches also go on a timer and when the app goes to the background.
captureApplicationLifecycleEvents app_installed, sent once With installReferrer, the install is tied to the web visit or campaign behind it. No Application Opened or Backgrounded events.
captureDeepLinks No equivalent Track the link yourself if it matters: Sumly.track("deep_link_opened", mapOf("path" to path)).
No tap autocapture in posthog-android autocapture = true Taps on Views count by themselves; in Compose, Sumly.tap where it matters. The project needs Every click, without marking on too.
config.debug = true debug = true in init Logs what it sends.
PostHog.isFeatureEnabled("new-checkout") Sumly.isEnabled("new-checkout") Made in Visitors › Flags with the same key; the second argument is the fallback.
PostHog.getFeatureFlag("paywall"), getFeatureFlagResult Sumly.getVariant("paywall", "monthly") getFlagDetail says the value, why, and whether it came from the server or the phone's cache.
PostHog.getFeatureFlagPayload("paywall") Sumly.getFlagPayload("paywall") The JSON you gave the flag or the variant.
PostHog.reloadFeatureFlags() Sumly.reloadFlags() Also by itself at launch, after identify, back in front and every 5 minutes.
PostHog.group(type = "company", key = "acme") Sumly.group("company", "acme") For flags with one value for everyone in a company.

No Sumly equivalent

  • Surveys: none. The heard_from recipe asks where people heard about the app.
  • Session replay in the app: none. With heatmaps on, Sumly draws the taps over one picture of each screen instead.
  • Group analytics (PostHog.group), error tracking and PostHog's own dashboards: none.

A week side by side: what to compare

  • People per day on Android: Sumly's Visitors, platform Android, against a PostHog trend of unique users on $screen.
  • Your top five screens by views, with the same names in both. PostHog named Activities by their label, so rename one side to match.
  • One event that matters, such as trial_started, and the installs.
  • Expect a few percent apart: PostHog with person profiles for identified users only counts differently before identify, and both count the day in their own time zone, so set the same one.

Both side by side in your Application class; PostHog's lines are in comments.

class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        // val config = PostHogAndroidConfig(apiKey = "phc_…", host = "https://eu.i.posthog.com")
        // PostHogAndroid.setup(this, config)
        Sumly.init(this, siteKey = "sl_your_key")
    }
}

// after sign-in: the same id for both, and for RevenueCat (Purchases.sharedInstance.appUserID)
fun signedIn(userId: String) {
    // PostHog.identify(distinctId = userId, userProperties = mapOf("plan" to "free"))
    Sumly.identify(userId)
}

fun signedOut() {
    // PostHog.reset()
    Sumly.reset()
}

Or let your coding assistant do it

Paste this into Claude Code, Cursor or Codex in your project. It fits the code to how your project is built, asks you for the dashboard steps and leaves the keys to you.

See what it says
Move this Android app from PostHog to Sumly: add Sumly next to PostHog first, with the same calls, so both run for a week.

Sumly (https://sumly.dev) shows revenue next to the visits and app users it came from. The full guide is https://sumly.dev/install/posthog-android; read it if anything below is unclear.

Steps:
1. In Sumly, open Visitors and copy your project's public key (`sl_…`). Download https://sumly.dev/sdk/Sumly.kt into your app module. Leave posthog-android in for now.
2. In `Application.onCreate`, next to `PostHogAndroid.setup(this, config)`, call `Sumly.init(this, siteKey = "sl_…")`. Wherever the app calls `PostHog.identify`, `capture`, `screen` or `reset`, add the Sumly call from the table into Sumly, with the same user id.
3. PostHog names each Activity by its label by itself; Sumly does not. With Navigation Compose, call `Sumly.screen` in a NavController listener; with Activities or Fragments, in `onResume`, with the names your PostHog insights already use.
4. Ship that build and leave both running for a week. Compare the numbers in the list into Sumly; small gaps are expected, a large one means a call is missing.
5. In Sumly, Tracking › Import earlier history › PostHog brings PostHog's months before Sumly. Its feature flags move too: make each one in Visitors › Flags with the same key and rollout (Sumly buckets people the same way, so the same people stay in), then swap the calls from the table. Then remove the posthog-android dependency and its calls.

Call by call (before → Sumly):
- PostHogAndroid.setup(this, PostHogAndroidConfig(apiKey = "phc_…", host = …)) → Sumly.init(this, siteKey = "sl_…"). The public key from Visitors, in Application.onCreate. No host to choose; endpoint = only for your own domain.
- PostHog.capture(event = "trial_started", properties = mapOf(…)) → Sumly.track("trial_started", mapOf(…)). Text, numbers and true or false; a few properties, not a whole object.
- PostHog.screen(screenTitle = "Paywall") → Sumly.screen("Paywall"). A screen has its name only.
- captureScreenViews (each Activity, on by default) → Sumly.screen in a NavController listener, or in onResume. Named by you, so Compose screens count too and match iOS and the web.
- PostHog.identify(distinctId = "user_42", userProperties = mapOf(…)) → Sumly.identify("user_42"). The id RevenueCat has (Purchases.sharedInstance.appUserID). Name and e-mail come from your server, with identify and the secret key.
- PostHog.alias("…") → Not needed. Events from before identify move to the first id you give.
- PostHog.reset() → Sumly.reset(). On sign-out, before identify with the next id.
- PostHog.register("team_id", 22) and unregister → No equivalent. No super properties: give the property on the events that need it.
- distinctId() → Sumly.userId. The id events go under now.
- config.optOut, PostHog.optIn() and optOut() → waitForConsent = true, Sumly.consent(true) and consent(false). consent(false) also empties what waits to be sent.
- PostHog.flush() → Sumly.flush(). Batches also go on a timer and when the app goes to the background.
- captureApplicationLifecycleEvents → app_installed, sent once. With installReferrer, the install is tied to the web visit or campaign behind it. No Application Opened or Backgrounded events.
- captureDeepLinks → No equivalent. Track the link yourself if it matters: Sumly.track("deep_link_opened", mapOf("path" to path)).
- No tap autocapture in posthog-android → autocapture = true. Taps on Views count by themselves; in Compose, Sumly.tap where it matters. The project needs Every click, without marking on too.
- config.debug = true → debug = true in init. Logs what it sends.
- PostHog.isFeatureEnabled("new-checkout") → Sumly.isEnabled("new-checkout"). Made in Visitors › Flags with the same key; the second argument is the fallback.
- PostHog.getFeatureFlag("paywall"), getFeatureFlagResult → Sumly.getVariant("paywall", "monthly"). getFlagDetail says the value, why, and whether it came from the server or the phone's cache.
- PostHog.getFeatureFlagPayload("paywall") → Sumly.getFlagPayload("paywall"). The JSON you gave the flag or the variant.
- PostHog.reloadFeatureFlags() → Sumly.reloadFlags(). Also by itself at launch, after identify, back in front and every 5 minutes.
- PostHog.group(type = "company", key = "acme") → Sumly.group("company", "acme"). For flags with one value for everyone in a company.

No Sumly equivalent (leave these as they are, or ask me):
- Surveys: none. The heard_from recipe asks where people heard about the app.
- Session replay in the app: none. With heatmaps on, Sumly draws the taps over one picture of each screen instead.
- Group analytics (PostHog.group), error tracking and PostHog's own dashboards: none.

Setup: Both side by side in your Application class; PostHog's lines are in comments.
```
class MyApp : Application() {
    override fun onCreate() {
        super.onCreate()
        // val config = PostHogAndroidConfig(apiKey = "phc_…", host = "https://eu.i.posthog.com")
        // PostHogAndroid.setup(this, config)
        Sumly.init(this, siteKey = "sl_your_key")
    }
}

// after sign-in: the same id for both, and for RevenueCat (Purchases.sharedInstance.appUserID)
fun signedIn(userId: String) {
    // PostHog.identify(distinctId = userId, userProperties = mapOf("plan" to "free"))
    Sumly.identify(userId)
}

fun signedOut() {
    // PostHog.reset()
    Sumly.reset()
}
```

Events: capture becomes track, with the same name and properties.
```
fun startedTrial(plan: String, days: Int) {
    // PostHog.capture(event = "trial_started", properties = mapOf("plan" to plan, "days" to days))
    Sumly.track("trial_started", mapOf("plan" to plan, "days" to days))
}
```

Screens: PostHog counted Activities; Sumly counts the screens you name, Compose ones included.
```
// Navigation Compose: each destination as it opens
navController.addOnDestinationChangedListener { _, destination, _ ->
    Sumly.screen(destination.route ?: "App")
}

// an Activity or Fragment
override fun onResume() {
    super.onResume()
    // PostHog.screen(screenTitle = "Settings")
    Sumly.screen("Settings")
}
```

Consent: optOut becomes waiting for consent: nothing is kept or sent until consent(true).
```
Sumly.init(this, siteKey = "sl_your_key", waitForConsent = true)

fun answeredConsent(granted: Boolean) {
    // if (granted) PostHog.optIn() else PostHog.optOut()
    Sumly.consent(granted)
}
```

Keep in mind: No advertising id. In Google Play's Data safety, declare app interactions, user ids and approximate location, collected for analytics, and take out what only PostHog needed. Revenue comes from the store: connect Google Play or RevenueCat in Projects and integrations, and give Sumly.identify the id RevenueCat uses. Imported PostHog months show usage, people and sources; which screen led to a purchase starts with Sumly's SDK. The Kotlin samples here are not compiled by our tests the way the Swift and TypeScript ones are; they use only the calls in Sumly.kt.

How to work:
- Look at how this project is built first, and fit the code to its framework and its way of doing things; the examples above are a starting point, not something to paste as is.
- Steps that happen in a dashboard (Sumly, or From PostHog on Android's own) are mine: tell me exactly what to click, then wait for me.
- Keys the code needs belong in environment variables, never in the code or the repository. Never ask me to paste a secret key into this chat; tell me which variable to set.
- Change only what this needs, show me the changes before you commit, and tell me how to check that it works.
- sl_your_key stands for the project's public key; it is on the Visitors page in Sumly. Ask me for it.

Purchases

Purchases do not come through the app: Sumly reads them from RevenueCat, Adapty or Superwall. Give identify the same person they know: RevenueCat's app user id (the anonymous one too), or the user id you pass to Adapty.identify or Superwall.identify. Each purchase then shows the screens and the source that came before it.

Buyers' names

Apple and Google never share who bought. To see a buyer's name or e-mail on their payments, send it from your server with the secret key: { "type": "identify", "user_id": "u_42", "traits": { "name": "Ana Novak", "email": "[email protected]" } } to /api/v1/events, with the same user id RevenueCat knows. Payments already kept take the name too. An empty trait clears it, and { "type": "forget", "user_id": "u_42" } removes them when they delete their account. Only the name and e-mail are kept, never shown publicly; without them the buyer stays "App user u_42".

Your own domain

Optional. The own address of your site's script (one DNS record on Visitors, on every plan) takes app events too: give it as the endpoint and the app sends to /api/v1/events there.

Good to know

  • No advertising id. In Google Play's Data safety, declare app interactions, user ids and approximate location, collected for analytics, and take out what only PostHog needed.
  • Revenue comes from the store: connect Google Play or RevenueCat in Projects and integrations, and give Sumly.identify the id RevenueCat uses.
  • Imported PostHog months show usage, people and sources; which screen led to a purchase starts with Sumly's SDK.
  • The Kotlin samples here are not compiled by our tests the way the Swift and TypeScript ones are; they use only the calls in Sumly.kt.

From From PostHog on Android's own documentation, checked 20 November 2026: posthog.com/docs/libraries/android, posthog.com/docs/api/queries .

From PostHog on Android questions

What about PostHog's feature flags and experiments?

They move to Sumly: Sumly.isEnabled, getVariant and getFlagPayload read flags you make in Visitors › Flags, cached on the phone and worked out on Sumly's server. An experiment there counts each variant's paying customers and revenue, not only clicks. Keep a flag's key and rollout and the same people stay in. (Until you move them, posthog-android can stay in for flags only, with captureScreenViews and captureApplicationLifecycleEvents false.) The two SDKs do not touch each other.

Do I lose my PostHog history?

No. Import earlier history › PostHog reads it with a key that can only read and brings its screens, events and people for the days before Sumly started. Remove takes it out again.

How do purchases tie in?

Connect Google Play (or RevenueCat) in Sumly, and pass Sumly.identify the same app user id RevenueCat has. Each purchase then shows the screens, taps and source before it, and with installReferrer the ad or page behind the install.

Other apps

Try it with your own projects

Sign in with Google or a code by e-mail and connect your first project. The first 14 days of a paid plan are free, with no card.

Start free

Or look around first: open the live demo.

Page names first, then what the pages say