preprocessors

package
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CustomFunc

type CustomFunc func(response adtype.Response) (adtype.Response, error)

CustomFunc is a function that preprocesses a response

func (CustomFunc) PreprocessResponse

func (p CustomFunc) PreprocessResponse(response adtype.Response) (adtype.Response, error)

PreprocessResponse implements adsource.ResponsePreprocessor

type SecondPrice

type SecondPrice struct{}

SecondPrice adjusts already-selected response bids to second-price (GSP) clearing.

Wire with adsource.WithResponsePreprocessor(preprocessors.SecondPrice{}).

Algorithm:

  1. Collect flat ads via IterAds and sort by InternalAuctionCPMBid descending.
  2. For each ad, clearing price is (in order): Second().GetPrice() if > 0, else the next ad's Price(ActionImpression), else the single/tail rule: - BidFloorCPM > 0 → BidFloor/1000 + half the gap to current (tail capped by min of other cleared prices) - no BidFloor, MinimumPrice > 0 → MinimumPrice - BidFloor and MinimumPrice both ≤ 0 → 10% of current, not above the previous (higher-ranked) ad's cleared price
  3. Apply via SetBidPrice(..., withCommission=true). Skip zero/negative.

func (SecondPrice) PreprocessResponse

func (SecondPrice) PreprocessResponse(response adtype.Response) (adtype.Response, error)

PreprocessResponse implements adsource.ResponsePreprocessor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL