openrtb_ext

package
v0.0.0-...-ea31b78 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package openrtb_ext defines all the input validation for Prebid Server's extensions to the OpenRTB 2.5 spec.

Most of these are defined by simple contract classes.

One notable exception is the bidder params, which have more complex validation rules. These are validated by a BidderParamValidator, which relies on the json-schemas from static/bidder-params/{bidder}.json

Index

Constants

View Source
const (
	BidTypeBanner BidType = "banner"
	BidTypeVideo          = "video"
	BidTypeAudio          = "audio"
	BidTypeNative         = "native"
)
View Source
const (
	HbpbConstantKey TargetingKey = "hb_pb"

	// HbEnvKey exists to support the Prebid Universal Creative. If it exists, the only legal value is mobile-app.
	// It will exist only if the incoming bidRequest defiend request.app instead of request.site.
	HbEnvKey TargetingKey = "hb_env"

	// HbBidderConstantKey is the name of the Bidder. For example, "appnexus" or "rubicon".
	HbBidderConstantKey TargetingKey = "hb_bidder"
	HbSizeConstantKey   TargetingKey = "hb_size"
	HbDealIDConstantKey TargetingKey = "hb_deal"

	// HbCacheKey and HbVastCacheKey store UUIDs which can be used to fetch things from prebid cache.
	// Callers should *never* assume that either of these exist, since the call to the cache may always fail.
	//
	// HbVastCacheKey's UUID will fetch the entire bid JSON, while HbVastCacheKey will fetch just the VAST XML.
	// HbVastCacheKey will only ever exist for Video bids.
	HbCacheKey     TargetingKey = "hb_cache_id"
	HbVastCacheKey TargetingKey = "hb_uuid"

	// This is not a key, but values used by the HbEnvKey
	HbEnvKeyApp string = "mobile-app"

	HbCategoryDurationKey TargetingKey = "hb_pb_cat_dur"
)
View Source
const PrebidExtKey = "prebid"

PrebidExtKey represents the prebid extension key used in requests

Variables

View Source
var BidderMap = map[string]BidderName{
	"33across":        Bidder33Across,
	"adkernel":        BidderAdkernel,
	"adkernelAdn":     BidderAdkernelAdn,
	"adtelligent":     BidderAdtelligent,
	"adform":          BidderAdform,
	"advangelists":    BidderAdvangelists,
	"appnexus":        BidderAppnexus,
	"beachfront":      BidderBeachfront,
	"audienceNetwork": BidderFacebook,
	"brightroll":      BidderBrightroll,
	"consumable":      BidderConsumable,
	"conversant":      BidderConversant,
	"emx_digital":     BidderEmxDigital,
	"eplanning":       BidderEPlanning,
	"gamoshi":         BidderGamoshi,
	"grid":            BidderGrid,
	"gumgum":          BidderGumGum,
	"improvedigital":  BidderImprovedigital,
	"ix":              BidderIx,
	"lifestreet":      BidderLifestreet,
	"openx":           BidderOpenx,
	"mgid":            BidderMgid,
	"pubmatic":        BidderPubmatic,
	"pulsepoint":      BidderPulsepoint,
	"rhythmone":       BidderRhythmone,
	"rtbhouse":        BidderRTBHouse,
	"rubicon":         BidderRubicon,
	"sharethrough":    BidderSharethrough,
	"somoaudience":    BidderSomoaudience,
	"sovrn":           BidderSovrn,
	"sonobi":          BidderSonobi,
	"triplelift":      BidderTriplelift,
	"unruly":          BidderUnruly,
	"verizonmedia":    BidderVerizonMedia,
	"vrtcal":          BidderVrtcal,
	"yieldmo":         BidderYieldmo,
	"visx":            BidderVisx,
	"tappx":           BidderTappx,
}

BidderMap stores all the valid OpenRTB 2.x Bidders in the project. This map *must not* be mutated.

Functions

This section is empty.

Types

type AdPod

type AdPod struct {
	PodId     int64            `json:"podid"`
	Targeting []VideoTargeting `json:"targeting"`
	Errors    []string         `json:"errors"`
}

type BidRequestVideo

