request

package
v0.0.0-...-6f4435b Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2018 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Asset

type Asset struct {
	ID       int    `json:"id"`                 // Unique asset ID, assigned by exchange
	Required int    `json:"required,omitempty"` // Set to 1 if asset is required
	Title    *Title `json:"title,omitempty"`    // Title object for title assets
	Image    *Image `json:"img,omitempty"`      // Image object for image assets
	Video    *Video `json:"video,omitempty"`    // Video object for video assets
	Data     *Data  `json:"data,omitempty"`     // Data object for brand name, description, ratings, prices etc.

	// This object is a placeholder that may contain custom JSON
	// agreed to by the parties to support flexibility beyond the standard defined in this specification
	Ext opennative.Extension `json:"ext,omitempty"`
}

Asset - The main container object for each asset requested or supported by Exchange on behalf of the rendering client. Only one of the {title,img,video,data} objects should be present in each object. The id is to be unique within the AssetObject array so that the response can be aligned.

type ContextSubTypeID

type ContextSubTypeID int

ContextSubTypeID - Next-level context in which the ad appears. Again this reflects the primary context, and does not imply no presence of other elements. For example, an article is likely to contain images but is still first and foremost an article. SubType should only be combined with the primary context type as indicated (ie for a context type of 1, only context subtypes that start with 1 are valid).

const (
	ContextSubTypeGeneral        ContextSubTypeID = 10
	ContextSubTypeArticle        ContextSubTypeID = 11
	ContextSubTypeVideo          ContextSubTypeID = 12
	ContextSubTypeAudio          ContextSubTypeID = 13
	ContextSubTypeImage          ContextSubTypeID = 14
	ContextSubTypeUserGenerated  ContextSubTypeID = 15
	ContextSubTypeSocial         ContextSubTypeID = 20
	ContextSubTypeEmail          ContextSubTypeID = 21
	ContextSubTypeChat           ContextSubTypeID = 22
	ContextSubTypeSelling        ContextSubTypeID = 30
	ContextSubTypeAppStore       ContextSubTypeID = 31
	ContextSubTypeProductReviews ContextSubTypeID = 32
)

Context sub types

type ContextTypeID

type ContextTypeID int

ContextTypeID - The context in which the ad appears - what type of content is surrounding the ad on the page at a high level. This maps directly to the new Deep Dive on In-Feed Ad Units. This denotes the primary context, but does not imply other content may not exist on the page - for example it's expected that most content platforms have some social components, etc.

const (
	ContextTypeContent ContextTypeID = 1 // newsfeed, article, image gallery, video gallery
	ContextTypeSocial  ContextTypeID = 2 // social network feed, email, chat
	ContextTypeProduct ContextTypeID = 3 // product listings, details, recommendations, reviews
)

Context types

type Data

type Data struct {
	// Type ID of the element supported by the publisher.
	// The publisher can display this information in an appropriate format
	TypeID native.DataTypeID `json:"type"`

	// Maximum length of the text in the element’s response
	Length int `json:"len,omitempty"`

	// This object is a placeholder that may contain custom JSON
	// agreed to by the parties to support flexibility beyond the standard defined in this specification
	Ext opennative.Extension `json:"ext,omitempty"`
}

Data - Object is to be used for all non-core elements of the native unit such as Brand Name, Ratings, Review Count, Stars, Download count, descriptions etc. It is also generic for future native elements not contemplated at the time of the writing of this document. In some cases, additional recommendations are also included in the Data Asset Types table.

type EventTracker

type EventTracker struct {
	// Type of event available for tracking. See Event Types table.
	Event opennative.EventType `json:"event"`

	// Array of the types of tracking available for the given event. See **Event Tracking** Methods table.
	Methods []opennative.EventMethod `json:"methods"`

	// This object is a placeholder that may contain custom JSON
	// agreed to by the parties to support flexibility beyond the standard defined in this specification
	Ext opennative.Extension `json:"ext,omitempty"`
}

EventTracker - (v1.2 >=) The event trackers object specifies the types of events the bidder can request to be tracked in the bid response, and which types of tracking are available for each event type, and is included as an array in the request.

type Image

type Image struct {
	// Type ID of the image element supported by the publisher.
	// The publisher can display this information in an appropriate format.
	TypeID opennative.ImageTypeID `json:"type,omitempty"`

	Width     int `json:"w,omitempty"`    // Width of the image in pixels
	WidthMin  int `json:"wmin,omitempty"` // The minimum requested width of the image in pixels
	Height    int `json:"h,omitempty"`    // Height of the image in pixels
	HeightMin int `json:"hmin,omitempty"` // The minimum requested height of the image in pixels

	// supported. Popular MIME types include, but are not limited to “image/jpg” “image/gif”
	Mimes []string `json:"mimes,omitempty"` // Whitelist of content MIME types supported

	// This object is a placeholder that may contain custom JSON
	// agreed to by the parties to support flexibility beyond the standard defined in this specification
	Ext opennative.Extension `json:"ext,omitempty"`
}

Image object to be used for all image elements of the Native ad such as Icons, Main Image, etc. Recommended sizes and aspect ratios are included in the **Image Asset Types** section.

type NativeRequest

type NativeRequest struct {
	Native Request `json:"native"`
}

