| 21 | } |
| 22 | |
| 23 | export function handlePosthogId(router: NextRouter) { |
| 24 | if (router.query.phId) { |
| 25 | // TODO: cross match between SSR and client metrics |
| 26 | // const distinctId = (window as any)?.posthog?.get_distinct_id(); |
| 27 | // distinctId && |
| 28 | // (window as any)?.posthog?.alias({ |
| 29 | // distinctId, |
| 30 | // alias: router.query.phId, |
| 31 | // }); |
| 32 | const search = new URL(window.location.toString()).searchParams; |
| 33 | search.delete('phId'); |
| 34 | router.replace( |
| 35 | { pathname: window.location.pathname, query: search.toString() }, |
| 36 | undefined, |
| 37 | { shallow: true } |
| 38 | ); |
| 39 | } |
| 40 | } |