type BidRequestVideo struct {
	// Attribute:
	//   storedrequestid
	// Type:
	//   string; required
	// Description:
	//   Unique ID of the stored request
	StoredRequestId string `json:"storedrequestid"`

	// Attribute:
	//   podconfig
	// Type:
	//   object; required
	// Description:
	//   Container object for describing all the pod configurations
	PodConfig PodConfig `json:"podconfig"`

	// Attribute:
	//   app
	// Type:
	//   object; App or Site required
	// Description:
	//   Application where the impression will be shown
	App *openrtb.App `json:"app"`

	// Attribute:
	//   site
	// Type:
	//   object; App or Site required
	// Description:
	//   Site where the impression will be shown
	Site *openrtb.Site `json:"site"`

	// Attribute:
	//   user
	// Type:
	//   object; optional
	// Description:
	//   Container object for the user of of the actual device
	User SimplifiedUser `json:"user,omitempty"`

	// Attribute:
	//   device
	// Type:
	//   object; optional
	// Description:
	//   Device specific data
	Device openrtb.Device `json:"device,omitempty"`

	// Attribute:
	//   includebrandcategory
	// Type:
	//   object; optional
	// Description:
	//   Indicates that the response requires an adserver specific content category
	IncludeBrandCategory IncludeBrandCategory `json:"includebrandcategory"`

	// Attribute:
	//   video
	// Type:
	//   object; required
	// Description:
	//   Player container object
	Video SimplifiedVideo `json:"video,omitempty"`

	// Attribute:
	//   content
	// Type:
	//   object; optional
	// Description:
	//  Misc content meta data that can be used for targeting the adPod(s)
	Content openrtb.Content `json:"content,omitempty"`

	// Attribute:
	//   cacheconfig
	// Type:
	//   object; optional
	// Description:
	//  Container object for all Prebid Cache configs
	Cacheconfig Cacheconfig `json:"cacheconfig,omitempty"`

	// Attribute:
	//   test
	// Type:
	//   integer; default 0
	// Description:
	//    Indicator of test mode in which auctions are not billable,
	//    where 0 = live mode, 1 = test mode.
	Test int8 `json:"test,omitempty"`

	// Attribute:
	//   pricegranularity
	// Type:
	//   object; optional
	// Description:
	//    Object to tell ad server how much money the “bidder” demand is worth to you
	PriceGranularity PriceGranularity `json:"pricegranularity,omitempty"`

	// Attribute:
	//   tmax
	// Type:
	//   integer
	// Description:
	//    Maximum time in milliseconds the exchange allows for bids to
	//    be received including Internet latency to avoid timeout. This
	//    value supersedes any a priori guidance from the exchange.
	TMax int64 `json:"tmax,omitempty"`

	// Attribute:
	//   bcat
	// Type:
	//   string array
	// Description:
	//   Blocked advertiser categories using the IAB content
	//   categories. Refer to List 5.1.
	BCat []string `json:"bcat,omitempty"`

	// Attribute:
	//   badv
	// Type:
	//   string array
	// Description:
	//   Block list of advertisers by their domains (e.g., “ford.com”).
	BAdv []string `json:"badv,omitempty"`
}

type BidResponseVideo

type BidResponseVideo struct {
	AdPods []*AdPod        `json:"adPods"`
	Ext    json.RawMessage `json:"ext,omitempty"`
}

type BidType

type BidType string

BidType describes the allowed values for bidresponse.seatbid.bid[i].ext.prebid.type

func BidTypes

func BidTypes() []BidType

func ParseBidType

func ParseBidType(bidType string) (BidType, error)

type BidderName

type BidderName string

BidderName may refer to a bidder ID, or an Alias which is defined in the request.

const (
	Bidder33Across       BidderName = "33across"
	BidderAdkernel       BidderName = "adkernel"
	BidderAdkernelAdn    BidderName = "adkernelAdn"
	BidderAdtelligent    BidderName = "adtelligent"
	BidderAdform         BidderName = "adform"
	BidderAdvangelists   BidderName = "advangelists"
	BidderAppnexus       BidderName = "appnexus"
	BidderBeachfront     BidderName = "beachfront"
	BidderBrightroll     BidderName = "brightroll"
	BidderConsumable     BidderName = "consumable"
	BidderConversant     BidderName = "conversant"
	BidderEmxDigital     BidderName = "emx_digital"
	BidderEPlanning      BidderName = "eplanning"
	BidderFacebook       BidderName = "audienceNetwork"
	BidderGamoshi        BidderName = "gamoshi"
	BidderGrid           BidderName = "grid"
	BidderGumGum         BidderName = "gumgum"
	BidderImprovedigital BidderName = "improvedigital"
	BidderIx             BidderName = "ix"
	BidderLifestreet     BidderName = "lifestreet"
	BidderMgid           BidderName = "mgid"
	BidderOpenx          BidderName = "openx"
	BidderPubmatic       BidderName = "pubmatic"
	BidderPulsepoint     BidderName = "pulsepoint"
	BidderRhythmone      BidderName = "rhythmone"
	BidderRTBHouse       BidderName = "rtbhouse"
	BidderRubicon        BidderName = "rubicon"
	BidderSharethrough   BidderName = "sharethrough"
	BidderSomoaudience   BidderName = "somoaudience"
	BidderSovrn          BidderName = "sovrn"
	BidderSonobi         BidderName = "sonobi"
	BidderTriplelift     BidderName = "triplelift"
	BidderUnruly         BidderName = "unruly"
	BidderVerizonMedia   BidderName = "verizonmedia"
	BidderVrtcal         BidderName = "vrtcal"
	BidderYieldmo        BidderName = "yieldmo"
	BidderVisx           BidderName = "visx"
	BidderTappx          BidderName = "tappx"
)

These names _must_ coincide with the bidder code in Prebid.js, if an adapter also exists in that project. Please keep these (and the BidderMap) alphabetized to minimize merge conflicts among adapter submissions.

func BidderList

func BidderList() []BidderName

BidderList returns the values of the BidderMap

func (BidderName) MarshalJSON

func (name BidderName) MarshalJSON() ([]byte, error)

func (*BidderName) String

func (name *BidderName) String() string

type BidderParamValidator

type BidderParamValidator interface {
	Validate(name BidderName, ext json.RawMessage) error
	// Schema returns the JSON schema used to perform validation.
	Schema(name BidderName) string
}

The BidderParamValidator is used to enforce bidrequest.imp[i].ext.{anyBidder} values.

This is treated differently from the other types because we rely on JSON-schemas to validate bidder params.

func NewBidderParamsValidator

func NewBidderParamsValidator(schemaDirectory string) (BidderParamValidator, error)

NewBidderParamsValidator makes a BidderParamValidator, assuming all the necessary files exist in the filesystem. This will error if, for example, a Bidder gets added but no JSON schema is written for them.

type Cacheconfig

type Cacheconfig struct {
	// Attribute:
	//   ttl
	// Type:
	//   int; optional
	//  Time to Live for a cache entry specified in seconds
	Ttl int `json:"ttl"`
}

type CookieStatus

type CookieStatus string

CookieStatus describes the allowed values for bidresponse.ext.usersync.{bidder}.status

const (
	CookieNone      CookieStatus = "none"
	CookieExpired   CookieStatus = "expired"
	CookieAvailable CookieStatus = "available"
)

type ExtApp

type ExtApp struct {
	Prebid ExtAppPrebid `json:"prebid"`
}

ExtApp defines the contract for bidrequest.app.ext

type ExtAppPrebid

type ExtAppPrebid struct {
	Source  string `json:"source"`
	Version string `json:"version"`
}

ExtAppPrebid further defines the contract for bidrequest.app.ext.prebid. We are only enforcing that these two properties be strings if they are provided. They are optional with no current constraints on value, so we don't need a custom UnmarshalJSON() method at this time.

type ExtBid

type ExtBid struct {
	Prebid *ExtBidPrebid   `json:"prebid,omitempty"`
	Bidder json.RawMessage `json:"bidder,omitempty"`
}

ExtBid defines the contract for bidresponse.seatbid.bid[i].ext

type ExtBidPrebid

type ExtBidPrebid struct {
	Cache     *ExtBidPrebidCache `json:"cache,omitempty"`
	Targeting map[string]string  `json:"targeting,omitempty"`
	Type      BidType            `json:"type"`
	Video     *ExtBidPrebidVideo `json:"video,omitempty"`
}

ExtBidPrebid defines the contract for bidresponse.seatbid.bid[i].ext.prebid

type ExtBidPrebidCache

type ExtBidPrebidCache struct {
	Key string `json:"key"`
	Url string `json:"url"`
}

ExtBidPrebidCache defines the contract for bidresponse.seatbid.bid[i].ext.prebid.cache

type ExtBidPrebidVideo

type ExtBidPrebidVideo struct {
	Duration        int    `json:"duration"`
	PrimaryCategory string `json:"primary_category"`
}

ExtBidPrebidVideo defines the contract for bidresponse.seatbid.bid[i].ext.prebid.video

type ExtBidResponse

type ExtBidResponse struct {
	Debug *ExtResponseDebug `json:"debug,omitempty"`
	// Errors defines the contract for bidresponse.ext.errors
	Errors map[BidderName][]ExtBidderError `json:"errors,omitempty"`
	// ResponseTimeMillis defines the contract for bidresponse.ext.responsetimemillis
	ResponseTimeMillis map[BidderName]int `json:"responsetimemillis,omitempty"`
	// RequestTimeoutMillis returns the timeout used in the auction.
	// This is useful if the timeout is saved in the Stored Request on the server.
	// Clients can run one auction, and then use this to set better connection timeouts on future auction requests.
	RequestTimeoutMillis int64 `json:"tmaxrequest,omitempty"`
	// ResponseUserSync defines the contract for bidresponse.ext.usersync
	Usersync map[BidderName]*ExtResponseSyncData `json:"usersync,omitempty"`
}

ExtBidResponse defines the contract for bidresponse.ext

type ExtBidderError

type ExtBidderError struct {
	Code    int    `json:"code"`
	Message string `json:"message"`
}

ExtBidderError defines an error object to be returned, consiting of a machine readable error code, and a human readable error message string.

type ExtDevice

type ExtDevice struct {
	Prebid ExtDevicePrebid `json:"prebid"`
}

ExtDevice defines the contract for bidrequest.device.ext

type ExtDeviceInt

type ExtDeviceInt struct {
	MinWidthPerc  uint64 `json:"minwidtheperc"`
	MinHeightPerc uint64 `json:"minheightperc"`
}

func (*ExtDeviceInt) UnmarshalJSON

func (edi *ExtDeviceInt) UnmarshalJSON(b []byte) error

type ExtDevicePrebid

type ExtDevicePrebid struct {
	Interstitial *ExtDeviceInt `json:"interstitial"`
}

Pointer to interstitial so we do not force it to exist

type ExtHttpCall

type ExtHttpCall struct {
	Uri          string `json:"uri"`
	RequestBody  string `json:"requestbody"`
	ResponseBody string `json:"responsebody"`
	Status       int    `json:"status"`
}

ExtHttpCall defines the contract for a bidresponse.ext.debug.httpcalls.{bidder}[i]

type ExtImp

type ExtImp struct {
	Prebid     *ExtImpPrebid     `json:"prebid"`
	Appnexus   *ExtImpAppnexus   `json:"appnexus"`
	Consumable *ExtImpConsumable `json:"consumable"`
	Rubicon    *ExtImpRubicon    `json:"rubicon"`
	Adform     *ExtImpAdform     `json:"adform"`
	Rhythmone  *ExtImpRhythmone  `json:"rhythmone"`
	Unruly     *ExtImpUnruly     `json:"unruly"`
	EmxDigital *ExtImpEmxDigital `json:"emx_digital"`
}

ExtImp defines the contract for bidrequest.imp[i].ext

type ExtImp33across

type ExtImp33across struct {
	SiteId    string `json:"siteId"`
	ZoneId    string `json:"zoneId,omitempty"`
	ProductId string `json:"productId,omitempty"`
}

ExtImp33across defines the contract for bidrequest.imp[i].ext.33across

type ExtImpAdform

type ExtImpAdform struct {
	MasterTagId string `json:"mid"`
	PriceType   string `json:"priceType,omitempty"`
	KeyValues   string `json:"mkv,omitempty"`
	KeyWords    string `json:"mkw,omitempty"`
}

type ExtImpAdkernel

type ExtImpAdkernel struct {
	ZoneId int    `json:"zoneId"`
	Host   string `json:"host"`
}

ExtImpAdkernel defines the contract for bidrequest.imp[i].ext.adkernel

type ExtImpAdkernelAdn

type ExtImpAdkernelAdn struct {
	PublisherID int    `json:"pubId"`
	Host        string `json:"host,omitempty"`
}

ExtImpAdkernelAdn defines the contract for bidrequest.imp[i].ext.adkernelAdn

type ExtImpAdtelligent

type ExtImpAdtelligent struct {
	SourceId    int     `json:"aid"`
	PlacementId int     `json:"placementId,omitempty"`
	SiteId      int     `json:"siteId,omitempty"`
	BidFloor    float64 `json:"bidFloor,omitempty"`
}

ExtImpAdtelligent defines the contract for bidrequest.imp[i].ext.adtelligent

type ExtImpAdvangelists

type ExtImpAdvangelists struct {
	PublisherID string `json:"pubid"`
	Placement   string `json:"placement,omitempty"`
}

type ExtImpAppnexus

type ExtImpAppnexus struct {
	LegacyPlacementId       int                     `json:"placementId"`
	LegacyInvCode           string                  `json:"invCode"`
	LegacyTrafficSourceCode string                  `json:"trafficSourceCode"`
	PlacementId             int                     `json:"placement_id"`
	InvCode                 string                  `json:"inv_code"`
	Member                  string                  `json:"member"`
	Keywords                []*ExtImpAppnexusKeyVal `json:"keywords"`
	TrafficSourceCode       string                  `json:"traffic_source_code"`
	Reserve                 float64                 `json:"reserve"`
	Position                string                  `json:"position"`
	UsePmtRule              *bool                   `json:"use_pmt_rule"`
	// At this time we do no processing on the private sizes, so just leaving it as a JSON blob.
	PrivateSizes json.RawMessage `json:"private_sizes"`
}

ExtImpAppnexus defines the contract for bidrequest.imp[i].ext.appnexus

type ExtImpAppnexusKeyVal

type ExtImpAppnexusKeyVal struct {
	Key    string   `json:"key,omitempty"`
	Values []string `json:"value,omitempty"`
}

ExtImpAppnexusKeyVal defines the contract for bidrequest.imp[i].ext.appnexus.keywords[i]

type ExtImpBeachfront

type ExtImpBeachfront struct {
	AppId    string  `json:"appId"`
	BidFloor float64 `json:"bidfloor"`
}

type ExtImpBrightroll

type ExtImpBrightroll struct {
	Publisher string `json:"publisher"`
}

ExtImpBrightroll defines the contract for bidrequest.imp[i].ext.brightroll

type ExtImpConsumable

type ExtImpConsumable struct {
	NetworkId int `json:"networkId,omitempty"`
	SiteId    int `json:"siteId,omitempty"`
	UnitId    int `json:"unitId,omitempty"`
	/* UnitName gets used as a classname and in the URL when building the ad markup */
	UnitName string `json:"unitName,omitempty"`
}

ExtImpConsumable defines the contract for bidrequest.imp[i].ext.consumable

type ExtImpEPlanning

type ExtImpEPlanning struct {
	ClientID   string `json:"ci"`
	AdUnitCode string `json:"adunit_code"`
	SizeString string
}

ExtImpEPlanning defines the contract for bidrequest.imp[i].ext.eplanning

type ExtImpEmxDigital

type ExtImpEmxDigital struct {
	TagID    string `json:"tagid"`
	BidFloor string `json:"bidfloor,omitempty"`
}

type ExtImpGamoshi

type ExtImpGamoshi struct {
	SupplyPartnerId  string `json:"supplyPartnerId"`
	FavoredMediaType string `json:"favoredMediaType"`
}

ExtImpGamoshi defines the contract for bidrequest.imp[i].ext.gamoshi

type ExtImpGumGum

type ExtImpGumGum struct {
	Zone string `json:"zone"`
}

type ExtImpMgid

type ExtImpMgid struct {
	AccountId   string  `json:"accountId"`
	PlacementId string  `json:"placementId,omitempty"`
	Cur         string  `json:"cur"`
	Currency    string  `json:"currency"`
	BidFloor    float64 `json:"bidfloor"`
	BidFloor2   float64 `json:"bidFloor"`
}

ExtImpMgid defines the contract for bidrequest.imp[i].ext.mgid

type ExtImpOpenx

type ExtImpOpenx struct {
	Unit         string                 `json:"unit"`
	DelDomain    string                 `json:"delDomain"`
	CustomFloor  float64                `json:"customFloor"`
	CustomParams map[string]interface{} `json:"customParams"`
}

ExtImpOpenx defines the contract for bidrequest.imp[i].ext.openx

type ExtImpPrebid

type ExtImpPrebid struct {
	StoredRequest *ExtStoredRequest `json:"storedrequest"`

	// NOTE: This is not part of the official API, we are not expecting clients
	// migrate from imp[...].ext.${BIDDER} to imp[...].ext.prebid.bidder.${BIDDER}
	// at this time
	// https://github.com/prebid/prebid-server/pull/846#issuecomment-476352224
	Bidder map[string]json.RawMessage `json:"bidder"`
}

