Skip to content

parseDevice

reference
1 min readUpdated

Kind: Function

Source: atloria-monorepo/apps/api/src/analytics/utils/tracking-utils.ts

Derive a coarse device class from the user-agent string. Order matters: we check mobile first (since "Android Mobile" includes both keywords), then tablet, then desktop, then fall back to unknown.

Signature

ts
function parseDevice(userAgent: string | null | undefined): DeviceClass

Parameters

NameType
userAgent`string

Returns: DeviceClass

Was this page helpful?

Download as PDF