Documentation
¶
Overview ¶
Package direct implements the OpenRTB bid response item for direct (click URL) ad formats. Direct ads deliver a click-through URL rather than full creative markup; the system renders an iframe or redirect wrapper around that URL.
Index ¶
- Variables
- type ResponseBidItem
- func (it *ResponseBidItem) ActionURL() 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) IsDirect() bool
- func (it *ResponseBidItem) PriorityFormatType() types.FormatType
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidAdContent = errors.New("invalid ad content")
ErrInvalidAdContent is returned when the ad markup cannot be resolved to a direct link.
Functions ¶
This section is empty.
Types ¶
type ResponseBidItem ¶
type ResponseBidItem struct {
common.BaseBidItem
DirectLink string `json:"action_link,omitempty"`
}
ResponseBidItem is the bid response item for direct ad formats. It implements adtype.ResponseItem and contains the resolved click-through URL together with 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 direct bid. It resolves the ad markup to a click-through URL, returning ErrInvalidAdContent when only an image URL is found (which is not a valid direct link).
func (*ResponseBidItem) ActionURL ¶
func (it *ResponseBidItem) ActionURL() string
ActionURL returns the resolved direct click-through URL.
func (*ResponseBidItem) ContentFields ¶
func (it *ResponseBidItem) ContentFields() map[string]any
ContentFields returns a map of all populated content fields (nil for direct format).
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) IsDirect ¶
func (it *ResponseBidItem) IsDirect() bool
IsDirect always returns true for direct bid items.
func (*ResponseBidItem) PriorityFormatType ¶
func (it *ResponseBidItem) PriorityFormatType() types.FormatType
PriorityFormatType always returns FormatDirectType for direct bid items.