ExtImpPrebid defines the contract for bidrequest.imp[i].ext.prebid

type ExtImpPubmatic

type ExtImpPubmatic struct {
	PublisherId string                  `json:"publisherId"`
	AdSlot      string                  `json:"adSlot"`
	WrapExt     json.RawMessage         `json:"wrapper,omitempty"`
	Keywords    []*ExtImpPubmaticKeyVal `json:"keywords,omitempty"`
}

type ExtImpPubmaticKeyVal

type ExtImpPubmaticKeyVal struct {
	Key    string   `json:"key,omitempty"`
	Values []string `json:"value,omitempty"`
}

ExtImpPubmaticKeyVal defines the contract for bidrequest.imp[i].ext.pubmatic.keywords[i]

type ExtImpRhythmone

type ExtImpRhythmone struct {
	PlacementId string `json:"placementId"`
	Zone        string `json:"zone"`
	Path        string `json:"path"`
	S2S         bool
}

ExtImpRhythmone defines the contract for bidrequest.imp[i].ext.rhythmone

type ExtImpRubicon

type ExtImpRubicon struct {
	AccountId int                `json:"accountId"`
	SiteId    int                `json:"siteId"`
	ZoneId    int                `json:"zoneId"`
	Inventory json.RawMessage    `json:"inventory,omitempty"`
	Visitor   json.RawMessage    `json:"visitor,omitempty"`
	Video     rubiconVideoParams `json:"video"`
}

ExtImpRubicon defines the contract for bidrequest.imp[i].ext.rubicon

type ExtImpSharethrough

type ExtImpSharethrough struct {
	PlacementKey string `json:"pkey"`
	Iframe       bool   `json:"iframe"`
}

type ExtImpSharethroughCreative

type ExtImpSharethroughCreative struct {
	AuctionWinID string                             `json:"auctionWinId"`
	CPM          float64                            `json:"cpm"`
	Metadata     ExtImpSharethroughCreativeMetadata `json:"creative"`
	Version      int                                `json:"version"`
}

type ExtImpSharethroughCreativeBeacons

type ExtImpSharethroughCreativeBeacons struct {
	Click           []string `json:"click"`
	Impression      []string `json:"impression"`
	Play            []string `json:"play"`
	Visible         []string `json:"visible"`
	WinNotification []string `json:"win-notification"`
}

type ExtImpSharethroughCreativeMetadata

type ExtImpSharethroughCreativeMetadata struct {
	Action                 string                            `json:"action"`
	Advertiser             string                            `json:"advertiser"`
	AdvertiserKey          string                            `json:"advertiser_key"`
	Beacons                ExtImpSharethroughCreativeBeacons `json:"beacons"`
	BrandLogoURL           string                            `json:"brand_logo_url"`
	CampaignKey            string                            `json:"campaign_key"`
	CreativeKey            string                            `json:"creative_key"`
	CustomEngagementAction string                            `json:"custom_engagement_action"`
	CustomEngagementLabel  string                            `json:"custom_engagement_label"`
	CustomEngagementURL    string                            `json:"custom_engagement_url"`
	DealID                 string                            `json:"deal_id"`
	Description            string                            `json:"description"`
	ForceClickToPlay       bool                              `json:"force_click_to_play"`
	IconURL                string                            `json:"icon_url"`
	ImpressionHTML         string                            `json:"impression_html"`
	InstantPlayMobileCount int                               `json:"instant_play_mobile_count"`
	InstantPlayMobileURL   string                            `json:"instant_play_mobile_url"`
	MediaURL               string                            `json:"media_url"`
	ShareURL               string                            `json:"share_url"`
	SourceID               string                            `json:"source_id"`
	ThumbnailURL           string                            `json:"thumbnail_url"`
	Title                  string                            `json:"title"`
	VariantKey             string                            `json:"variant_key"`
}

type ExtImpSharethroughExt

type ExtImpSharethroughExt struct {
	Pkey       string `json:"pkey"`
	Iframe     bool   `json:"iframe"`
	IframeSize []int  `json:"iframeSize"`
}

type ExtImpSharethroughPlacement

type ExtImpSharethroughPlacement struct {
	AllowInstantPlay      bool                                  `json:"allow_instant_play"`
	ArticlesBeforeFirstAd int                                   `json:"articles_before_first_ad"`
	ArticlesBetweenAds    int                                   `json:"articles_between_ads"`
	Layout                string                                `json:"layout"`
	Metadata              json.RawMessage                       `json:"metadata"`
	PlacementAttributes   ExtImpSharethroughPlacementAttributes `json:"placementAttributes"`
	Status                string                                `json:"status"`
}

type ExtImpSharethroughPlacementAttributes

type ExtImpSharethroughPlacementAttributes struct {
	AdServerKey              string                                         `json:"ad_server_key"`
	AdServerPath             string                                         `json:"ad_server_path"`
	AllowDynamicCropping     bool                                           `json:"allow_dynamic_cropping"`
	AppThirdPartyPartners    []string                                       `json:"app_third_party_partners"`
	CustomCardCSS            string                                         `json:"custom_card_css"`
	DFPPath                  string                                         `json:"dfp_path"`
	DirectSellPromotedByText string                                         `json:"direct_sell_promoted_by_text"`
	Domain                   string                                         `json:"domain"`
	EnableLinkRedirection    bool                                           `json:"enable_link_redirection"`
	FeaturedContent          json.RawMessage                                `json:"featured_content"`
	MaxHeadlineLength        int                                            `json:"max_headline_length"`
	MultiAdPlacement         bool                                           `json:"multi_ad_placement"`
	PromotedByText           string                                         `json:"promoted_by_text"`
	PublisherKey             string                                         `json:"publisher_key"`
	RenderingPixelOffset     int                                            `json:"rendering_pixel_offset"`
	SafeFrameSize            []int                                          `json:"safe_frame_size"`
	SiteKey                  string                                         `json:"site_key"`
	StrOptOutURL             string                                         `json:"str_opt_out_url"`
	Template                 string                                         `json:"template"`
	ThirdPartyPartners       []ExtImpSharethroughPlacementThirdPartyPartner `json:"third_party_partners"`
}

