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

Differentiate between iPad and Mac platforms #12127

Closed
banjerluke opened this issue May 20, 2024 · 1 comment
Closed

Differentiate between iPad and Mac platforms #12127

banjerluke opened this issue May 20, 2024 · 1 comment

Comments

@banjerluke
Copy link

banjerluke commented May 20, 2024

Problem Statement

Sentry currently reports all iPad users as being on macOS due to both platforms using the same user-agent string. I propose a one-line feature check is added so that iPad sessions can be recorded/tagged properly.

Solution Brainstorm

Safari on iPad (and embedded web views in Cordova/Capacitor apps) use the same user agent as Safari on Mac, and currently Sentry "takes the userAgent string at its word" and reports these users as Mac users.

There is a well-known method for determining whether a page is being viewed on an iPad that is pretending to be a Mac – you check the value of navigator.maxTouchPoints:

const isActuallyAnIPad = navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1;

navigator.maxTouchPoints is always 1 on a Mac (since there's no touchscreen) and 10 on an iPad. And yes, navigator.platform is MacIntel even on ARM/M1+ chips.

Here's an example of this bit of iPad-detection seen in the UAParser library.

I have real-world situations where behaviors differ on Safari-Mac and Safari-iPadOS, and it would be very helpful to have these segmented out in Sentry.

Thanks for your consideration!

@AbhiPrasad
Copy link
Member

Hey @banjerluke thank you for writing in! I don't think we're going to add to the SDK at the current moment, but I recommend just adding this as a tag to your Sentry events. That way you can sort/filter through errors and performance pageloads accordingly.

Sentry.setTag('is_ipad', navigator.platform === 'MacIntel' && navigator.maxTouchPoints > 1);

I'm going to close this as such, but if we get more requests we can re-open this and re-evaluate accordingly!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Archived in project
Development

No branches or pull requests

2 participants