Hi, what rule-set do you use under the hood to cat...
# ask-questions
p
Hi, what rule-set do you use under the hood to categorize devices into deviceType (mobile, desktop, tablet)? I couldn't find anything on this in the docs. For context: I was planning to use CSS min-width / max-width to show sections of a page based on device, but I'd need to align them with GB definition, otherwise the stats won't make sense. I'm trying to avoid splitting the test into multiple test - one per deviceType.
f
For GA4, that comes from Google
This is what our HTML Client SDK uses
Copy code
function getBrowserDevice(ua) {
    const browser = ua.match(/Edg/) ? "edge" : ua.match(/Chrome/) ? "chrome" : ua.match(/Firefox/) ? "firefox" : ua.match(/Safari/) ? "safari" : "unknown";
    const deviceType = ua.match(/Mobi/) ? "mobile" : "desktop";
    return {
      browser,
      deviceType
    };
  }
p
Oh, ok. Thank you @fresh-football-47124