exchange

package
v2.10.0-ow Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2024 License: Apache-2.0 Imports: 266 Imported by: 0

Documentation

Index

Constants

View Source
const (
	VASTTypeWrapperEndTag = "</Wrapper>"
	VASTTypeInLineEndTag  = "</InLine>"
)
View Source
const (
	NoBidUnknownError                      openrtb3.NoBidReason = 0   // No Bid - General
	ResponseRejectedCategoryMappingInvalid openrtb3.NoBidReason = 303 // Response Rejected - Category Mapping Invalid
	ErrorGeneral                           openrtb3.NoBidReason = 100 // Error - General
	ErrorTimeout                           openrtb3.NoBidReason = 101 // Error - Timeout
	ErrorInvalidBidResponse                openrtb3.NoBidReason = 102 // Error - Invalid Bid Response
	ErrorBidderUnreachable                 openrtb3.NoBidReason = 103 // Error - Bidder Unreachable
)

SeatNonBid list the reasons why bid was not resulted in positive bid reason could be either No bid, Error, Request rejection or Response rejection Reference: https://github.com/InteractiveAdvertisingBureau/openrtb/blob/master/extensions/community_extensions/seat-non-bid.md

View Source
const (
	RequestBlockedGeneral              openrtb3.NoBidReason = 200 // Request Blocked - General
	RequestBlockedUnsupportedChannel   openrtb3.NoBidReason = 201 // Request Blocked - Unsupported Channel (app/site/dooh)
	RequestBlockedUnsupportedMediaType openrtb3.NoBidReason = 202 // Request Blocked - Unsupported Media Type (banner/video/native/audio)
	RequestBlockedOptimized            openrtb3.NoBidReason = 203 // Request Blocked - Optimized
	RequestBlockedPrivacy              openrtb3.NoBidReason = 204 // Request Blocked - Privacy
)
View Source
const (
	ResponseRejectedGeneral                      openrtb3.NoBidReason = 300 // Response Rejected - General
	ResponseRejectedBelowFloor                   openrtb3.NoBidReason = 301 // Response Rejected - Below Floor
	ResponseRejectedDuplicateBid                 openrtb3.NoBidReason = 302 // Response Rejected - Duplicate
	ResponseRejectedInvalidCategoryMapping       openrtb3.NoBidReason = 303 // Response Rejected - Category Mapping Invalid
	ResponseRejectedBelowDealFloor               openrtb3.NoBidReason = 304 // Bid was Below Deal Floor
	ResponseRejectedInvalidCreative              openrtb3.NoBidReason = 350 // Response Rejected - Invalid Creative
	ResponseRejectedCreativeSizeNotAllowed       openrtb3.NoBidReason = 351 // Response Rejected - Invalid Creative (Size Not Allowed)
	ResponseRejectedCreativeNotSecure            openrtb3.NoBidReason = 352 // Response Rejected - Invalid Creative (Not Secure)
	ResponseRejectedCreativeIncorrectFormat      openrtb3.NoBidReason = 353 // Response Rejected - Invalid Creative (Incorrect Format)
	ResponseRejectedCreativeMalware              openrtb3.NoBidReason = 354 // Response Rejected - Invalid Creative (Malware)
	ResponseRejectedCreativeAdvertiserExclusions openrtb3.NoBidReason = 355 // Creative Filtered - Advertiser Exclusions
	ResponseRejectedCreativeAdvertiserBlocking   openrtb3.NoBidReason = 356 // Creative Filtered - Advertiser Blocking
	ResponseRejectedCreativeCategoryExclusions   openrtb3.NoBidReason = 357 // Creative Filtered - Category Exclusions
)
View Source
const (
	DebugOverrideHeader string = "x-pbs-debug-override"
)
View Source
const (
	Gzip string = "GZIP"
)

Possible values of compression types Prebid Server can support for bidder compression

View Source
const ImpIdReqBody = "Stored bid response for impression id: "
View Source
const MaxKeyLength = 20

Variables

This section is empty.

Functions

func ExtractReqExtBidderParamsMap

func ExtractReqExtBidderParamsMap(bidRequest *openrtb2.BidRequest) (map[string]json.RawMessage, error)

func GetActiveBidders

func GetActiveBidders(infos config.BidderInfos) map[string]openrtb_ext.BidderName

GetActiveBidders returns a map of all active bidder names.

func GetDisabledBidderWarningMessages

func GetDisabledBidderWarningMessages(infos config.BidderInfos) map[string]string

func GetPriceBucket

func GetPriceBucket(bid openrtb2.Bid, targetingData targetData) string

GetPriceBucket is the externally facing function for computing CPM buckets

func GetPriceBucketOW

func GetPriceBucketOW(cpm float64, config openrtb_ext.PriceGranularity) string

GetPriceBucketOW is the externally facing function for computing CPM buckets

func GetValidBidders

func GetValidBidders(aliases map[string]string) map[string]struct{}

func IsDebugOverrideEnabled

func IsDebugOverrideEnabled(debugHeader, configOverrideToken string) bool

func IsUrl

func IsUrl(adm string) bool

func JLogf

func JLogf(msg string, obj interface{})

func WrapJSONInData

func WrapJSONInData(data []byte) []byte

Types

type AdaptedBidder

type AdaptedBidder interface {
	// contains filtered or unexported methods
}

AdaptedBidder defines the contract needed to participate in an Auction within an Exchange.

This interface exists to help segregate core auction logic.

Any logic which can be done _within a single Seat_ goes inside one of these. Any logic which _requires responses from all Seats_ goes inside the Exchange.

This interface differs from adapters.Bidder to help minimize code duplication across the adapters.Bidder implementations.

func AdaptBidder

