Documentation ¶
Index ¶
- Constants
- func FloatPointer(f float64) *float64
- func IntPointer(i int) *int
- type APS
- type APSs
- type App
- type Banner
- type Banners
- type Data
- type Datas
- type Device
- type DeviceExt
- type EID
- type EIDS
- type FacebookTestAdType
- type Format
- type Formats
- type Geo
- type IdentityExt
- type Imp
- type ImpExt
- type Imps
- type Ints
- type Native
- type Publisher
- type Regs
- type RegsExt
- type Request
- type RequestExt
- type Segment
- type Segments
- type Skadn
- type Source
- type SourceExt
- type Strings
- type UID
- type UIDS
- type User
- type UserExt
- type Video
- type VideoExt
Constants ¶
const ( VideoLandscapeAppInstall46Seconds FacebookTestAdType = "VID_HD_16_9_46S_APP_INSTALL" VideoLandscapeLink46Seconds = "VID_HD_16_9_46S_LINK" VideoLandscapeAppInstall15Seconds = "VID_HD_16_9_15S_APP_INSTALL" VideoLandscapeLink15Seconds = "VID_HD_16_9_15S_LINK" VideoPortraitAppInstall39Seconds = "VID_HD_9_16_39S_APP_INSTALL" VideoPortraitLink39Seconds = "VID_HD_9_16_39S_LINK" ImageLandscapeAppInstall = "IMG_16_9_APP_INSTALL" ImageLandscapeLink = "IMG_16_9_LINK" CarouselImageAppInstall = "CAROUSEL_IMG_SQUARE_APP_INSTALL" CarouselImageLink = "CAROUSEL_IMG_SQUARE_LINK" )
below are constants that can used to change the ad demo type in the Facebook response for more information on the details of each demo type and requirements see the Facebook documentation in the below link https://developers.facebook.com/docs/audience-network/overview/in-house-mediation/server-to-server/testing
const ( Header = "x-openrtb-version" Version = "2.5" EncodingHeader = "Content-Encoding" EncodingValue = "gzip" )
Header required in RTB requests
Variables ¶
This section is empty.
Functions ¶
func FloatPointer ¶
FloatPointer is a utility function to return a reference of a float64
func IntPointer ¶
IntPointer is a utility function to return a reference of a int
Types ¶
type APS ¶
type APS struct { AmznB []string `json:"amzn_b" valid:"optional"` AmznVid []string `json:"amzn_vid" valid:"optional"` AmznH []string `json:"amzn_h" valid:"optional"` Amznp []string `json:"amznp" valid:"optional"` Amznrdr []string `json:"amznrdr" valid:"optional"` Amznslots []string `json:"amznslots" valid:"optional"` Dc []string `json:"dc" valid:"optional"` }
APS is the response Object the APS sdk generates
func (*APS) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
func (*APS) UnmarshalJSON ¶
UnmarshalJSON handles mixed content from APS SDK, this silently fails so that Nimbus's auctions are uneffected if APS changes the data structures underneath
type App ¶
type App struct { Name string `json:"name" valid:"required"` Bundle string `json:"bundle" valid:"required"` Domain string `json:"domain" valid:"required"` StoreURL string `json:"storeurl" valid:"required"` Cat []string `json:"cat,omitempty" valid:"optional"` SectionCat []string `json:"sectioncat,omitempty" valid:"optional"` PageCat []string `json:"pagecat,omitempty" valid:"optional"` Ver string `json:"ver,omitempty" valid:"optional"` PrivacyPolicy int `json:"privacypolicy" valid:"range(0|1),optional"` // no policy 0 policy 1 Paid int `json:"paid" valid:"range(0|1),optional"` // free 0 paid 1 Publisher Publisher `json:"publisher" valid:"required"` }
App object should be included if the ad supported content is a non-browser application (typically in mobile) as opposed to a website. A bid request must not contain both an App and a Site object. At a minimum, it is useful to provide an App ID or bundle, but this is not strictly required
func (*App) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Banner ¶
type Banner struct { BidFloor *float64 `json:"bidfloor,omitempty" valid:"optional"` BAttr []int `json:"battr,omitempty" valid:"optional"` Format []Format `json:"format,omitempty" valid:"optional"` W int `json:"w" valid:"required"` H int `json:"h" valid:"required"` API []int `json:"api,omitempty" valid:"inintarr(1|2|3|4|5|6|7),optional"` // 3,5,6 -> mraid1, 2, and 3 Pos int `json:"pos,omitempty" valid:"range(0|7),optional"` // 0,1,2,3,4,5,6,7 -> Unknown, Above the Fold, DEPRECATED - May or may not be initially visible depending on screen size/resolution.,Below the Fold,Header,Footer,Sidebar,Full Screen Vcm int `json:"vcm,omitempty" valid:"optional"` // Relevant only for Banner objects used with a Video object (Section 3.2.7) in an array of companion ads. Indicates the companion banner rendering mode relative to the associated video, where 0 = concurrent, 1 = end-card. }
Banner represents the most general type of impression. Although the term “banner” may have very specific meaning in other contexts, here it can be many things including a simple static image, an expandable ad unit, or even in-banner video (refer to the Video object in Section 3.2.4 for the more generalized and full featured video ad units). An array of Banner objects can also appear within the Video to describe optional companion ads defined in the VAST specification.
func (*Banner) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Banners ¶
type Banners []Banner
Banners ...
func (Banners) MarshalJSONArray ¶
MarshalJSONArray ...
type Data ¶
type Data struct { ID string `json:"id,omitempty" valid:"optional"` Name string `json:"name,omitempty" valid:"optional"` Segment []Segment `json:"segment,omitempty" valid:"optional"` }
Data and Segment objects together allow additional data about the user to be specified. This data may be from multiple sources whether from the exchange itself or third party providers as specified by the id field. A bid request can mix data objects from multiple providers. The specific data providers in use should be published by the exchange a priori to its bidders.
func (*Data) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Device ¶
type Device struct { Ua string `json:"ua" valid:"required"` Geo *Geo `json:"geo,omitempty" valid:"optional"` Dnt int `json:"dnt" valid:"range(0|1),optional"` // 0 = tracking is unrestricted, 1 = tracking is restricted Lmt int `json:"lmt" valid:"range(0|1),optional"` // 0 = tracking is unrestricted, 1 = tracking must be limited by commercial guidelines IP string `json:"ip" valid:"ipv4,optional"` DeviceType int `json:"devicetype,omitempty" valid:"required"` Make string `json:"make,omitempty" valid:"optional"` Model string `json:"model,omitempty" valid:"optional"` HWV string `json:"hwv,omitempty" valid:"optional"` OS string `json:"os,omitempty" valid:"in(android|ios),required"` OSV string `json:"osv,omitempty" valid:"optional"` H int `json:"h,omitempty" valid:"optional"` W int `json:"w,omitempty" valid:"optional"` Language string `json:"language,omitempty" valid:"optional"` Carrier string `json:"carrier,omitempty" valid:"optional"` ConnectionType int `json:"connectiontype,omitempty" valid:"optional"` Ifa string `json:"ifa" valid:"required"` Ext *DeviceExt `json:"ext,omitempty" valid:"optional"` }
Device object provides information pertaining to the device through which the user is interacting. Device information includes its hardware, platform, location, and carrier data. The device can refer to a mobile handset, a desktop computer, set top box, or other digital device.
func (*Device) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type DeviceExt ¶
type DeviceExt struct { Atts int `json:"atts" valid:"optional"` Ifv string `json:"ifv" valid:"optional"` }
DeviceExt adds extended in IAB support SKAdNetwork. If the IDFA is not available, DSPs require an alternative, limited-scope identifier in order to provide basic frequency capping functionality to advertisers. The IDFV is the same for apps from the same vendor but different across vendors. Please refer to Apple's Guidelines for further information about when it can be accessed and used. DSPs may also want to understand what is the status of a user on iOS 14+. The atts field will pass the AppTrackingTransparency Framework's authorization status.
func (*DeviceExt) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type EID ¶
EID is a higher level wrapper for vendor identifiers
func (*EID) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type EIDS ¶
type EIDS []EID
EIDS defines a slice of EID
func (EIDS) MarshalJSONArray ¶
MarshalJSONArray ...
type FacebookTestAdType ¶
type FacebookTestAdType string
type Format ¶
Format object represents an allowed size (i.e., height and width combination) for a banner impression. These are typically used in an array for an impression where multiple sizes are permitted.
func (*Format) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Formats ¶
type Formats []Format
Formats ...
func (Formats) MarshalJSONArray ¶
MarshalJSONArray ...
type Geo ¶
type Geo struct { Lat float64 `json:"lat,omitempty" valid:"required"` Lon float64 `json:"lon,omitempty" valid:"required"` Type int `json:"type,omitempty" valid:"range(1|3),optional"` // 1,2,3 -> GPS/Location Services, IP Address, User provided (e.g., registration data) IPService int `json:"ipservice,omitempty" valid:"range(1|4),optional"` // 1,2,3,4 -> ip2location, Neustar (Quova), MaxMind, NetAcuity (Digital Element) Country string `json:"country,omitempty" valid:"ISO3166Alpha3,optional"` // alpha 3 City string `json:"city,omitempty" valid:"optional"` Metro string `json:"metro,omitempty" valid:"optional"` State string `json:"state,omitempty" valid:"optional"` }
Geo object encapsulates various methods for specifying a geographic location. When subordinate to a Device object, it indicates the location of the device which can also be interpreted as the user’s current location. When subordinate to a User object, it indicates the location of the user’s home base (i.e., not necessarily their current location).
func (*Geo) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type IdentityExt ¶
type IdentityExt struct {
RTIPartner string `json:"rtiPartner"`
}
func (*IdentityExt) MarshalJSONObject ¶
func (i *IdentityExt) MarshalJSONObject(enc *gojay.Encoder)
MarshalJSONObject implements MarshalerJSONObject
func (*IdentityExt) NKeys ¶
func (i *IdentityExt) NKeys() int
NKeys returns the number of keys to unmarshal, by returning 0 we are saying to return all keys for marshalling
func (*IdentityExt) UnmarshalJSONObject ¶
func (i *IdentityExt) UnmarshalJSONObject(dec *gojay.Decoder, k string) error
UnmarshalJSONObject implements gojay's UnmarshalerJSONObject
type Imp ¶
type Imp struct { ID string `json:"id,omitempty" valid:"optional"` Banner *Banner `json:"banner,omitempty" valid:"optional"` Video *Video `json:"video,omitempty" valid:"optional"` Native *Native `json:"native,omitempty" valid:"optional"` Instl int `json:"instl" valid:"range(0|1),optional"` // 0 = not interstitial, 1 = interstitial BidFloor float64 `json:"bidfloor" valid:"optional"` Secure *int `json:"secure" valid:"range(0|1),optional"` Ext *ImpExt `json:"ext,omitempty" valid:"optional"` }
Imp describes an ad placement or impression being auctioned. A single bid request can include multiple Imp objects, a use case for which might be an exchange that supports selling all ad positions on a given page. Each Imp object has a required ID so that bids can reference them individually.
func (*Imp) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type ImpExt ¶
type ImpExt struct { APS []APS `json:"aps,omitempty" valid:"optional"` FacebookAppID string `json:"facebook_app_id,omitempty" valid:"optional"` FacebookTestAdType FacebookTestAdType `json:"facebook_test_ad_type,omitempty" valid:"optional"` // used of facebook test ads are to be returned https://developers.facebook.com/docs/audience-network/overview/in-house-mediation/server-to-server/testing Position string `json:"position,omitempty" valid:"required"` // flexible optional field for publishers to track on ad position performance Skadn *Skadn `json:"skadn" valid:"optional"` }
ImpExt ...
func (*ImpExt) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Ints ¶
type Ints []int
Ints ...
func (Ints) MarshalJSONArray ¶
MarshalJSONArray encodes arrays into JSON
type Native ¶
type Native struct { ID string `json:"id,omitempty" valid:"optional"` BidFloor *float64 `json:"bidfloor,omitempty" valid:"optional"` Request string `json:"request,omitempty" valid:"required"` Ver string `json:"ver,omitempty" valid:"optional"` API []int `json:"api,omitempty" valid:"optional"` Battr []int `json:"battr,omitempty" valid:"optional"` }
Native object represents a native type impression. Native ad units are intended to blend seamlessly into the surrounding content (e.g., a sponsored Twitter or Facebook post). As such, the response must be well-structured to afford the publisher fine-grained control over rendering.
func (*Native) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Publisher ¶
type Publisher struct { Name string `json:"name" valid:"required"` Cat []string `json:"cat,omitempty" valid:"optional"` Domain string `json:"domain" valid:"required"` }
Publisher object describes the publisher of the media in which the ad will be displayed. The publisher is typically the seller in an OpenRTB transaction.
func (*Publisher) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Regs ¶
type Regs struct { Coppa int `json:"coppa" valid:"range(0|1),optional"` Ext *RegsExt `json:"ext" valid:"optional"` }
Regs object contains any legal, governmental, or industry regulations that apply to the request. The coppa flag signals whether or not the request falls under the United States Federal Trade Commission’s regulations for the United States Children’s Online Privacy Protection Act (“COPPA”).
func (*Regs) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type RegsExt ¶
type RegsExt struct { GDPR int `json:"gdpr" valid:"range(0|1),optional"` USPrivacy string `json:"us_privacy,omitempty" valid:"optional"` GPP string `json:"gpp,omitempty" valid:"optional"` GPPSIDs string `json:"gpp_sid,omitempty" valid:"optional"` }
RegsExt being used for GDPR, CCPA as US Privacy, and any regulations via the Global Privacy Platform (GPP) string. The relevant regulations are specified within the GPP string and GPP Section ID (SID) list. GPPSIDs is a comma-separated list of GPP Section IDs.
func (*RegsExt) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Request ¶
type Request struct { Imp []Imp `json:"imp" valid:"required"` App App `json:"app" valid:"required"` Device Device `json:"device" valid:"required"` Format *Format `json:"format" valid:"required"` // this is not part of the spec, adding this here for convience allows h and width to be passed without the video/banner object to backwards support the GET User User `json:"user,omitempty" valid:"optional"` Test int `json:"test,omitempty" valid:"range(0|1),optional"` WSeat []string `json:"wseat,omitempty" valid:"optional"` BSeat []string `json:"bseat,omitempty" valid:"optional"` Wlang []string `json:"wlang,omitempty" valid:"optional"` Bcat []string `json:"bcat,omitempty" valid:"optional"` BAdv []string `json:"badv,omitempty" valid:"optional"` BApp []string `json:"bapp,omitempty" valid:"optional"` Source *Source `json:"source,omitempty" valid:"optional"` Regs Regs `json:"regs,omitempty" valid:"optional"` Ext RequestExt `json:"ext,omitempty" valid:"required"` }
Request openRTB 2.5 spec
func (*Request) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type RequestExt ¶
type RequestExt struct { APIKey string `json:"api_key,omitempty" valid:"uuidv4,required"` SessionID string `json:"session_id,omitempty" valid:"required"` }
RequestExt used to communicate the publishers api key to nimbus
func (*RequestExt) MarshalJSONObject ¶
func (e *RequestExt) MarshalJSONObject(enc *gojay.Encoder)
MarshalJSONObject implements MarshalerJSONObject
func (*RequestExt) NKeys ¶
func (e *RequestExt) NKeys() int
NKeys returns the number of keys to unmarshal
func (*RequestExt) UnmarshalJSONObject ¶
func (e *RequestExt) UnmarshalJSONObject(dec *gojay.Decoder, k string) error
UnmarshalJSONObject implements gojay's UnmarshalerJSONObject
type Segment ¶
type Segment struct { ID string `json:"id,omitempty" valid:"optional"` Name string `json:"name,omitempty" valid:"optional"` Value string `json:"value,omitempty" valid:"optional"` }
Segment objects are essentially key-value pairs that convey specific units of data about the user. The parent Data object is a collection of such values from a given data provider. The specific segment names and value options must be published by the exchange a priori to its bidders.
func (*Segment) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Segments ¶
type Segments []Segment
Segments ...
func (Segments) MarshalJSONArray ¶
MarshalJSONArray ...
type Skadn ¶
type Skadn struct { Version string `json:"version,omitempty" valid:"optional"` // Version of skadnetwork supported. Always "2.0" or higher. Dependent on both the OS version and the SDK version. SourceApp string `json:"sourceapp,omitempty" valid:"required"` // ID of publisher app in Apple’s App Store. Should match app.bundle in OpenRTB 2.x and app.storeid in AdCOM 1.x Skadnetids []string `json:"skadnetids,omitempty" valid:"optional"` // A subset of SKAdNetworkItem entries in the publisher app’s Info.plist that are relevant to the DSP. Recommended that this list not exceed 20. }
Skadn is used for direct SSP to DSP connections where a DSP wants to only consume their own relevant SKAdNetwork IDs. Object should only be present if both the SSP SDK version and the OS version (iOS 14.0+) support SKAdNetwork.
func (*Skadn) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Source ¶
type Source struct {
Ext SourceExt `json:"ext,omitempty" valid:"optional"`
}
Source describes the nature and behavior of the entity that is the source of the bid request upstream from the exchange. The primary purpose of this object is to define post-auction or upstream decisioning when the exchange itself does not control the final decision. A common example of this is header bidding, but it can also apply to upstream server entities such as another RTB exchange, a mediation platform, or an ad server combines direct campaigns with 3rd party demand in decisioning.
func (*Source) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type SourceExt ¶
type SourceExt struct { Omidpn string `json:"omidpn,omitempty" valid:"optional"` // identifier of the OM SDK integration, this is the same as the "name" parameter of the OMID Partner object Omidpv string `json:"omidpv,omitempty" valid:"optional"` // (optional) Version of the OM SDK version }
SourceExt also for OM SDK extensions to be passed to demand
func (*SourceExt) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Strings ¶
type Strings []string
Strings ...
func (Strings) MarshalJSONArray ¶
MarshalJSONArray encodes arrays into JSON
type UID ¶
type UID struct { ID string `json:"id"` Ext *IdentityExt `json:"ext"` }
UID defines metadata for vendors
func (*UID) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type UIDS ¶
type UIDS []UID
UIDS defines a slice of UID
func (UIDS) MarshalJSONArray ¶
MarshalJSONArray ...
type User ¶
type User struct { Age int `json:"age,omitempty" valid:"optional"` BuyerUID string `json:"buyeruid,omitempty" valid:"optional"` YOB int `json:"yob,omitempty" valid:"optional"` Gender string `json:"gender,omitempty" valid:"in(male|female),optional"` Keywords string `json:"keywords,omitempty" valid:"optional"` CustomData string `json:"custom_data,omitempty" valid:"optional"` Data []Data `json:"data,omitempty" valid:"optional"` Ext *UserExt `json:"ext" valid:"optional"` }
User object contains information known or derived about the human user of the device (i.e., the audience for advertising). The user id is an exchange artifact and may be subject to rotation or other privacy policies. However, this user ID must be stable long enough to serve reasonably as the basis for frequency capping and retargeting.
func (*User) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type UserExt ¶
type UserExt struct { Consent string `json:"consent,omitempty" valid:"-"` // publisher provided GDPR TCF string UnityBuyerUID string `json:"unity_buyeruid,omitempty" valid:"-"` FacebookBuyerUID string `json:"facebook_buyeruid,omitempty" valid:"-"` VungleBuyerUID string `json:"vungle_buyeruid,omitempty" valid:"-"` // buyer id that is generated from the unity sdk and passed to nimbus in the rtb request EIDS EIDS `json:"eids,omitempty" valid:"-"` }
UserExt Nimbus and IAB extensions
func (*UserExt) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject
type Video ¶
type Video struct { BidFloor *float64 `json:"bidfloor,omitempty" valid:"optional"` CompanionAd []Banner `json:"companionad,omitempty" valid:"optional"` CompanionType []int `json:"companiontype,omitempty" valid:"optional"` //1, 2, 3 -> Static Resource, HTM Resource, iframe Resource Mimes []string `json:"mimes,omitempty" valid:"optional"` Minduration int `json:"minduration" valid:"optional"` Maxduration int `json:"maxduration,omitempty" valid:"optional"` Protocols []int `json:"protocols,omitempty" valid:"inintarr(2|3|5|6),optional"` // 1,2,3,4,5,6,7,8,9,10 -> VAST 1.0,VAST 2.0,VAST 3.0,VAST 1.0 Wrapper,VAST 2.0 Wrapper,VAST 3.0 Wrapper,VAST 4.0,VAST 4.0 Wrapper,DAAST 1.0,DAAST 1.0 Wrapper W int `json:"w,omitempty" valid:"required"` H int `json:"h,omitempty" valid:"required"` StartDelay int `json:"startdelay" valid:"optional"` Placement int `json:"placement,omitempty" valid:"range(1|5),optional"` // 1,2,3,4,5 -> In-Stream, In-Banner, In-Article, In-Feed - Found in content, social, or product feeds, Interstitial/Slider/Floating Linearity int `json:"linearity,omitempty" valid:"range(1|2),optional"` // 1,2 -> linear, non linear Playbackmethod []int `json:"playbackmethod,omitempty" valid:"inintarr(1|2|3|4|5|6),optional"` // 1,2,3,4,5,6 - > Initiates on Page Load with Sound On, Initiates on Page Load with Sound Off by Default, Initiates on Click with Sound On, Initiates on Mouse-Over with Sound On, Initiates on Entering Viewport with Sound On, Initiates on Entering Viewport with Sound Off by Default Skip int `json:"skip" valid:"range(0|1),optional"` // 0 no 1 yes Delivery []int `json:"delivery,omitempty" valid:"range(0|3),optional"` // 0,1,2,3 -> Unknown, Professionally Produced, Prosumer, User Generated (UGC) Pos int `json:"pos,omitempty" valid:"range(0|7),optional"` // 0,1,2,3,4,5,6,7 -> Unknown,Above the Fold,DEPRECATED - May or may not be initially visible depending on screen size/resolution.,Below the Fold,Header,Footer,Sidebar,Full Screen API []int `json:"api,omitempty" valid:"inintarr(1|2|3|4|5|6|7),optional"` MinBitRate int `json:"minbitrate,omitempty" valid:"optional"` MaxBitRate int `json:"maxbitrate,omitempty" valid:"optional"` Ext *VideoExt `json:"ext" valid:"optional"` }
Video object represents an in-stream video impression. Many of the fields are non-essential for minimally viable transactions, but are included to offer fine control when needed. Video in OpenRTB generally assumes compliance with the VAST standard. As such, the notion of companion ads is supported by optionally including an array of Banner objects (refer to the Banner object in Section 3.2.3) that define these companion ads.
func (*Video) MarshalJSONObject ¶
MarshalJSONObject implements MarshalerJSONObject