Documentation
¶
Index ¶
- type Asset
- type Data
- type EventTracker
- type Image
- type Link
- type Response
- func (r *Response) AppendImpTrackers(ss ...string)
- func (r *Response) AppendOrReplaceJSTracker(s string)
- func (r *Response) CopyTrackers(resp *Response)
- func (r *Response) GetImpTrackers() []string
- func (r *Response) GetJSTrackers() []string
- func (r *Response) OpenRTBMarkup() ([]byte, error)
- func (r *Response) PrepareImpTrackers(fn func(url string) string)
- func (r *Response) PrepareJSTrackers(fn func(url string) string)
- func (r *Response) PrepareTrackers(fn func(url string) string)
- type Title
- type Video
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Asset ¶
type Asset struct {
ID opennative.NumberOrString `json:"id,omitempty"` // Unique asset ID, assigned by exchange
Required opennative.NumberOrString `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.
Link *Link `json:"link,omitempty"` // Link object for call to actions. The link object applies if the asset item is activated (clicked). If there is no link object on the asset, the parent link object on the bid response applies.
// 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 - Corresponds to the Asset Object in the request. The main container object for each asset requested or supported by Exchange on behalf of the rendering client. Any object that is required is to be flagged as such. Only one of the {title,img,video,data} objects should be present in each object. All others should be null/absent. The id is to be unique within the AssetObject array so that the response can be aligned.
type Data ¶
type Data struct {
// The optional formatted string name of the data type to be displayed
// Not used in v1.2 and above
Label string `json:"label,omitempty"`
// Type ID of the element supported by the publisher.
// The publisher can display this information in an appropriate format.
// (v1.2 >= REQUIRED) for asseturl responses, NOT REQUIRED for embedded asset responses.
// The type of data element being submitted from the Data Asset Types table.
TypeID native.DataTypeID `json:"type,omitempty"`
// (v1.2 >= REQUIRED) for asseturl responses, not required for embedded asset responses.
// The length of the data element being submitted. Where applicable,
// must comply with the recommended maximum lengths in the **Data Asset Types table**.
Len int `json:"len,omitempty"`
// The formatted string of data to be displayed.
// Can contain a formatted value such as “5 stars” or “$10” or “3.4 stars out of 5”
Value string `json:"value"`
// 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 - Corresponds to the Data Object in the request, with the value filled in. The Data Object is to be used for all miscellaneous elements of the native unit such as Brand Name, Ratings, Review Count, Stars, Downloads, Price count etc. It is also generic for future native elements not contemplated at the time of the writing of this document.
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"`
// The URL of the impage or js. Required for image or js, optional for custom.
URL string `json:"url,omitempty"`
// To be agreed individually with the exchange, an array
// of key:value objects for custom tracking, for example
// the account number of the DSP with a tracking company.
// IE {“accountnumber”:”123”}.
CustomData map[string]string `json:"customdata,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"`
}
EventTracker - 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
TypeID opennative.ImageTypeID `json:"type,omitempty"`
URL string `json:"url"` // URL of the image asset
// Width of the image in pixels.
// Recommended for embedded asset responses.
// (v1.2 >=) Required for assetsurl/dcourlresponses if multiple assets of same type submitted.
Width int `json:"w,omitempty"`
// Height of the image in pixels.
// Recommended for embedded asset responses.
// (v1.2 >=) Required for assetsurl/dcourl responses if multiple assets of same type submitted.
Height int `json:"h,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"`
}
Image - Corresponds to the Image Object in the request. The Image object to be used for all image elements of the Native ad such as Icons, Main Image, etc.
It is recommended that if asseturl is being used rather than embedded assets, that an image of each recommended aspect ratio (per the Image Types table) be provided for image type 3.
type Link ¶
type Link struct {
// Landing URL of the clickable link
URL string `json:"url"`
// List of third-party tracker URLs to be fired on click of the URL
ClickTrackers []string `json:"clicktrackers,omitempty"`
// Fallback URL for deeplink. To be used if the URL given in url is not supported by the device.
FallbackURL string `json:"fallback,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"`
}
Link - Used for ‘call to action’ assets, or other links from the Native ad. This Object should be associated to its peer object in the parent Asset Object or as the master link in the top level Native Ad response object. When that peer object is activated (clicked) the action should take the user to the location of the link.
type Response ¶
type Response struct {
// Version of the Native Markup
Ver opennative.Version `json:"ver,omitempty"`
// An array of Asset Objects
// v1.2 < REQUIRED
// v1.2 >= it's optional param
Assets []Asset `json:"assets,omitempty"`
// (v1.2 >=) URL of an alternate source for the assets object.
// The expected response is a JSON object mirroring the assets
// object in the bid response, subject to certain requirements
// as specified in the individual objects.
AssetsURL string `json:"assetsurl,omitempty"`
// (v1.2 >=) BETA: URL where a dynamic creative specification may be found for
// populating this ad, per the Dynamic Content Ads Specification.
Dcourl string `json:"dcourl,omitempty"`
// Destination Link. This is default link object for the ad
Link Link `json:"link"`
// @NOTE: Deprecated doesn't mean not used anymore
ImpTrackers []string `json:"imptrackers,omitempty"` // Array of impression tracking URLs, expected to return a 1x1 image or 204 response
JSTracker string `json:"jstracker,omitempty"` // Optional JavaScript impression tracker. This is a valid HTML, Javascript is already wrapped in <script> tags. It should be executed at impression time where it can be supported
// Array of tracking objects to run with the ad, in response to the
// declared supported methods in the request. Replaces imptrackers and
// jstracker, to be deprecated.
EventTrackers []EventTracker `json:"eventtrackers,omitempty"`
// If support was indicated in the request, URL of a page informing
// the user about the buyer’s targeting activity.
Privacy string `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"`
}
Response - The native object is the top level JSON object which identifies a native response
func DecodeOpenRTBMarkup ¶
DecodeOpenRTBMarkup decodes wrapped response JSON
func DefaultResponse ¶
func DefaultResponse() (out Response)
DefaultResponse - return default object of response
func (*Response) AppendImpTrackers ¶
AppendImpTrackers - add impression image trackers
func (*Response) AppendOrReplaceJSTracker ¶
AppendOrReplaceJSTracker - append or replace JS tracker
func (*Response) CopyTrackers ¶
CopyTrackers - copy trackers imp and js
func (*Response) GetImpTrackers ¶
GetImpTrackers - return impression trackers
func (*Response) GetJSTrackers ¶
GetJSTrackers - get js trackers
func (*Response) OpenRTBMarkup ¶
OpenRTBMarkup returns formated JSON data according with version of open native
func (*Response) PrepareImpTrackers ¶
PrepareImpTrackers - all impression trackers
func (*Response) PrepareJSTrackers ¶
PrepareJSTrackers - all js trackers
func (*Response) PrepareTrackers ¶
PrepareTrackers - all trackers url
type Title ¶
type Title struct {
// The text associated with the text element
Text string `json:"text"`
// The length of the title being provided. Required if using
// assetsurl/dcourl representation, optional if using embedded asset representation.
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"`
}
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).