type ExtImpSharethroughPlacementThirdPartyPartner

type ExtImpSharethroughPlacementThirdPartyPartner struct {
	Key string `json:"key"`
	Tag string `json:"tag"`
}

type ExtImpSharethroughResponse

type ExtImpSharethroughResponse struct {
	AdServerRequestID string                       `json:"adserverRequestId"`
	BidID             string                       `json:"bidId"`
	CookieSyncUrls    []string                     `json:"cookieSyncUrls"`
	Creatives         []ExtImpSharethroughCreative `json:"creatives"`
	Placement         ExtImpSharethroughPlacement  `json:"placement"`
	StxUserID         string                       `json:"stxUserId"`
}

ExtImpSharethrough defines the contract for bidrequest.imp[i].ext.sharethrough

type ExtImpSomoaudience

type ExtImpSomoaudience struct {
	PlacementHash string  `json:"placement_hash"`
	BidFloor      float64 `json:"bid_floor,omitempty"`
}

type ExtImpSonobi

type ExtImpSonobi struct {
	TagID string `json:"tagid"`
}

type ExtImpSovrn

type ExtImpSovrn struct {
	TagId    string  `json:"tagId,omitempty"`
	Tagid    string  `json:"tagid,omitempty"`
	BidFloor float64 `json:"bidfloor"`
}

type ExtImpTappx

type ExtImpTappx struct {
	Host     string `json:"host"`
	TappxKey string `json:"tappxkey"`
	Endpoint string `json:"endpoint"`
}

type ExtImpTriplelift

type ExtImpTriplelift struct {
	InvCode string   `json:"inventoryCode"`
	Floor   *float64 `json:"floor"`
}

ExtImpTriplelift defines the contract for bidrequest.imp[i].ext.triplelift

type ExtImpUnruly

type ExtImpUnruly struct {
	UUID   string `json:"uuid"`
	SiteID string `json:"siteid"`
}

type ExtImpVerizonMedia

type ExtImpVerizonMedia struct {
	Dcn string `json:"dcn"`
	Pos string `json:"pos"`
}

ExtImpVerizonMedia defines the contract for bidrequest.imp[i].ext.verizonmedia

type ExtImpVrtcal

type ExtImpVrtcal struct {
	Just_an_unused_vrtcal_param string `json:"Just_an_unused_vrtcal_param"`
}

ExtImpVrtcal defines the contract for bidrequest.imp[i].ext.vrtcal

type ExtImpYieldmo

type ExtImpYieldmo struct {
	PlacementId string `json:"placementId"`
}

ExtImpYieldmo defines the contract for bidrequest.imp[i].ext.yieldmo

type ExtIncludeBrandCategory

type ExtIncludeBrandCategory struct {
	PrimaryAdServer int    `json:"primaryadserver"`
	Publisher       string `json:"publisher"`
}

type ExtPublisher

type ExtPublisher struct {

	// parentAccount would define the legal entity (publisher owner or network) that has the direct relationship with the PBS
	// host. As such, the definition depends on the PBS hosting entity.
	ParentAccount *string `json:"parentAccount,omitempty"`
}

ExtPublisher defines the contract for ...publisher.ext (found in both bidrequest.site and bidrequest.app)

type ExtRegs

type ExtRegs struct {

	// GDPR should be "1" if the caller believes the user is subject to GDPR laws, "0" if not, and undefined
	// if it's unknown. For more info on this parameter, see: https://iabtechlab.com/wp-content/uploads/2018/02/OpenRTB_Advisory_GDPR_2018-02.pdf
	GDPR *int8 `json:"gdpr,omitempty"`
}

ExtRegs defines the contract for bidrequest.regs.ext

type ExtRequest

type ExtRequest struct {
	Prebid ExtRequestPrebid `json:"prebid"`
}

ExtRequest defines the contract for bidrequest.ext

type ExtRequestPrebid

type ExtRequestPrebid struct {
	Aliases              map[string]string      `json:"aliases,omitempty"`
	BidAdjustmentFactors map[string]float64     `json:"bidadjustmentfactors,omitempty"`
	Cache                *ExtRequestPrebidCache `json:"cache,omitempty"`
	StoredRequest        *ExtStoredRequest      `json:"storedrequest,omitempty"`
	Targeting            *ExtRequestTargeting   `json:"targeting,omitempty"`
}

ExtRequestPrebid defines the contract for bidrequest.ext.prebid

type ExtRequestPrebidCache

type ExtRequestPrebidCache struct {
	Bids    *ExtRequestPrebidCacheBids `json:"bids"`
	VastXML *ExtRequestPrebidCacheVAST `json:"vastxml"`
}

ExtRequestPrebidCache defines the contract for bidrequest.ext.prebid.cache

func (*ExtRequestPrebidCache) UnmarshalJSON