func AdaptBidder(bidder adapters.Bidder, client *http.Client, cfg *config.Configuration, me metrics.MetricsEngine, name openrtb_ext.BidderName, debugInfo *config.DebugInfo, endpointCompression string) AdaptedBidder

AdaptBidder converts an adapters.Bidder into an exchange.AdaptedBidder.

The name refers to the "Adapter" architecture pattern, and should not be confused with a Prebid "Adapter" (which is being phased out and replaced by Bidder for OpenRTB auctions)

type AuctionRequest

type AuctionRequest struct {
	BidRequestWrapper          *openrtb_ext.RequestWrapper
	ResolvedBidRequest         json.RawMessage
	Account                    config.Account
	UserSyncs                  IdFetcher
	RequestType                metrics.RequestType
	StartTime                  time.Time
	Warnings                   []error
	GlobalPrivacyControlHeader string
	ImpExtInfoMap              map[string]ImpExtInfo
	TCF2Config                 gdpr.TCF2ConfigReader
	Activities                 privacy.ActivityControl

	// LegacyLabels is included here for temporary compatibility with cleanOpenRTBRequests
	// in HoldAuction until we get to factoring it away. Do not use for anything new.
	LegacyLabels   metrics.Labels
	FirstPartyData map[openrtb_ext.BidderName]*firstpartydata.ResolvedFirstPartyData
	// map of imp id to stored response
	StoredAuctionResponses stored_responses.ImpsWithBidResponses
	// map of imp id to bidder to stored response
	StoredBidResponses      stored_responses.ImpBidderStoredResp
	BidderImpReplaceImpID   stored_responses.BidderImpReplaceImpID
	PubID                   string
	HookExecutor            hookexecution.StageExecutor
	QueryParams             url.Values
	BidderResponseStartTime time.Time
	TmaxAdjustments         *TmaxAdjustmentsPreprocessed
}

AuctionRequest holds the bid request for the auction and all other information needed to process that request

type AuctionResponse

type AuctionResponse struct {
	*openrtb2.BidResponse
	ExtBidResponse *openrtb_ext.ExtBidResponse
}

AuctionResponse contains OpenRTB Bid Response object and its extension (un-marshalled) object

func (*AuctionResponse) GetSeatNonBid

func (ar *AuctionResponse) GetSeatNonBid() []openrtb_ext.SeatNonBid

GetSeatNonBid returns array of seat non-bid if present. nil otherwise

type BidIDGenerator

type BidIDGenerator interface {
	New(bidder string) (string, error)
	Enabled() bool
}

type BidderRequest

type BidderRequest struct {
	BidRequest            *openrtb2.BidRequest
	BidderName            openrtb_ext.BidderName
	BidderCoreName        openrtb_ext.BidderName
	BidderLabels          metrics.AdapterLabels
	BidderStoredResponses map[string]json.RawMessage
	IsRequestAlias        bool
	ImpReplaceImpId       map[string]bool
}

BidderRequest holds the bidder specific request and all other information needed to process that bidder request.

type DebugData

type DebugData struct {
	Request  string
	Headers  string
	Response string
}

type DebugLog

type DebugLog struct {
	Enabled       bool
	CacheType     prebid_cache_client.PayloadType
	Data          DebugData
	TTL           int64
	CacheKey      string
	CacheString   string
	Regexp        *regexp.Regexp
	DebugOverride bool
	//little optimization, it stores value of debugLog.Enabled || debugLog.DebugOverride
	DebugEnabledOrOverridden bool
}

func (*DebugLog) BuildCacheString

func (d *DebugLog) BuildCacheString()

func (*DebugLog) PutDebugLogError

func (d *DebugLog) PutDebugLogError(cache prebid_cache_client.Client, timeout int, errors []error) error

type Exchange

type Exchange interface {
	// HoldAuction executes an OpenRTB v2.5 Auction.
	HoldAuction(ctx context.Context, r *AuctionRequest, debugLog *DebugLog) (*AuctionResponse, error)
}

Exchange runs Auctions. Implementations must be threadsafe, and will be shared across many goroutines.

func NewExchange

func NewExchange(adapters map[openrtb_ext.BidderName]AdaptedBidder, cache prebid_cache_client.Client, cfg *config.Configuration, syncersByBidder map[string]usersync.Syncer, metricsEngine metrics.MetricsEngine, infos config.BidderInfos, gdprPermsBuilder gdpr.PermissionsBuilder, currencyConverter *currency.RateConverter, categoriesFetcher stored_requests.CategoryFetcher, adsCertSigner adscert.Signer, macroReplacer macros.Replacer, priceFloorFetcher floors.FloorFetcher) Exchange

type IdFetcher

type IdFetcher interface {
	GetUID(key string) (uid string, exists bool, notExpired bool)
	HasAnyLiveSyncs() bool
}

IdFetcher can find the user's ID for a specific Bidder.

type ImpExtInfo

type ImpExtInfo struct {
	EchoVideoAttrs bool
	StoredImp      []byte
	Passthrough    json.RawMessage
}

type TmaxAdjustmentsPreprocessed

type TmaxAdjustmentsPreprocessed struct {
	BidderNetworkLatencyBuffer     uint
	PBSResponsePreparationDuration uint
	BidderResponseDurationMin      uint

	IsEnforced bool
}

func ProcessTMaxAdjustments

func ProcessTMaxAdjustments(adjustmentsConfig config.TmaxAdjustments) *TmaxAdjustmentsPreprocessed

type VASTTagType

type VASTTagType string

VASTTagType describes the allowed values for VASTTagType

const (
	WrapperVASTTagType VASTTagType = "Wrapper"
	InLineVASTTagType  VASTTagType = "InLine"
	URLVASTTagType     VASTTagType = "URL"
	UnknownVASTTagType VASTTagType = "Unknown"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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