File tree Expand file tree Collapse file tree 1 file changed +20
-18
lines changed
Expand file tree Collapse file tree 1 file changed +20
-18
lines changed Original file line number Diff line number Diff line change @@ -54,27 +54,29 @@ async function resolveIdentityAndCapture(
5454 flushInterval : 0 ,
5555 } ) ;
5656
57- await posthog . capture ( {
58- distinctId : identity . distinct_id ,
59- event,
60- properties : {
61- ...properties ,
62- $set : email ? { email } : { } ,
63- tracking_version : TRACKING_VERSION ,
64- sdk_package : SDK_PACKAGE ,
65- distinct_id_source : identity . distinct_id_source ,
66- } ,
67- } ) ;
68-
69- // TODO: remove after 2026-04-30 — temporary alias to merge old email-based distinct_ids with database user ID
70- if ( email ) {
71- await posthog . alias ( {
57+ try {
58+ await posthog . capture ( {
7259 distinctId : identity . distinct_id ,
73- alias : email ,
60+ event,
61+ properties : {
62+ ...properties ,
63+ $set : { ...( properties ?. $set || { } ) , ...( email ? { email } : { } ) } ,
64+ tracking_version : TRACKING_VERSION ,
65+ sdk_package : SDK_PACKAGE ,
66+ distinct_id_source : identity . distinct_id_source ,
67+ } ,
7468 } ) ;
75- }
7669
77- await posthog . shutdown ( ) ;
70+ // TODO: remove after 2026-04-30 — temporary alias to merge old email-based distinct_ids with database user ID
71+ if ( email ) {
72+ await posthog . alias ( {
73+ distinctId : identity . distinct_id ,
74+ alias : email ,
75+ } ) ;
76+ }
77+ } finally {
78+ await posthog . shutdown ( ) ;
79+ }
7880}
7981
8082async function getDistinctId (
You can’t perform that action at this time.
0 commit comments