Mixpanel Community Icon

Understanding Boolean Property Behavior in Mixpanel Event Data

·
·

In my company’s event data architecture, we sometimes have event properties within Objects, but I’ve noticed something in the default behaviour that I wasn’t necessarily expecting. For a breakdown of a boolean property from an Object on an event name, where the Object is not reliably set at the time of the events triggering:

  • The event property value shows as (not set) when casting the property as a String type

  • The event property value shows as false when keeping the property as the Boolean type (the default behaviour in the UI)

The value of false is misleading to me - is this expected behaviour? I’m sensing that’s a yes when looking at the docs for the Boolean type, as it seems like it’s not a nullable boolean from what I read here, but I don’t see anything explicit about how (not set) is treated:

  • Mixpanel treats properties as boolean if the value is either the JSON constant true or false e.g. Favorited = true, Bookmarked = false.

  • “false”, 0, null, undefined, and empty string will be typecasted to boolean false

🧵

  • Avatar of Mark F.
    Mark F.
    ·
    ·

    The underlying data comes from JSON type columns in BigQuery, where “Booleans, strings, and nulls are preserved exactly”. The data is synced to Mixpanel via Hightouch. Nullable booleans are supported types in many data warehouses and in analytics packages (think of Python’s Pandas for example) for the past few years. In the Mixpanel UI I think nullable booleans would be useful too if not supported.

  • Avatar of Mark F.
    Mark F.
    ·
    ·

    With a breakdown on the numeric type from an Object, the UI shows as (not set) where it isn’t in the event. Hence that is different to what I see with boolean type, where (not set) seems to be case to false by default.

  • Avatar of Andrew S.
    Andrew S.
    ·
    ·

    Agree. I am seeing the same thing. If True, it's True. If False, it's False. But if not set, their boolean is treating as "fasle" (i.e., not true). So looks like they consider True vs Not True. If you recast as text, you can see the true/false/not set, if you recast as numbers you see 1/0/not set. Or you can create a custom property that translates it into whatever you want to show.

  • Avatar of Andrew S.
    Andrew S.
    ·
    ·
  • Avatar of Andrew S.
    Andrew S.
    ·
    ·

    (ignore my typo in the custom property, was just doing it quick for demonstration purposes)

  • Avatar of Mark F.
    Mark F.
    ·
    ·

    Andrew S. is your example from Boolean properties within Object types like me, or is it from Boolean types set directly in the event?

  • Avatar of Mark F.
    Mark F.
    ·
    ·

    👍 100% agree that changing the type to a string is the way around this, although for self-serve analytics I know my stakeholders naturally won’t look at the event property types so it will take a lot of education to do this with product teams. Mixpanel - In my case it would be ideal for the UI to support (not set) in a nullable Boolean type.

  • Avatar of Andrew S.
    Andrew S.
    ·
    ·

    If you create the custom property, then they don't need to know about recasting. you can do it for them.

  • Avatar of Andrew S.
    Andrew S.
    ·
    ·

    As for the boolean in my example, it is a boolean property we are setting when tracking the event, not on an object.