Documentation
¶
Overview ¶
Package banner implements the OpenRTB bid response item for banner ad formats. It handles HTML, iframe, and image banner creatives received from RTB sources, including interstitial XML markup parsing.
Index ¶
- Variables
- type BannerInfo
- type ResponseBidItem
- func (it *ResponseBidItem) ActionURL() string
- func (it *ResponseBidItem) ClickTrackerLinks() []string
- func (it *ResponseBidItem) ContentFields() map[string]any
- func (it *ResponseBidItem) ContentItem(name string) any
- func (it *ResponseBidItem) ContentItemString(name string) string
- func (it *ResponseBidItem) ImpressionTrackerLinks() []string
- func (it *ResponseBidItem) ViewTrackerLinks() []string
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAdContent = errors.New("invalid ad content")
ErrInvalidAdContent is returned when the ad markup cannot be parsed into valid banner content.
Functions ¶
This section is empty.
Types ¶
type BannerInfo ¶
type BannerInfo struct {
Title string `json:"title,omitempty"`
HTML string `json:"html,omitempty"`
IframeURL string `json:"iframe_url,omitempty"`
ImageURL string `json:"image_url,omitempty"`
VideoURL string `json:"video_url,omitempty"`
Width int `json:"width,omitempty"`
Height int `json:"height,omitempty"`
WRatio int `json:"wratio,omitempty"`
HRatio int `json:"hratio,omitempty"`
LinkURL string `json:"link_url,omitempty"`
ImpTrackers []string `json:"imp_trackers,omitempty"`
ViewTrackers []string `json:"view_trackers,omitempty"`
ClickTrackers []string `json:"click_trackers,omitempty"`
}
BannerInfo contains the parsed creative content for a banner advertisement.
func (*BannerInfo) IsValid ¶
func (b *BannerInfo) IsValid() bool
IsValid reports whether the banner info contains enough data to render an ad.
type ResponseBidItem ¶
type ResponseBidItem struct {
common.BaseBidItem
BannerInfo BannerInfo `json:"banner_info"`
}
ResponseBidItem is the bid response item for banner ad formats. It implements adtype.ResponseItem and wraps the raw OpenRTB bid together with parsed creative content, pricing, and tracking information.
func New ¶
func New(req adtype.BidRequester, src adtype.Source, bid *openrtb.Bid, imp *adtype.Impression, format *types.Format) (*ResponseBidItem, error)
New creates a ResponseBidItem for a banner bid. It parses the ad markup from the OpenRTB Bid and returns ErrInvalidAdContent if the markup cannot be converted into renderable content.
func (*ResponseBidItem) ActionURL ¶
func (it *ResponseBidItem) ActionURL() string
ActionURL returns the click-through URL for the banner ad.
func (*ResponseBidItem) ClickTrackerLinks ¶
func (it *ResponseBidItem) ClickTrackerLinks() []string
ClickTrackerLinks returns third-party tracker URLs fired on click.
func (*ResponseBidItem) ContentFields ¶
func (it *ResponseBidItem) ContentFields() map[string]any
ContentFields returns a map of all populated content fields for this banner item.
func (*ResponseBidItem) ContentItem ¶
func (it *ResponseBidItem) ContentItem(name string) any
ContentItem returns the ad response data for the given field name.
func (*ResponseBidItem) ContentItemString ¶
func (it *ResponseBidItem) ContentItemString(name string) string
ContentItemString returns the string value of a named content field.
func (*ResponseBidItem) ImpressionTrackerLinks ¶
func (it *ResponseBidItem) ImpressionTrackerLinks() []string
ImpressionTrackerLinks returns tracking links fired on impression.
func (*ResponseBidItem) ViewTrackerLinks ¶
func (it *ResponseBidItem) ViewTrackerLinks() []string
ViewTrackerLinks returns tracking links fired on viewable impression.