AlgorithmRules

Rule-based algorithm.

JSON representation
{
  "impressionSignalRuleset": {
    object (Ruleset)
  }
}
Fields
impressionSignalRuleset

object (Ruleset)

Rules for the impression signals.

Ruleset

A ruleset consisting of a list of rules and how to aggregate the resulting values.

JSON representation
{
  "rules": [
    {
      object (Rule)
    }
  ],
  "aggregationType": enum (RuleAggregationType),
  "maxValue": number
}
Fields
rules[]

object (Rule)

List of rules to generate the impression value.

aggregationType

enum (RuleAggregationType)

How to aggregate values of evaluated rules.

maxValue

number

Maximum value the ruleset can evaluate to.

Rule

Set of conditions.

The return value of the rule is either:

  • The return value for single met condition or
  • The defined default return value if no conditions are met.
JSON representation
{
  "conditions": [
    {
      object (RuleCondition)
    }
  ],
  "defaultReturnValue": {
    object (SignalValue)
  }
}
Fields
conditions[]

object (RuleCondition)

List of conditions in this rule. The criteria among conditions should be mutually exclusive.

defaultReturnValue

object (SignalValue)

The default return value applied when none of the conditions are met.

RuleCondition

Set of signal comparisons. Equivalent of an if statement.

JSON representation
{
  "signalComparisons": [
    {
      object (SignalComparison)
    }
  ],
  "returnValue": {
    object (SignalValue)
  }
}
Fields
signalComparisons[]

object (SignalComparison)

List of comparisons that build if statement condition. The comparisons are combined into a single condition with AND logical operators.

returnValue

object (SignalValue)

The value returned if the signalComparisons condition evaluates to TRUE.

SignalComparison

A single comparison. The comparison compares the signal to the comparisonValue.

The comparison of siteId==123 is represented with the following field values:

  • signal has an impressionSignal of SITE_ID.
  • comparisonOperator is set to EQUAL.
  • comparisonValue is set to 123.
JSON representation
{
  "signal": {
    object (Signal)
  },
  "comparisonOperator": enum (ComparisonOperator),
  "comparisonValue": {
    object (ComparisonValue)
  }
}
Fields
signal

object (Signal)

Signal to compare.

comparisonOperator

enum (ComparisonOperator)

Operator used to compare the two values.

In the resulting experession, the signal will be the first value and the `comparisonValue will be the second.

comparisonValue

object (ComparisonValue)

Value to compare signal to.

Signal

Signal used to evaluate rules.

JSON representation
{

  // Union field signal can be only one of the following:
  "impressionSignal": enum (ImpressionSignal)
  // End of list of possible types for union field signal.
}
Fields
Union field signal. The signal used to evaluate rules. signal can be only one of the following:
impressionSignal

enum (ImpressionSignal)

Signal based on impressions.

ComparisonValue

A value to compare the signal to.

JSON representation
{

  // Union field value can be only one of the following:
  "int64Value": string,
  "doubleValue": number,
  "stringValue": string,
  "boolValue": boolean,
  "creativeDimensionValue": {
    object (Dimensions)
  },
  "dayAndTimeValue": {
    object (DayAndTime)
  },
  "deviceTypeValue": enum (RuleDeviceType),
  "onScreenPositionValue": enum (OnScreenPosition),
  "environmentValue": enum (Environment),
  "exchangeValue": enum (Exchange)
  // End of list of possible types for union field value.
}
Fields
Union field value. The value to compare the signal to. value can be only one of the following:
int64Value

string (int64 format)

Integer value.

doubleValue

number

Double value.

stringValue

string

String value.

boolValue

boolean

Boolean value.

creativeDimensionValue

object (Dimensions)

Creative dimension value.

dayAndTimeValue

object (DayAndTime)

Day and time value. Only TIME_ZONE_RESOLUTION_END_USER is supported.

deviceTypeValue

enum (RuleDeviceType)

Device type value.

onScreenPositionValue

enum (OnScreenPosition)

Ad position value.

environmentValue

enum (Environment)

Environment value.

exchangeValue

enum (Exchange)

Exchange value.

DayAndTime

Representation of time defined by day of the week and hour of the day.

JSON representation
{
  "dayOfWeek": enum (DayOfWeek),
  "hourOfDay": integer,
  "timeZoneResolution": enum (TimeZoneResolution)
}
Fields
dayOfWeek

enum (DayOfWeek)

Required. Day of the week.

hourOfDay

integer

Required. Hour of the day.

timeZoneResolution

enum (TimeZoneResolution)

Required. The mechanism used to determine the relevant timezone.

SignalValue

Adjusted value of the signal used for rule evaluation.

JSON representation
{
  "number": number
}
Fields
number

number

Value to use as result.