OpenPanelO
OpenPanel
Anonymous2h ago

Alias / profile backfill API — merge anonymous (device_id) events into the identified profile

Context We run OpenPanel Cloud for a consumer super-app. Users browse anonymously, then log in. At login we call identify(), so the profile_id switches from the device_id to our member id. Every user who logs in is therefore counted as two profiles, and all pre-login events stay attached to the anonymous profile. This breaks DAU, retention, funnels that start before login, and any user-level analysis. What exists today (checked against main) - /track type "alias" returns "Alias is not supported". - EXPERIMENTAL_PROFILE_BACKFILL rewrites profile_id only for the single session that just ended, and only where created_at > now() - 6 hours. Pre-login activity that spans several sessions or days is not covered, and the flag is not exposed on Cloud. - POST /import/events can insert historical events with created_at, but cannot rewrite existing rows. Request 1. An alias/merge API: POST /track { type: "alias", profileId: "<member_id>", alias: "<device_id>" }. Going forward, events arriving with the alias resolve to profileId. Retroactively, events with profile_id = alias in the same project get profile_id rewritten (or, if a full rewrite is too heavy, a configurable lookback window instead of the hard-coded 6 hours). 2. Or a dedicated backfill endpoint: POST /profiles/backfill { fromProfileId, toProfileId, since? } that runs as an async job and returns a job id we can poll. Project-scoped, idempotent, with a hard cap on rows per call if needed. 3. Either way: document the rule for edge cases (one device used by several accounts, same account on several devices). We can live with "last identify wins per device" as long as it is written down. Why it matters Mixpanel, Amplitude and Braze all merge anonymous and identified activity out of the box. Right now the only workaround is to leave OpenPanel's UI and resolve identities ourselves in ClickHouse SQL, which defeats the self-serve purpose of the product. Happy to test a preview on our project and share numbers.
PendingPending