amplitude / Amplitude-TypeScript

TypeScript Amplitude Analytics SDK
https://amplitude.github.io/Amplitude-TypeScript/
MIT License
132 stars 38 forks source link

[Migrating from expo-analytics-amplitude to @amplitude/analytics-react-native] Amplitude is no Longer Tracking Phone Properties Like Platform, Model, and OS #293

Open Dulatech opened 1 year ago

Dulatech commented 1 year ago

Expected Behavior

Amplitude should be tracking Device Type, OS, and Platform. Like in the example below. image

Current Behavior

After migrating to this new library, I'm seeing events defaulting the Platform to "Web", which was automatically tracked before (expo-analytics-amplitude who was a wrapper of Amplitude-Android and Amplitude-iOS). Screenshot_4

Steps to Reproduce

  1. Build app using expo SDK 46
  2. Check Amplitude Events
  3. Platform is always set to Web

Environment

kevinpagtakhan commented 1 year ago

Hi @Dulatech, thank you for choosing Amplitude. Are these sample events emitted from a production build? Asking because we've seen this when running on debug mode in expo. The new Amplitude SDK for React Native works differently now since it doesn't wrap Amplitude SDKs for iOS and Android, but rather is mainly written in JavaScript with some code to get device/user context from iOS and Android. However, the SDK should be aware on which platform it runs on so it is not expected to show Web when in the iOS and Android environments.

edgarroman commented 1 year ago

I have had this experience with my expo mobile app. During development running expo on my local machine, the Amplitude SDK reported all events as 'web'. Once rolled out to production, the Amplitude SDK started to report mobile platform information correctly.

I will note that even when running expo start and connecting to the server with an actual iPhone and Android device, the SDK still reports as web events.

Because I did not know of this behavior, I added the platform information manually as additional user properties - needlessly duplicating information. I feel this is important SDK behavior to be included in the Amplitude documentation.

Environment:

kevinpagtakhan commented 1 year ago

Hi @edgarroman thank you for sharing your experience. This indeed appears to me as a common point of confusion. Our team will look into how we can improve this experience overall.

Dulatech commented 1 year ago

I confirmed that publishing my app to production using Expo SDK 46 Classic Build, the production app still reports Platform as "Web". It seems that using Classic Expo build does not work for tracking the Platform of the device.

It seems that other users who built with EAS build are getting the correct values for their platform in production.

Environment:

kevinpagtakhan commented 1 year ago

@Dulatech do you have an example repo that we can take a look at to investigate further?

aitorct commented 1 year ago

We are having a similar issue too. We don't use Expo's Classic Builds but EAS Build. We are getting all properties right except for Version, which is the app's version. It used to work when using Expo's Amplitude library, but we no longer receive this property after migrating to this library.

"@amplitude/analytics-react-native": "^0.7.0"
"expo": "47.0.0"

Is this supported or should we add that property manually? I see no reference to it in the React Native docs whereas I see it for the iOS and Android SDKs.

aitorct commented 1 year ago

We have upgraded to the latest version, 1.0.1, and the version property is still missing.

jd-bus commented 1 year ago

Same issue here. Carrier and Version are missing. Is there a way that we can override it until you fix the bug?

jd-bus commented 1 year ago

btw on Android carrier works, but not on iOS

Dulatech commented 1 year ago

I have confirmed that building the app with Expo EAS, Amplitude tracks the Phone Properties Like Platform, Model, and OS when using amplitude-react-native-ts/1.1.1

This seems to be an issue when building with Expo Classic Build or Turtle Cli.

jd-bus commented 1 year ago

It's also an issue in a plain react native app (no expo).