AI-generated Key Takeaways
- 
          
Algorithm Rules define a rule-based algorithm for scoring impressions and post-impression signals.
 - 
          
A Ruleset consists of a list of Rules and defines how their evaluated values are aggregated.
 - 
          
A Rule is a set of conditions (SignalComparisons) that determine a return value.
 - 
          
A RuleCondition is a set of SignalComparisons that are combined with AND logical operators to form an "if" statement.
 - 
          
A SignalComparison compares a specific Signal to a ComparisonValue using a ComparisonOperator.
 
- JSON representation
 - Ruleset
 - Rule
 - RuleCondition
 - SignalComparison
 - Signal
 - ComparisonValue
 - DayAndTime
 - SignalValue
 - FloodlightActivityConversionSignal
 
Rule-based algorithm.
| JSON representation | 
|---|
{ "impressionSignalRuleset": { object (  | 
            
| Fields | |
|---|---|
impressionSignalRuleset | 
              
                 
 Rules for the impression signals.  | 
            
postImpressionSignalRuleset | 
              
                 
 Rules for the post-impression signals. This field is only supported for allowlisted partners.  | 
            
attributionModelId | 
              
                 
 Attribution model for the algorithm. This field is only supported for allowlisted partners.  | 
            
Ruleset
A ruleset consisting of a list of rules and how to aggregate the resulting values.
| JSON representation | 
|---|
{ "rules": [ { object (  | 
              
| Fields | |
|---|---|
rules[] | 
                
                   
 List of rules to generate the impression value.  | 
              
aggregationType | 
                
                   
 How to aggregate values of evaluated rules.  | 
              
maxValue | 
                
                   
 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 (  | 
              
| Fields | |
|---|---|
conditions[] | 
                
                   
 List of conditions in this rule. The criteria among conditions should be mutually exclusive.  | 
              
defaultReturnValue | 
                
                   
 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 (  | 
              
| Fields | |
|---|---|
signalComparisons[] | 
                
                   
 List of comparisons that build   | 
              
returnValue | 
                
                   
 The value returned if the   | 
              
SignalComparison
A single comparison. The comparison compares the signal to the comparisonValue.
The comparison of siteId==123 is represented with the following field values:
signalhas animpressionSignalofSITE_ID.comparisonOperatoris set toEQUAL.comparisonValueis set to 123.
| JSON representation | 
|---|
{ "signal": { object (  | 
              
| Fields | |
|---|---|
signal | 
                
                   
 Signal to compare.  | 
              
comparisonOperator | 
                
                   
 Operator used to compare the two values. In the resulting experession, the   | 
              
comparisonValue | 
                
                   
 Value to compare signal to.  | 
              
Signal
Signal used to evaluate rules.
| JSON representation | 
|---|
{ // Union field  | 
              
| Fields | |
|---|---|
Union field signal. The signal used to evaluate rules. signal can be only one of the following: | 
              |
impressionSignal | 
                
                   
 Signal based on impressions.  | 
              
clickSignal | 
                
                   
 Signal based on clicks. This field is only supported for allowlisted partners.  | 
              
activeViewSignal | 
                
                   
 Signal based on active views. This field is only supported for allowlisted partners.  | 
              
ComparisonValue
A value to compare the signal to.
| JSON representation | 
|---|
{ // Union field  | 
              
| Fields | |
|---|---|
Union field value. The value to compare the signal to. value can be only one of the following: | 
              |
int64Value | 
                
                   
 Integer value.  | 
              
doubleValue | 
                
                   
 Double value.  | 
              
stringValue | 
                
                   
 String value.  | 
              
boolValue | 
                
                   
 Boolean value.  | 
              
creativeDimensionValue | 
                
                   
 Creative dimension value.  | 
              
dayAndTimeValue | 
                
                   
 Day and time value. Only   | 
              
deviceTypeValue | 
                
                   
 Device type value.  | 
              
onScreenPositionValue | 
                
                   
 Ad position value.  | 
              
environmentValue | 
                
                   
 Environment value.  | 
              
exchangeValue | 
                
                   
 Exchange value.  | 
              
contentDurationValue | 
                
                   
 Video content duration value.  | 
              
contentStreamTypeValue | 
                
                   
 Video delivery type value.  | 
              
contentGenreIdValue | 
                
                   
 Video genre id value.  | 
              
videoPlayerSizeValue | 
                
                   
 Video player size value. This field is only supported for allowlisted partners.  | 
              
DayAndTime
Representation of time defined by day of the week and hour of the day.
| JSON representation | 
|---|
{ "dayOfWeek": enum (  | 
              
| Fields | |
|---|---|
dayOfWeek | 
                
                   
 Required. Day of the week.  | 
              
hourOfDay | 
                
                   
 Required. Hour of the day.  | 
              
timeZoneResolution | 
                
                   
 Required. The mechanism used to determine the relevant timezone.  | 
              
SignalValue
Adjusted value of the signal used for rule evaluation.
| JSON representation | 
|---|
{ // Union field  | 
              
| Fields | |
|---|---|
Union field signal. The base signal used to generate the value. signal can be only one of the following: | 
              |
activeViewSignal | 
                
                   
 Signal based on active views. Only  This field is only supported for allowlisted partners.  | 
              
floodlightActivityConversionSignal | 
                
                   
 Signal based on floodlight conversion events. This field is only supported for allowlisted partners.  | 
              
number | 
                
                   
 Value to use as result.  | 
              
FloodlightActivityConversionSignal
The rule to score impressions based on Floodlight conversion events.
| JSON representation | 
|---|
{ "floodlightActivityId": string, "countingMethod": enum (  | 
              
| Fields | |
|---|---|
floodlightActivityId | 
                
                   
 Required. Id of the floodlight activity.  | 
              
countingMethod | 
                
                   
 Required. The way to acquire value from the floodlight activity, for example, count of the conversion.  | 
              
conversionCounting | 
                
                   
 Required. The type of conversions to be used in impression value computation, for example, post-click conversions.  |