https://www.growthbook.io/ logo
#announcements
Title
# announcements
h

helpful-hydrogen-62495

02/13/2022, 6:12 PM
hey guys, what is the recommended approach for target conditions when we want to use OR statements instead of AND statements. Should I Make a separate rule for each side of the OR condition or should I combine it into one rule (if so, how?) e.g. user is on iOS and (version is 1.0.0 or version is 1.0.1), etc… edit: I guess for most cases I can use the “in list” option? but what about a double condition such as e.g. (is iOS and version is 1.0.1) OR (is Android and version is 1.0.5)
as a follow up, if I have two separate override rules, and I want to have them funnel into an A/B test should I use the same tracking key for both? or separate ones?
came up with something like this in the advanced mode query tool. Is this the right way?
Copy code
{
  "env": "prod",
  "firstOpen": {
    "$gt": 1644728400
  },
  "$or": [
    {
      "$and": [
        {
          "phoneOS": "ios"
        },
        {
          "nativeApplicationVersion": "1.1.5"
        }
      ]
    },
    {
      "$and": [
        {
          "phoneOS": "android"
        },
        {
          "nativeApplicationVersion": "1.1.2"
        }
      ]
    }
  ]
}
f

future-teacher-7046

02/13/2022, 8:24 PM
That looks close. I think this should work:
Copy code
{
  "$and": [
    {
      "env": "prod",
      "firstOpen": {
        "$gt": 1644728400
      }
    },
    {
      "$or": [
        {
          "phoneOS": "ios",
          "nativeApplicationVersion": "1.1.5"
        },
        {
          "phoneOS": "android",
          "nativeApplicationVersion": "1.1.2"
        }
      ]
  ]
}
The other option is like you said, have two separate rules, one for iOS and one for Android, each running an A/B test and use the same tracking key. The conditions would be much simpler so you wouldn't need the advanced mode at all.
A 3rd option is to add a new attribute that contains both the os and version. If you are going to make rules that need both a lot it would make things simpler:
Copy code
{
  "env": "prod",
  "firstOpen": {
    "$gt": 1644728400
  },
  "osAndVersion": {
    "$in": [
      "ios 1.1.5",
      "android 1.1.2"
    ]
  }
}
14 Views