banner

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Nov 15, 2026 License: Apache-2.0 Imports: 10 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
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

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 (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 (it *ResponseBidItem) ImpressionTrackerLinks() []string

ImpressionTrackerLinks returns tracking links fired on impression.

func (it *ResponseBidItem) ViewTrackerLinks() []string

ViewTrackerLinks returns tracking links fired on viewable impression.

Jump to

Keyboard shortcuts

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