Rulesets

Rulesets

A ruleset describes restrictions required for an action to happen, in the case of an offer, the ruleset is used to describe the offer’s targeting settings Offers and some offer related resources containing rules have a relationship key called ruleset.

The ruleset entity contains the following fields:

Geotargeting Rules

  • countries
  • regions
  • cities
  • dmas
  • mobile_carriers

Device Characteristics Rules

  • browsers
  • device_types
  • brands
  • os_versions
  • platforms

Connection Information Rules

  • ips
  • connection_types

Matches

Each set of rule have two common fields:

  • targeting_type
  • match_type

targeting_type is very simple; it is either ̀include or exclude.

The match_type can have multiple values but for most rules exact is the only type supported.

Complex match_types:

  • os_versions which support the values maximum and minimum in order to compose version ranges without finite bounds.
  • ips which support the value range in order to compose version range with a finite bound.

Order of Precedence

Some rules precede others in the Geotargeting set of rules. The order is based on the specificity of the rule.

The specificity goes City > DMA > Region > Country and the matching logic is the following:

As soon as we hit an “Include” for a rule more specific than the following then we don’t need to continue as even Excludes further down the chain are not enough to justify exclusion.

For example, including New York (City) and excluding United States (Country) is the same as just including New York (City).

Day Parting

The ruleset entity also contains fields related to Day Parting. Day Parting allows you to configure windows in which an action can happen.

The fields are the following:

  • is_use_day_parting
  • day_parting_apply_to
  • day_parting_timezone_id
  • days_parting

is_use_day_parting is a simple boolean flag enabling the day parting

day_parting_apply_to is an optional field, if is_use_day_parting is on, used to specify whether the day parting applies to the user timezone or a specific timezone. Supported values are user_timezone and selected_timezone

day_parting_timezone_id is an optional field, if day_parting_apply_to is set to specific_timezone, used to specify which timezone the day parting is applied to.

days_parting is an optional array field, if is_use_day_parting is on, used to specify rules. There is one entry per window, and there can be multiple windows per day.

For example, the following days_parting entry allows traffic on Tuesdays between 8 AM and 5PM

{
  "day_of_week": 2,
  "start_hour": 8,
  "start_minute": 0,
  "end_hour": 17,
  "end_minute": 0
}