Documentation
¶
Overview ¶
Package vast implements the OpenRTB bid response item for VAST video ad formats. VAST (Video Ad Serving Template) bids deliver an XML document describing video creatives, tracking events, and click-through URLs.
VAST Example:
<VAST version="4.0">
<Ad id="12345">
<InLine>
<AdTitle>Sample VAST Ad</AdTitle>
<Creatives>
<Creative>
<Linear>
<Duration>00:00:30</Duration>
<MediaFiles>
<MediaFile delivery="progressive" type="video/mp4" width="640" height="360">
<![CDATA[https://example.com/video.mp4]]>
</MediaFile>
</MediaFiles>
<VideoClicks>
<ClickThrough><![CDATA[https://example.com/click]]></ClickThrough>
</VideoClicks>
</Linear>
</Creative>
</Creatives>
</InLine>
</Ad>
</VAST>
Index ¶
- Variables
- type ResponseBidItem
- func (it *ResponseBidItem) ActionURL() string
- func (it *ResponseBidItem) Assets() admodels.AdFileAssets
- 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) IsDirect() bool
- func (it *ResponseBidItem) MainAsset(assetType types.AdFileAssetType) *admodels.AdFileAsset
- func (it *ResponseBidItem) SetContentItem(name string, value any)
- func (it *ResponseBidItem) ViewTrackerLinks() []string
Constants ¶
This section is empty.
Variables ¶
var ErrInvalidVAST = errors.New("invalid VAST response")
ErrInvalidVAST is returned when the VAST document structure is not valid.
var ErrNoAssetsFound = errors.New("no assets found in VAST response")
var ErrUnsupportedVASTConfiguration = errors.New("unsupported VAST configuration")
ErrUnsupportedVASTConfiguration is the base sentinel for VAST configuration validation errors. All configuration-specific errors wrap this sentinel.
Functions ¶
This section is empty.
Types ¶
type ResponseBidItem ¶
type ResponseBidItem struct {
common.BaseBidItem
// VAST-specific fields
VAST *vast.VAST `json:"vast,omitempty"`
Data map[string]any `json:"data,omitempty"`
// contains filtered or unexported fields
}
ResponseBidItem is the bid response item for VAST video ad formats. It implements adtype.ResponseItem and provides access to the decoded VAST document, media assets, trackers, and pricing 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 VAST bid. It decodes and validates the XML VAST markup from the OpenRTB Bid, extracts tracking URLs and media assets.
func (*ResponseBidItem) ActionURL ¶
func (it *ResponseBidItem) ActionURL() string
ActionURL returns the primary video click-through URL from the VAST document.
func (*ResponseBidItem) Assets ¶
func (it *ResponseBidItem) Assets() admodels.AdFileAssets
Assets returns the file assets extracted from the VAST bid response.
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 (nil for VAST 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) ImpressionTrackerLinks ¶
func (it *ResponseBidItem) ImpressionTrackerLinks() []string
ImpressionTrackerLinks returns tracking links fired on impression.
func (*ResponseBidItem) IsDirect ¶
func (it *ResponseBidItem) IsDirect() bool
IsDirect always returns false for VAST bid items.
func (*ResponseBidItem) MainAsset ¶
func (it *ResponseBidItem) MainAsset(assetType types.AdFileAssetType) *admodels.AdFileAsset
MainAsset returns the primary file asset matched against the format configuration.
func (*ResponseBidItem) SetContentItem ¶
func (it *ResponseBidItem) SetContentItem(name string, value any)
SetContentItem sets the ad response data for the given field name.
func (*ResponseBidItem) ViewTrackerLinks ¶
func (it *ResponseBidItem) ViewTrackerLinks() []string
ViewTrackerLinks returns tracking links fired on viewable impression.