func (ert *ExtRequestPrebidCache) UnmarshalJSON(b []byte) error

UnmarshalJSON prevents nil bids arguments.

type ExtRequestPrebidCacheBids

type ExtRequestPrebidCacheBids struct{}

ExtRequestPrebidCacheBids defines the contract for bidrequest.ext.prebid.cache.bids

type ExtRequestPrebidCacheVAST

type ExtRequestPrebidCacheVAST struct{}

ExtRequestPrebidCacheVAST defines the contract for bidrequest.ext.prebid.cache.vastxml

type ExtRequestTargeting

type ExtRequestTargeting struct {
	PriceGranularity     PriceGranularity        `json:"pricegranularity"`
	IncludeWinners       bool                    `json:"includewinners"`
	IncludeBidderKeys    bool                    `json:"includebidderkeys"`
	IncludeBrandCategory ExtIncludeBrandCategory `json:"includebrandcategory"`
	DurationRangeSec     []int                   `json:"durationrangesec"`
}

ExtRequestTargeting defines the contract for bidrequest.ext.prebid.targeting

func (*ExtRequestTargeting) UnmarshalJSON

func (ert *ExtRequestTargeting) UnmarshalJSON(b []byte) error

Make an unmarshaller that will set a default PriceGranularity

type ExtResponseDebug

type ExtResponseDebug struct {
	// HttpCalls defines the contract for bidresponse.ext.debug.httpcalls
	HttpCalls map[BidderName][]*ExtHttpCall `json:"httpcalls,omitempty"`
	// Request after resolution of stored requests and debug overrides
	ResolvedRequest *openrtb.BidRequest `json:"resolvedrequest,omitempty"`
}

ExtResponseDebug defines the contract for bidresponse.ext.debug

type ExtResponseSyncData

type ExtResponseSyncData struct {
	Status CookieStatus `json:"status"`
	// Syncs must have length > 0
	Syncs []*ExtUserSync `json:"syncs"`
}

ExtResponseSyncData defines the contract for bidresponse.ext.usersync.{bidder}

type ExtSite

type ExtSite struct {
	// AMP should be 1 if the request comes from an AMP page, and 0 if not.
	AMP int8 `json:"amp"`
}

ExtSite defines the contract for bidrequest.site.ext

func (*ExtSite) UnmarshalJSON

func (es *ExtSite) UnmarshalJSON(b []byte) error

type ExtStoredRequest

type ExtStoredRequest struct {
	ID string `json:"id"`
}

ExtStoredRequest defines the contract for bidrequest.imp[i].ext.prebid.storedrequest

type ExtUser

type ExtUser struct {
	// Consent is a GDPR consent string. See "Advised Extensions" of
	// https://iabtechlab.com/wp-content/uploads/2018/02/OpenRTB_Advisory_GDPR_2018-02.pdf
	Consent string `json:"consent,omitempty"`

	Prebid *ExtUserPrebid `json:"prebid,omitempty"`

	// DigiTrust breaks the typical Prebid Server convention of namespacing "global" options inside "ext.prebid.*"
	// to match the recommendation from the broader digitrust community.
	// For more info, see: https://github.com/digi-trust/dt-cdn/wiki/OpenRTB-extension#openrtb-2x
	DigiTrust *ExtUserDigiTrust `json:"digitrust,omitempty"`

	Eids []ExtUserEid `json:"eids,omitempty"`
}

ExtUser defines the contract for bidrequest.user.ext

type ExtUserDigiTrust

type ExtUserDigiTrust struct {
	ID   string `json:"id"`   // Unique device identifier
	KeyV int    `json:"keyv"` // Key version used to encrypt ID
	Pref int    `json:"pref"` // User optout preference
}

ExtUserDigiTrust defines the contract for bidrequest.user.ext.digitrust More info on DigiTrust can be found here: https://github.com/digi-trust/dt-cdn/wiki/Integration-Guide

type ExtUserEid

type ExtUserEid struct {
	Source string          `json:"source"`
	ID     string          `json:"id,omitempty"`
	Uids   []ExtUserEidUid `json:"uids,omitempty"`
}

ExtUserEid defines the contract for bidrequest.user.ext.eids Responsible for the Universal User ID support: establishing pseudonymous IDs for users. See https://github.com/prebid/Prebid.js/issues/3900 for details.

type ExtUserEidUid

type ExtUserEidUid struct {
	ID  string            `json:"id"`
	Ext *ExtUserEidUidExt `json:"ext,omitempty"`
}

ExtUserEidUid defines the contract for bidrequest.user.ext.eids[i].uids[j]

type ExtUserEidUidExt

type ExtUserEidUidExt struct {
	RtiPartner string `json:"rtiPartner,omitempty"`
}

ExtUserEidUidExt defines the contract for bidrequest.user.ext.eids[i].uids[j].ext

type ExtUserPrebid

type ExtUserPrebid struct {
	BuyerUIDs map[string]string `json:"buyeruids,omitempty"`
}

ExtUserPrebid defines the contract for bidrequest.user.ext.prebid

type ExtUserSync

type ExtUserSync struct {
	Url  string       `json:"url"`
	Type UserSyncType `json:"type"`
}

ExtUserSync defines the contract for bidresponse.ext.usersync.{bidder}.syncs[i]

type Gdpr

