Closed tommedema closed 3 years ago
It's also really weird how https://developers.amplitude.com/docs/http-api-v2 defines os_name
as:
The name of the mobile operating system or browser that the user is using.
How are we supposed to distinguish between the browser on a mobile operating system then? And why is there no browser property?
As a workaround I was planning to set the operating system under the "platform" property, but for some reason this library always overwrites that to Node.js -- which is not the desired behavior because we're proxying user events, and we care about the user's platform/OS, not our server's.
@tommedema This might be an issue with how the HTTP API is spec'd: link:
These fields (platform, os_name, os_version, device_brand, device_manufacturer, device_model, and carrier) must all be updated together. Setting any of these fields will automatically reset all of the other property values to null if they are not also explicitly set for the same event.
A workaround while we figure out a better solution (either on the Data ingestion or the SDK side) might be unsetting the platform (event.platform = '')
@kelvin-lu if we unset the platform, where do we set the operating system then? You'd think os_name
, but that is reserved for the browser the user is using if they're not on mobile (which is really weird).
The name of the mobile operating system or browser that the user is using.
@kelvin-lu this is our workaround for now, which doesn't seem great, but would appreciate your feedback:
// Since Amplitude does not distinguish between operating systems and browsers,
// We pass in the user agent details as event and user properties in addition to the below mixture.
platform: `${originUserAgent.browser.name}@${originUserAgent.browser.major}`,
// See https://developers.amplitude.com/docs/http-api-v2#footnotes
// On why we must specify `unknown` instead of undefined here
os_name: originUserAgent.os.name || 'unknown',
os_version: originUserAgent.os.version || 'unknown',
device_brand: originUserAgent.device.vendor || 'unknown',
device_model: originUserAgent.device.model || 'unknown',
device_manufacturer: 'unknown',
carrier: 'unknown',
I think this makes a lot of sense. Apologies for the slow reply, relaying information from our Data Pipeline Team:
We previously mentioned that the location properties act as a group (i.e. they must all be updated together), and the same is true of the device properties: Device Family, Device Type, Carrier, Platform, and OS make up this group. Once again, this is so we don’t end up with inconsistent values, e.g. Device Type = Apple iPhone X but Platform = Android.
I don't think we'll take the direction of removing Platform off of the SDK so that the others are not reset, but we might make it easier to set the os, version, brand, model, etc. only once instead of on every event
@kelvin-lu thanks.
When you say "Device Family, Device Type", are you referring to these props or are we missing something?
device_brand
device_model
device_manufacturer
Oh I pulled this verbatim off an internal guide, sorry!
Device Family and Device Type are the human-readable properties in the Amplitude UI that we generate out of device_model
and device_manufacturer
. There's nothing you need to do on your end besides making sure those two fields are populated.
@tommedema as another fix for this we're planning on removing the defaultNode.js
platform from events in the Node SDK, so this does not cause unexpected behavior with other fields (os, device, etc.)
That's works, as long as we can still set the platform directly.
fixed with v1.5.2, which is now available
Expected Behavior
When sending os_name amplitude should pickup the OS
Current Behavior
The OS is set to undefined
Possible Solution
Honor the os_name field
Steps to Reproduce
https://app.usebubbles.com/wSsTyZ7XMMan6v8LVPufRN/amplitude-os-undefined/
Environment