Closed CallumHemsley closed 2 days ago
Hello @CallumHemsley thanks for this issue
The identify
method does not have support for the userPropertiesSetOnce
($set_once) option, I'm gonna fix that.
You can do this calling capture
for now:
https://posthog.com/docs/libraries/react-native#set_once
posthog.identify('distinctID',
{
// userProperties:
email: 'user@posthog.com',
name: 'My Name'
})
posthog.identify('distinctID',
{
// userProperties:
$set: {
email: 'user@posthog.com',
name: 'My Name'
},
// userPropertiesSetOnce:
$set_once: {
date_of_first_log_in: '2024-03-01'
},
})
both options should be possible after fixing it.
Bug description
Docs contain the following example:
However, I can see the posthog types from
posthog-react-native
for identity is:identify(distinctId?: string, properties?: PostHogEventProperties, options?: PostHogCaptureOptions): void;
I guess aside from updating the docs, how can we achieve the userPropertiesSetOnce in RN, or is it just the types that are broken?
How to reproduce
npx expo install posthog-react-native expo-file-system expo-application expo-device expo-localization
"posthog-react-native": "^3.3.13",
usePostHog
with following code below, and right click into types for identifyRelated sub-libraries
Additional context
Thank you for your bug report – we love squashing them!