vast

package
v0.1.1 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: 16 Imported by: 0

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

Constants

This section is empty.

Variables

View Source
var ErrInvalidVAST = errors.New("invalid VAST response")

ErrInvalidVAST is returned when the VAST document structure is not valid.

View Source
var ErrNoAssetsFound = errors.New("no assets found in VAST response")
View Source
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

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 (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 (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 (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