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

[Amplitude] add device_manufacturer from user agent #2025

Merged
merged 1 commit into from May 21, 2024

Conversation

ardeois
Copy link
Contributor

@ardeois ardeois commented May 7, 2024

For some devices (iPhones for instance), Amplitude requires a device_manufacturer property in order to compute their native property Device Type and Device Family

According to their SDK I've done the following changes:

  • added device_manufacturer based on device.vendor
  • updated device_model to first use device.model before falling back to os.name. As we can see in the snapshots tests, the device_model property makes more sense to be iPhone instead of iOS (which is already the os_name

Note this device_manufacturer was recommended directly from Amplitude's support.

Screenshots

Safari iOS

Before

CleanShot 2024-05-07 at 17 00 21

After

CleanShot 2024-05-07 at 16 56 28

Chrome Mac OS

Before

CleanShot 2024-05-07 at 16 59 24

After

CleanShot 2024-05-07 at 16 58 11

Testing

Include any additional information about the testing you have completed to
ensure your changes behave as expected. For a speedy review, please check
any of the tasks you completed below during your testing.

  • Added unit tests for new functionality
  • Tested end-to-end using the local server
  • [Segmenters] Tested in the staging environment

For some devices (iPhones for instance), Amplitude requires a `device_manufacturer` property in order to compute their native property `Device Type` and `Device Family`

According to [their SDK](https://github.com/amplitude/Amplitude-TypeScript/blob/v1.x/packages/plugin-user-agent-enrichment-browser/src/user-agent-enrichment-plugin.ts#L26-L38) I've done the following changes:
 - added `device_manufacturer` based on `device.vendor`
 - updated `device_model` to first use `device.model` before falling back to `os.name`. As we can see in the snapshots tests, the `device_model` property makes more sense to be `iPhone` instead of `iOS` (which is already the `os_name`
@tcgilbert
Copy link
Contributor

hi @ardeois - our partner engineer who reviews these PRs is currently out of office but will be back Thursday. If there is absolute urgency behind this PR, or you have any questions, let me know.

@ardeois
Copy link
Contributor Author

ardeois commented May 14, 2024

Hi @tcgilbert , thanks for looking into this. No worries if he's back Thursday.
Our goal is to use the vanilla integration of Amplitude actions in order to have a device type.
We found a workaround (by manually sending the device_manufacturer) but would prefer to wait for this PR to be integrated in Segment, as it would avoid having any extra layer in our analytics implementation.

Thank you !

@joe-ayoub-segment joe-ayoub-segment self-assigned this May 16, 2024
@joe-ayoub-segment joe-ayoub-segment merged commit 3f821a6 into segmentio:main May 21, 2024
10 of 11 checks passed
@ardeois ardeois deleted the iphone-User-Agent branch May 21, 2024 18:31
@joe-ayoub-segment
Copy link
Contributor

hi @ardeois - PR deployed. Please confirm the change is good!

@ardeois
Copy link
Contributor Author

ardeois commented May 21, 2024

@joe-ayoub-segment
I confirm this is now working on amplitude

CleanShot 2024-05-21 at 16 16 27

Thanks a lot for merging the PR!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants