Prefix PostHog identify id with "xpro:" for global uniqueness - #4025
Conversation
For mitodl/hq#12601 xPro shares its PostHog project with other MIT applications that identify people by a Keycloak global id, which xPro (no Keycloak) doesn't have. Prefixing xPro's integer user id keeps it from colliding with those ids.
24f7091 to
bc2de75
Compare
Anas12091101
left a comment
There was a problem hiding this comment.
Heads up, this isn't a bug, just something to be aware of.
Right now PostHog knows each xPro user by their plain ID (e.g. 123). After this change, the same person becomes xpro:123. PostHog will treat that as a completely new person it won't connect their old activity to their new activity
This is unfortunately not quite true 😄 Posthog user
Both apps used Anyway, that's the reason for this change. Disambiguate the two. Learn and MITxOnline are both moving to GUIDs, xPro doesn't have access to the GUID, though. |
What are the relevant tickets?
Part of https://github.com/mitodl/hq/issues/12601 (step 4)
Description (What does it do?)
Changes how xPro identifies posthog users.
identify(pk), like pk=123 user id primary key.xpro:pkIdeally, this would be the same guid used in Learn and MITxOnline an (maybe, one day, ocw). But xpro isn't hooked up to keycloak, so we can't get the guid.
How can this be tested?
No functional UI change, so this is best verified by manual code review:
static/js/components/Header.js: confirmidentifyis now called with`xpro:${currentUser.id}`instead of the bare id.Header_test.js.Additional Context
Companion MITxOnline PR for step 3 of the same issue: mitodl/mitxonline#3798