Documentation ¶
Overview ¶
Package impressions provides various algorithms to get the number of impressions along with minimum and maximum duration of each impression. It uses Ad pod request for it
Index ¶
Constants ¶
This section is empty.
Variables ¶
var MonitorKey = map[Algorithm]string{ MaximizeForDuration: `a1_max`, MinMaxAlgorithm: `a2_min_max`, ByDurationRanges: `a3_duration`, }
MonitorKey provides the unique key for moniroting the impressions algorithm
Functions ¶
This section is empty.
Types ¶
type Algorithm ¶
type Algorithm int
Algorithm indicates type of algorithms supported Currently it supports
- MaximizeForDuration
- MinMaxAlgorithm
const ( // MaximizeForDuration algorithm tends towards Ad Pod Maximum Duration, Ad Slot Maximum Duration // and Maximum number of Ads. Accordingly it computes the number of impressions MaximizeForDuration Algorithm = iota // MinMaxAlgorithm algorithm ensures all possible impression breaks are plotted by considering // minimum as well as maxmimum durations and ads received in the ad pod request. // It computes number of impressions with following steps // 1. Passes input configuration as it is (Equivalent of MaximizeForDuration algorithm) // 2. Ad Pod Duration = Ad Pod Max Duration, Number of Ads = max ads // 3. Ad Pod Duration = Ad Pod Max Duration, Number of Ads = min ads // 4. Ad Pod Duration = Ad Pod Min Duration, Number of Ads = max ads // 5. Ad Pod Duration = Ad Pod Min Duration, Number of Ads = min ads MinMaxAlgorithm // ByDurationRanges algorithm plots the impression objects based on expected video duration // ranges reveived in the input prebid-request. Based on duration matching policy // it will generate the impression objects. in case 'exact' duration matching impression // min duration = max duration. In case 'round up' this algorithm will not be executed.Instead ByDurationRanges )
func SelectAlgorithm ¶
func SelectAlgorithm(reqAdPod *openrtb_ext.ExtRequestAdPod) Algorithm
SelectAlgorithm is factory function which will return valid Algorithm based on adpod parameters Return Value:
- MinMaxAlgorithm (default)
- ByDurationRanges: if reqAdPod extension has VideoAdDuration and VideoAdDurationMatchingPolicy is "exact" algorithm
type Duration ¶
type Duration int
Duration indicates the position where the required min or max duration value can be found within given impression object
type IImpressions ¶
type IImpressions interface { Get() [][2]int64 Algorithm() Algorithm // returns algorithm used for computing number of impressions }
IImpressions ...
func NewImpressions ¶
func NewImpressions(podMinDuration, podMaxDuration int64, reqAdPod *openrtb_ext.ExtRequestAdPod, vPod *openrtb_ext.VideoAdPod, algorithm Algorithm) IImpressions
NewImpressions generate object of impression generator based on input algorithm type if invalid algorithm type is passed, it returns default algorithm which will compute impressions based on minimum ad slot duration