type Gdpr struct {
	// Attribute:
	//   consentrequired
	// Type:
	//   boolean; optional
	//  Indicates whether GDPR is in effect
	ConsentRequired bool `json:"consentrequired"`

	// Attribute:
	//   consentstring
	// Type:
	//   string; optional
	//  Contains the data structure developed by the GDPR
	ConsentString string `json:"consentstring"`
}

type GranularityRange

type GranularityRange struct {
	Min       float64 `json:"min"`
	Max       float64 `json:"max"`
	Increment float64 `json:"increment"`
}

GranularityRange struct defines a range of prices used by PriceGranularity

type IncludeBrandCategory

type IncludeBrandCategory struct {
	// Attribute:
	//   primaryadserver
	// Type:
	//   int; optional
	//  The ad server used by the publisher. Supported Values 1- Freewheel , 2- DFP
	PrimaryAdserver int `json:"primaryadserver"`

	// Attribute:
	//   publisher
	// Type:
	//   string; optional
	//  Identifier for the Publisher
	Publisher string `json:"publisher"`
}

type Pod

type Pod struct {
	// Attribute:
	//   podid
	// Type:
	//   integer; required
	//  Unique id of the pod within a particular request.
	PodId int `json:"podid"`

	// Attribute:
	//   adpoddurationsec
	// Type:
	//   integer; required
	//  Duration of the adPod
	AdPodDurationSec int `json:"adpoddurationsec"`

	// Attribute:
	//   configid
	// Type:
	//   string; required
	//  ID of the stored config that corresponds to a single pod request
	ConfigId string `json:"configid"`
}

type PodConfig

type PodConfig struct {
	// Attribute:
	//   durationrangesec
	// Type:
	//  int array, required
	// Description:
	//  Range of ad durations allowed in the response
	DurationRangeSec []int `json:"durationrangesec"`

	// Attribute:
	//   requireexactduration
	// Type:
	//   boolean, optional
	//  Flag indicating exact ad duration requirement. Default is false.
	RequireExactDuration bool `json:"requireexactduration,omitempty"`

	// Attribute:
	//   pods
	// Type:
	//   object; required
	//  Container object for describing the adPod(s) to be requested.
	Pods []Pod `json:"pods"`
}

type PriceGranularity

type PriceGranularity struct {
	Precision int                `json:"precision,omitempty"`
	Ranges    []GranularityRange `json:"ranges,omitempty"`
}

PriceGranularity defines the allowed values for bidrequest.ext.prebid.targeting.pricegranularity

func PriceGranularityFromString

func PriceGranularityFromString(gran string) PriceGranularity

PriceGranularityFromString converts a legacy string into the new PriceGranularity

func (*PriceGranularity) UnmarshalJSON

func (pg *PriceGranularity) UnmarshalJSON(b []byte) error

UnmarshalJSON : custom unmarshaller to handle legacy string granularites.

type PriceGranularityRaw

type PriceGranularityRaw PriceGranularity

type SimplifiedUser

type SimplifiedUser struct {
	// Attribute:
	//   buyeruids
	// Type:
	//   map; optional
	//  ID of the stored config that corresponds to a single pod request
	Buyeruids map[string]string `json:"buyeruids"`

	// Attribute:
	//   gdpr
	// Type:
	//   object; optional
	//  Container object for GDPR
	Gdpr Gdpr `json:"gdpr"`

	// Attribute:
	//   yob
	// Type:
	//   int; optional
	//  Year of birth as a 4-digit integer
	Yob int64 `json:"yob"`

	// Attribute:
	//   gender
	// Type:
	//   string; optional
	//  Gender, where “M” = male, “F” = female, “O” = known to be other
	Gender string `json:"gender"`

	// Attribute:
	//   keywords
	// Type:
	//   string; optional
	//  Comma separated list of keywords, interests, or intent.
	Keywords string `json:"keywords"`
}

type SimplifiedVideo

type SimplifiedVideo struct {
	// Attribute:
	//   w
	// Type:
	//   uint64; optional
	//  Width of video
	W uint64 `json:"w"`

	// Attribute:
	//   h
	// Type:
	//   uint64; optional
	//  Height of video
	H uint64 `json:"h"`

	// Attribute:
	//   mimes
	// Type:
	//   array of strings; optional
	//  Video mime types
	Mimes []string `json:"mimes"`

	// Attribute:
	//   protocols
	// Type:
	//   array of objects; optional
	//  protocols
	Protocols []openrtb.Protocol `json:"protocols"`
}

type TargetingKey

type TargetingKey string

TargetingKeys are used throughout Prebid as keys which can be used in an ad server like DFP. Clients set the values we assign on the request to the ad server, where they can be substituted like macros into Creatives.

Removing one of these, or changing the semantics of what we store there, will probably break the line item setups for many publishers.

These are especially important to Prebid Mobile. It's much more cumbersome for a Mobile App to update code than it is for a website. As a result, they rely heavily on these targeting keys so that any changes can be made on Prebid Server and the Ad Server's line items.

func (TargetingKey) BidderKey

func (key TargetingKey) BidderKey(bidder BidderName, maxLength int) string

type UserSyncType

type UserSyncType string

UserSyncType describes the allowed values for bidresponse.ext.usersync.{bidder}.syncs[i].type

const (
	UserSyncIframe UserSyncType = "iframe"
	UserSyncPixel  UserSyncType = "pixel"
)

type VideoTargeting

type VideoTargeting struct {
	HbPb       string `json:"hb_pb"`
	HbPbCatDur string `json:"hb_pb_cat_dur"`
	HbCacheID  string `json:"hb_cache_id"`
}

Jump to

Keyboard shortcuts

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