posthog-js icon indicating copy to clipboard operation
posthog-js copied to clipboard

Unable to use get_initial_props to get initial referrer path

Open CahidArda opened this issue 1 year ago • 0 comments

I want to access the initial referrer path name (not domain). This information is available in the Posthog cookie as far as I can tell in $initial_person_info.r:

{
  "$initial_person_info": {
    "r": "http://localhost:3001/refering/page/path",
    "u": "http://localhost:3000/"
  },
}

Looking at the code, it looks like it should have been possible with posthog.sessionPersistence?.get_initial_props() method but it returns empty object {}.

I eventually did it with posthog.get_property("$initial_person_info").r.

CahidArda avatar Oct 15 '24 07:10 CahidArda