NativeRequest - wrapper around Request - support old version

type PlacementTypeID

type PlacementTypeID int

PlacementTypeID - The FORMAT of the ad you are purchasing, separate from the surrounding context

const (
	PlacementTypeInFeed         PlacementTypeID = 1 // In the feed of content - for example as an item inside the organic feed/grid/listing/carousel
	PlacementTypeAtomic         PlacementTypeID = 2 // In the atomic unit of the content - IE in the article page or single image page
	PlacementTypeOutside        PlacementTypeID = 3 // Outside the core content - for example in the ads section on the right rail, as a banner-style placement near the content, etc.
	PlacementTypeRecommendation PlacementTypeID = 4 // Recommendation widget, most commonly presented below the article content
)

Placement types

type Request

type Request struct {
	// Version of the Native Markup
	Ver opennative.Version `json:"ver"`

	// The Layout ID of the native ad
	// v1.0 - Recommended
	// v1.2 - Not used
	LayoutID int `json:"layout"`

	// The Ad unit ID of the native ad
	// v1.0 - Recommended
	// v1.2 - Not used
	AdUnitID int `json:"adunit"`

	// The context in which the ad appears; RECOMMENDED
	ContextTypeID ContextTypeID `json:"context,omitempty"`

	// A more detailed context in which the ad appears
	ContextSubTypeID ContextSubTypeID `json:"contextsubtype,omitempty"`

	// The design/format/layout of the ad unit being offered; RECOMMENDED
	PlacementTypeID PlacementTypeID `json:"plcmttype,omitempty"`

	// The number of identical placements in this Layout; Default 1
	PlacementCount int `json:"plcmtcnt,omitempty"`

	// 0 for the first ad, 1 for the second ad, and so on.
	// Note this would generally NOT be used in combination with plcmtcnt - either
	// you are auctioning multiple identical placements (in which case plcmtcnt>1, seq=0)
	// or you are holding separate auctions for distinct items in the feed (in which case plcmtcnt=1, seq=>=1)
	Sequence int `json:"seq,omitempty"`

	// An array of Asset Objects. Any bid response must comply with
	// the array of elements expressed in the bid request.
	Assets []Asset `json:"assets"`

	// (v1.2 >=) Whether the supply source / impression supports returning an
	// assetsurl instead of an asset object. 0 or the absence of the field indicates no such support.
	AURLSupport int `json:"aurlsupport,omitempty"`

	// (v1.2 >=) Whether the supply source / impression supports returning a
	// dco url instead of an asset object. 0 or the absence of the field indicates no such support. Beta
	DURLSupport int `json:"durlsupport,omitempty"`

	// (v1.2 >=) Specifies what type of event tracking is supported – see Event Trackers Request Object
	EventTrackers []EventTracker `json:"eventtrackers,omitempty"`

	// (v1.2 >=) Set to 1 when the native ad supports buyer-specific privacy notice
	// (see http://youradchoices.com/ for example). Set to 0 (or field absent
	// when the native ad doesn’t support custom privacy links or if support is unknown.
	Privacy int `json:"privacy,omitempty"`

	// This object is a placeholder that may contain custom JSON agreed
	// to by the parties to support flexibility beyond the standard defined in this specification
	Ext opennative.Extension `json:"ext,omitempty"`
}

Request - This 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. The presence of a Native as a subordinate of the Imp object indicates that this impression is offered as a native type impression. At the publisher’s discretion, that same impression may also be offered as banner and/or video by also including as Imp subordinates the Banner and/or Video objects, respectively. However, any given bid for the impression must conform to one of the offered types.

func (*Request) OpenRTBMarkup

func (r *Request) OpenRTBMarkup() ([]byte, error)

OpenRTBMarkup returns formated JSON data according with version of open native

type Title

type Title struct {
	// Maximum length of the text in the title element. Recommended to be 25, 90, or 140.
	Length int `json:"len"`

	// This object is a placeholder that may contain custom JSON
	// agreed to by the parties to support flexibility beyond the standard defined in this specification
	Ext opennative.Extension `json:"ext,omitempty"`
}

Title - Corresponds to the Title Object in the request, with the value filled in. If using asseturl response rather than embedded asset response, it is recommended that three title objects be provided, the length of each of which is less than or equal to the three recommended maximum title lengths (25,90,140).

type Video

type Video struct {
	Mimes       []string `json:"mimes"`       // Whitelist of content MIME types supported
	MinDuration int      `json:"minduration"` // Minimum video ad duration in seconds
	MaxDuration int      `json:"maxduration"` // Maximum video ad duration in seconds

	// An array of video protocols the integers publisher can accept in the bid response.
	// See OpenRTB Table ‘Video Bid Response Protocols’ for a list of possible values.
	Protocols []int `json:"protocols"`

	// This object is a placeholder that may contain custom JSON
	// agreed to by the parties to support flexibility beyond the standard defined in this specification
	Ext opennative.Extension `json:"ext,omitempty"`
}

Video object to be used for all video elements supported in the Native Ad. This corresponds to the Video object of OpenRTB. Exchange implementers can impose their own specific restrictions. Here are the required attributes of the Video Object. For optional attributes please refer to OpenRTB.

Jump to

Keyboard shortcuts

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