Mixpanel Community Icon
  • Avatar of kapa.ai
    kapa.ai
    APP
    ·
    ·

    To track the operating system in Mixpanel, you don't need to implement any additional code as it's automatically collected as a default property for events and user profiles when using Mixpanel's client-side SDKs. Here's what you need to know: 1. Event Property: The operating system is tracked as the "$os" property on events. 2. User Property: The operating system is also tracked as the "$os" property on user profiles.This information is automatically collected by Mixpanel's JavaScript, iOS, Android, and Unity SDKs. You can find this documented in the Default Properties reference.If you're using server-side tracking, you'll need to manually add this property. You can extract the operating system information from the User-Agent header of the HTTP request. Here's an example of how to do this in Python, as shown in the Server-Side Best Practices guide: LBKSfrom ua_parser import user_agent_parserLBKSparsed = user_agent_parser.Parse(request.headers["User-Agent"])LBKSproperties.update({ "$os": parsed["os"]["family"], })LBKSRemember to use a user agent parsing library appropriate for your server-side language to extract this information accurately.

    kapa.ai is still learning and improving, please let me know how I did by reacting below.

    ℹ️ Tip: Mention @kapa.ai in the thread for follow-ups or DM the app for 1-to-1 help.