Target with custom attributes

Overview

By using custom attributes, you can create even more dynamic and targeted feature rollout plans using any criteria or dimension of your customers.

Attributes are recommended when you need to target customers in real-time, such as:

  • Temporal or fast moving data (example: time since last login, customer creation date, browser type, or machine)
  • Sensitive information (example: customer deal size or customer status)

When deciding whether to use segments versus attributes, segments are best when customers in a segment do not change multiple times in a day or the grouping of customers needs to be standardized across your organization (example: key accounts, internal or outsourced QA teams, company employees).

Types and Matchers

As you design your rollout plans using custom attributes, make sure that you're aware of the different types of attributes that we support as well as the matchers that can be used for each type:

String Literal Attributes

String literal attributes capture the concept of a character String. This attribute can definitely allow you to do standard String to String comparisons, but can also be used to target your customers with any List or Picklist dimension that you track. Use this matcher type to target using a regular expression. String attributes can be used with the following matchers:

  • is in list
  • is not in list
  • starts with
  • does not start with
  • ends with
  • does not end with
  • contains
  • does not contain
  • matches (regular expression)
  • does not match (regular expression)

Set Attributes

Set attributes capture the concept of a List of Strings. Set attributes can be used with the following matchers:

  • is equal to
  • is not equal to
  • has any of
  • does not have any of
  • has all of
  • does not have all of
  • is part of
  • is not part of

Numeric Attributes

Numeric attributes capture the concept of signed integers. Negative numbers are allowed. Floating point numbers are not supported. Numeric attributes can be used with the following matchers:

  • is =
  • is >=
  • is <=
  • is between
  • is not between

DateTime Attributes

DateTime attributes capture the concept of a Date, with optional Time. The value for such attributes should be expressed in milliseconds since epoch. DateTime attributes can be used with the following matchers:

  • is on
  • is not on
  • is on or after
  • is on or before
  • is between
  • is not between

Boolean Attributes

Boolean attributes capture the concept of true or false. Boolean attributes can be used with the following matcher:

  • is

FAQs

What happens if a split uses an attribute whose value is not provided in code?

For instance, take this split definition:

if user.age <= 60 then split 100%:on
else 
if user is in segment all then split 100%:off

If the value for age attribute is not provided in the attributes map passed to getTreatment call, then the matcher in the first condition user.age <= 60 will not match. The user will get the evaluation of the second condition: if user is in segment all then split 100%:off which is off.

What happens if a split uses an attribute whose value in code is not of correct type?

For instance, take this split definition:

if user.plan_type is in list ["basic"] then split 100%:on
else
if user is in segment all then split 100%:off

And say the value provided for plan_type is an int instead of a String. The value for plan_type should be a String, however, the passed in value is a number. In this scenario, the matcher in the first condition user.plan_type is in list ["basic"] will not match. The user will get the evaluation of the second condition: if user is in segment all then split 100%:off which is off.

Use Custom Attributes

The below instructions walk you through how to properly use attributes while creating rollout plans in the Split web console. To understand the proper syntax for using attributes with the SDK in your code base, refer to the relevant language specific article in our SDK Documentation.

Input the attribute

Split allows you to completely customize the attributes you use in your treatment evaluation. When defining your targeting rules you can amend your traffic type to target based on any custom attribute you provide. To do this, add an attribute in the field provided.

Select the matcher

Once you have input a custom attribute, you will then be prompted to choose a matcher. Read more about the available matchers above.

Set the attribute value

Once you've selected your matcher, all you need to do is select the value(s) for the attribute that you want Split to match on. Below are a few examples of usage for different types of attributes:

  • Show the on treatment for users with custom attribute plan_type equal to premium.
  • Show the on treatment for users with custom attribute registered_date on or after a specified date.
  • Show the on treatment for users with custom attribute age greater than or equal to 20.
  • Show the on treatment for users with custom attribute deal_size between 500,000 and 10,000,000.