Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

device_name was set to devices user name for all events wrongly #185

Merged
merged 1 commit into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions posthog-react-native/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# Next

1. `$device_name` was set to the device's user name (eg Max's iPhone) for all events wrongly, it's now set to the device's name (eg iPhone 12), this happened only if using `react-native-device-info` library.

# 2.11.5 - 2024-02-20

1. fix: undefined posthog in hooks
Expand Down
4 changes: 3 additions & 1 deletion posthog-react-native/src/native-deps.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ export const getAppProperties = (): PostHogCustomAppProperties => {

if (OptionalExpoDevice) {
properties.$device_manufacturer = OptionalExpoDevice.manufacturer
// expo-device already maps the device model identifier to a human readable name
properties.$device_name = OptionalExpoDevice.modelName
properties.$os_name = OptionalExpoDevice.osName
properties.$os_version = OptionalExpoDevice.osVersion
Expand All @@ -45,7 +46,8 @@ export const getAppProperties = (): PostHogCustomAppProperties => {
properties.$app_namespace = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getBundleId())
properties.$app_version = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getVersion())
properties.$device_manufacturer = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getManufacturerSync())
properties.$device_name = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getDeviceNameSync())
// react-native-device-info already maps the device model identifier to a human readable name
properties.$device_name = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getModel())
properties.$os_name = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getSystemName())
properties.$os_version = returnPropertyIfNotUnknown(OptionalReactNativeDeviceInfo.getSystemVersion())
}
Expand Down
4 changes: 3 additions & 1 deletion posthog-react-native/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,10 @@ export interface PostHogCustomAppProperties {
$app_version?: string | null
/** Manufacturer like "Apple", "Samsung" or "Android" */
$device_manufacturer?: string | null
/** Readable model name like "iPhone 12" */
/** Readable model name like "iPhone 12" or "Samsung Galaxy S24" */
$device_name?: string | null
/** Model identifier like "iPhone13,2" or "SM-S921B" */
$device_model?: string | null
/** Device type ("Mobile" | "Desktop" | "Web") */
$device_type?: string | null
/** Operating system name like iOS or Android */
Expand Down
Loading