Documentation
¶
Overview ¶
Package vast implements IAB VAST 4.2 https://iabtechlab.com/wp-content/uploads/2019/06/VAST_4.2_final_june26.pdf
Index ¶
- Constants
- type Ad
- type AdParameters
- type AdSystem
- type AdVerifications
- type Advertiser
- type CDATAString
- type Category
- type ClosedCaptionFile
- type ClosedCaptionFiles
- type Companion
- type CompanionAds
- type CompanionClickTracking
- type Creative
- type CreativeWrapper
- type Duration
- type ExecutableResource
- type Extension
- type HTMLResource
- type Icon
- type IconClickFallbackImage
- type IconClickFallbackImages
- type Icons
- type Impression
- type InLine
- type InteractiveCreativeFile
- type JavaScriptResource
- type Linear
- type LinearWrapper
- type MediaFile
- type MediaFiles
- type Mezzanine
- type NonLinear
- type NonLinearAds
- type NonLinearAdsWrapper
- type NonLinearClickTracking
- type NonLinearWrapper
- type Offset
- type PlainString
- type Pricing
- type StaticResource
- type Survey
- type Tracking
- type TrackingEvents
- type UniversalAdID
- type VAST
- type Verification
- type VerificationParameters
- type VideoClick
- type VideoClicks
- type ViewableImpression
- type Wrapper
Constants ¶
const ( // the user activated the mute control and muted the creative. EventTypeMute = "mute" // the user activated the mute control and unmuted the creative. EventTypeUnmute = "unmute" // the user clicked the pause control and stopped the creative. EventTypePause = "pause" // the user activated the resume control after the creative had been stopped or paused. EventTypeResume = "resume" // the user activated the rewind control to access a previous point in the creative timeline. EventTypeRewind = "rewind" // the user activated a skip control to skip the creative, which is a // different control than the one used to close the creative. EventTypeSkip = "skip" // the user activated a control to extend the player to a larger size. This // event replaces the fullscreen event per the 2014 Digital Video In-Stream Ad Metric // Definitions. EventTypePlayerExpand = "playerExpand" // the user activated a control to reduce player to a smaller size. This // event replaces the exitFullscreen event per the 2014 Digital Video In-Stream Ad // Metric Definitions. EventTypePlayerCollapse = "playerCollapse" // This ad was not and will not be played (e.g. it was prefetched for a particular // ad break but was not chosen for playback). This allows ad servers to reuse an ad earlier // than otherwise would be possible due to budget/frequency capping. This is a terminal // event; no other tracking events should be sent when this is used. Player support is // optional and if implemented is provided on a best effort basis as it is not technically // possible to fire this event for every unused ad (e.g. when the player itself is terminated // before playback) EventTypeNotUsed = "notUsed" // This event should be used to indicate when the player considers that // it has loaded and buffered the creative’s media and assets either fully or // to the extent that it is ready to play the media EventTypeLoaded = "loaded" // this event is used to indicate that an individual creative within the ad was loaded and playback //began. As with creativeView, this event is another way of tracking creative playback. EventTypeStart = "start" // the creative played for at least 25% of the total duration. EventTypeFirstQuartile = "firstQuartile" // the creative played for at least 50% of the total duration. EventTypeMidpoint = "midpoint" // the creative played for at least 75% of the duration. EventTypeThirdQuartile = "thirdQuartile" // The creative was played to the end at normal speed. EventTypeComplete = "complete" // An optional metric that can capture all other user interactions under one metric such a s hover-overs, or custom clicks. // It should NOT replace clickthrough events or other existing events like mute, unmute, pause, etc. EventTypeOtherAdInteraction = "otherAdInteraction" // the creative played for a duration at normal speed that is equal to or greater than the // value provided in an additional attribute for offset . Offset values can be time in the format // HH:MM:SS or HH:MM:SS.mmm or a percentage value in the format n% . Multiple progress ev EventTypeProgress = "progress" // the user clicked the close button on the creative. The name of this event distinguishes it // from the existing “close” event described in the 2008 IAB Digital Video In-Stream Ad Metrics // Definitions, which defines the “close” metric as applying to non-linear ads only. The “closeLinear” event // extends the “close” event for use in Linear creative. EventTypeCloseLinear = "closeLinear" // Not to be confused with an impression, this event indicates that an individual creative portion of the ad was viewed. // An impression indicates that at least a portion of the ad was displayed; // however an ad may be composed of multiple creative, or creative that only play on some platforms and not others. // This event enables ad servers to track which ad creative are viewed, and therefore, which platforms are more common. EventTypeCreativeView = "creativeView" // The user clicked or otherwise activated a control used to pause streaming content, // which either expands the ad within the player’s viewable area or “takes-over” the streaming content area // by launching an additional portion of the ad. // An ad in video format ad is usually played upon acceptance, but other forms of media such as games, animation, // tutorials, social media, or other engaging media are also used. EventTypeAcceptInvitation = "acceptInvitation" // The user activated a control to expand the creative. EventTypeAdExpand = "adExpand" // The user activated a control to reduce the creative to its original dimensions. EventTypeAdCollapse = "adCollapse" // The user clicked or otherwise activated a control used to minimize the ad // to a size smaller than a collapsed ad but without fully dispatching the ad from the player environment. // Unlike a collapsed ad that is big enough to display it’s message, // the minimized ad is only big enough to offer a control that enables the user to redisplay the ad if desired. EventTypeMinimize = "minimize" // The user clicked or otherwise activated a control for removing the ad, // which fully dispatches the ad from the player environment in a manner that does not allow the user to re-display the ad. EventTypeClose = "close" // The time that the initial ad is displayed. // This time is based on the time between the impression and either the completed length of display based on the agreement between // transactional parties or a close, minimize, or accept invitation event. EventTypeOverlayViewDuration = "overlayViewDuration" // With VAST 4, video playback and interactive creative playback now happens in parallel. // Video playback and interactive creative start may not happen at the same time. // A separate way of tracking the interactive creative start is needed. // The interactive creative specification (SIMID, etc.) will define when this event should be fired. EventTypeInteractiveStart = "interactiveStart" EventTypeView = "view" EventTypeMonitor = "monitor" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Ad ¶
type Ad struct { InLine *InLine `xml:",omitempty" json:",omitempty"` Wrapper *Wrapper `xml:",omitempty" json:",omitempty"` // An ad server-defined identifier string for the ad ID string `xml:"id,attr,omitempty" json:",omitempty"` // An optional string that identifies the type of ad. This allows VAST to support audio ad scenarios. // Possible values – video, audio, hybrid. // Default value – video (assumed to be video if attribute is not present) AdType string `xml:"adType,attr,omitempty" json:",omitempty"` // Custom attr Type string `xml:"type,attr,omitempty" json:",omitempty"` // A number greater than zero (0) that identifies the sequence in which // an ad should play; all <Ad> elements with sequence values are part of // a pod and are intended to be played in sequence Sequence int `xml:"sequence,attr,omitempty" json:",omitempty"` // [Deprecated in VAST 4.1, along with apiFramework] // A Boolean value that identifies a conditional ad. // In the case of programmatic ad serving, a VPAID ad unit or other mechanism might be used to decide whether there is an ad that matches the placement. // When there is no match, an ad may not be served. // Use of the conditionalAd attribute enables publishers to avoid accepting these ads in placements where an ad must be served. // A value of true indicates that the ad is conditional and should be used in all cases where the InLine executable unit (such as VPAID) is not an ad but is instead a framework for finding an ad; // a value of false is the default value and indicates that an ad is available. ConditionalAd bool `xml:"conditionalAd,attr,omitempty" json:",omitempty"` }
Ad represent an <Ad> child tag in a VAST document
Each <Ad> contains a single <InLine> element or <Wrapper> element (but never both).
type AdParameters ¶
type AdParameters struct { // Specifies whether the parameters are XML-encoded XMLEncoded bool `xml:"xmlEncoded,attr,omitempty" json:",omitempty"` Parameters string `xml:",cdata"` }
<AdParameters> defines arbitrary ad parameters
type AdSystem ¶
type AdSystem struct { Version string `xml:"version,attr,omitempty" json:"Version,omitempty"` Name string `xml:",chardata" json:"Data"` }
AdSystem contains information about the system that returned the ad
type AdVerifications ¶
type AdVerifications struct {
Verification []Verification `xml:",omitempty"`
}
type Advertiser ¶
type Advertiser struct { // An (optional) identifier for the advertiser, provided by the ad server. Can be used for internal analytics. ID string `xml:"id,attr,omitempty"` // A string that provides the name of the advertiser as defined by the ad serving party. // Recommend using the domain of the advertiser. Advertiser string `xml:",chardata"` }
Providing an advertiser name can help publishers prevent display of the ad with its competitors.
type CDATAString ¶
type CDATAString struct {
CDATA string `xml:",cdata" json:"Data"`
}
type ClosedCaptionFile ¶
type ClosedCaptionFile struct { // Identifies the MIME type of the file provided. Type string `xml:"type,attr,omitempty"` // Language of the Closed Caption File using ISO 631-1 codes. // An optional locale suffix can also be provided. // Examples - “en”, “en-US”, “zh-TW”, Language string `xml:"language,attr,omitempty"` // A CDATA-wrapped URI to a file providing Closed Caption info for the media file. URI string `xml:",cdata"` }
type ClosedCaptionFiles ¶
type ClosedCaptionFiles struct {
ClosedCaptionFile []ClosedCaptionFile `xml:"ClosedCaptionFile,omitempty" json:",omitempty"`
}
type Companion ¶
type Companion struct { // Optional identifier ID string `xml:"id,attr,omitempty" json:",omitempty"` // Pixel dimensions of companion slot. Width int `xml:"width,attr,omitempty"` // Pixel dimensions of companion slot. Height int `xml:"height,attr,omitempty"` // Pixel dimensions of the companion asset. AssetWidth int `xml:"assetWidth,attr,omitempty"` // Pixel dimensions of the companion asset. AssetHeight int `xml:"assetHeight,attr,omitempty"` // Pixel dimensions of expanding companion ad when in expanded state. ExpandedWidth int `xml:"expandedWidth,attr,omitempty"` // Pixel dimensions of expanding companion ad when in expanded state. ExpandedHeight int `xml:"expandedHeight,attr,omitempty"` // The apiFramework defines the method to use for communication with the companion. APIFramework string `xml:"apiFramework,attr,omitempty" json:",omitempty"` // Used to match companion creative to publisher placement areas on the page. AdSlotID string `xml:"adSlotId,attr,omitempty" json:",omitempty"` // URL to open as destination page when user clicks on the the companion banner ad. CompanionClickThrough *CDATAString `xml:",omitempty" json:",omitempty"` // URLs to ping when user clicks on the the companion banner ad. CompanionClickTrackings []CompanionClickTracking `xml:"CompanionClickTracking,omitempty" json:",omitempty"` // Alt text to be displayed when companion is rendered in HTML environment. AltText string `xml:",omitempty" json:",omitempty"` // The creativeView should always be requested when present. For Companions // creativeView is the only supported event. TrackingEvents *TrackingEvents `xml:"TrackingEvents,omitempty" json:",omitempty"` // Data to be passed into the companion ads. The apiFramework defines the method // to use for communication (e.g. “FlashVar”) AdParameters *AdParameters `xml:",omitempty" json:",omitempty"` // URL to a static file, such as an image or SWF file StaticResource *StaticResource `xml:",omitempty" json:",omitempty"` // URL source for an IFrame to display the companion element IFrameResource *CDATAString `xml:",omitempty" json:",omitempty"` // HTML to display the companion element HTMLResource *HTMLResource `xml:",omitempty" json:",omitempty"` Pxratio string `xml:"pxratio,attr,omitempty" json:",omitempty"` RenderingMode string `xml:"renderingMode,attr,omitempty" json:",omitempty"` }
<Companion> defines a companion ad
type CompanionAds ¶
type CompanionAds struct { // Provides information about which companion creative to display. // All means that the player must attempt to display all. Any means the player // must attempt to play at least one. None means all companions are optional Required string `xml:"required,attr,omitempty" json:",omitempty"` Companions []Companion `xml:"Companion,omitempty" json:",omitempty"` }
<CompanionAds> contains companions creatives
type CompanionClickTracking ¶
type CompanionClickTracking struct { // An id provided by the ad server to track the click in reports. ID string `xml:"id,attr,omitempty" json:",omitempty"` URI string `xml:",cdata"` }
CompanionClickTracking element is used to track the click
type Creative ¶
type Creative struct { // An ad server-defined identifier for the creative ID string `xml:"id,attr,omitempty" json:",omitempty"` // The preferred order in which multiple Creatives should be displayed Sequence int `xml:"sequence,attr,omitempty" json:",omitempty"` // Identifies the ad with which the creative is served AdID string `xml:"adId,attr,omitempty" json:",omitempty"` // The technology used for any included API APIFramework string `xml:"apiFramework,attr,omitempty" json:",omitempty"` // If present, provides a VAST 4.x universal ad id UniversalAdID *[]UniversalAdID `xml:"UniversalAdId,omitempty" json:",omitempty"` // If present, defines a linear creative Linear *Linear `xml:",omitempty" json:",omitempty"` // If defined, defins companions creatives CompanionAds *CompanionAds `xml:",omitempty" json:",omitempty"` // If defined, defines non linear creatives NonLinearAds *NonLinearAds `xml:",omitempty" json:",omitempty"` // When an API framework is needed to execute creative, a // <CreativeExtensions> element can be added under the <Creative>. This // extension can be used to load an executable creative with or without using // a media file. // A <CreativeExtension> element is nested under the <CreativeExtensions> // (plural) element so that any xml extensions are separated from VAST xml. // Additionally, any xml used in this extension should identify an xml name // space (xmlns) to avoid confusing any of the xml element names with those // of VAST. // The nested <CreativeExtension> includes an attribute for type, which // specifies the MIME type needed to execute the extension. CreativeExtensions *[]Extension `xml:"CreativeExtensions>CreativeExtension,omitempty" json:",omitempty"` }
Creative is a file that is part of a VAST ad.
type CreativeWrapper ¶
type CreativeWrapper struct { // An ad server-defined identifier for the creative ID string `xml:"id,attr,omitempty" json:",omitempty"` // The preferred order in which multiple Creatives should be displayed Sequence int `xml:"sequence,attr,omitempty" json:",omitempty"` // Identifies the ad with which the creative is served AdID string `xml:"adId,attr,omitempty" json:",omitempty"` // If present, defines a linear creative Linear *LinearWrapper `xml:",omitempty" json:",omitempty"` // If defined, defines companions creatives CompanionAds *CompanionAds `xml:"CompanionAds,omitempty" json:",omitempty"` // If defined, defines non linear creatives NonLinearAds *NonLinearAdsWrapper `xml:"NonLinearAds,omitempty" json:",omitempty"` }
<CreativeWrapper> defines wrapped creative's parent trackers
type Duration ¶
Duration is a VAST duration expressed a hh:mm:ss
func (Duration) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Duration) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type ExecutableResource ¶
type ExecutableResource struct { // Identifies the API needed to execute the resource file if applicable. ApiFramework string `xml:"apiFramework,attr,omitempty"` // Identifies the MIME type of the file provided. Type bool `xml:"type,attr,omitempty"` // A CDATA-wrapped URI to a file providing Closed Caption info for the media file. URI string `xml:",cdata"` }
type Extension ¶
type Extension struct { Type string `xml:"type,attr,omitempty"` CustomTracking []Tracking `xml:"CustomTracking>Tracking,omitempty" json:",omitempty"` Data string `xml:",innerxml" json:",omitempty"` }
Extension represent arbitrary XML provided by the platform to extend the VAST response or by custom trackers.
func (Extension) MarshalXML ¶
MarshalXML implements xml.Marshaler interface.
func (*Extension) UnmarshalXML ¶
UnmarshalXML implements xml.Unmarshaler interface.
type HTMLResource ¶
type HTMLResource struct { // Specifies whether the HTML is XML-encoded XMLEncoded bool `xml:"xmlEncoded,attr,omitempty" json:",omitempty"` HTML string `xml:",cdata"` }
<HTMLResource> is a container for HTML data
type Icon ¶
type Icon struct { // Identifies the industry initiative that the icon supports. Program string `xml:"program,attr,omitempty"` // Pixel dimensions of icon. Width int `xml:"width,attr,omitempty"` // Pixel dimensions of icon. Height int `xml:"height,attr,omitempty"` // The horizontal alignment location (in pixels) or a specific alignment. // Must match ([0-9]*|left|right) XPosition string `xml:"xPosition,attr,omitempty"` // The vertical alignment location (in pixels) or a specific alignment. // Must match ([0-9]*|top|bottom) YPosition string `xml:"yPosition,attr,omitempty"` // Start time at which the player should display the icon. Expressed in standard time format hh:mm:ss. Offset Offset `xml:"offset,attr,omitempty"` // duration for which the player must display the icon. Expressed in standard time format hh:mm:ss. Duration Duration `xml:"duration,attr,omitempty"` // The apiFramework defines the method to use for communication with the icon element APIFramework string `xml:"apiFramework,attr,omitempty" json:",omitempty"` // The pixel ratio for which the icon creative is intended. // The pixel ratio is the ratio of physical pixels on the device to the device-independent pixels. // An ad intended for display on a device with a pixel ratio that is twice that of a standard 1:1 pixel ratio would use the value "2." // Default value is "1." Pxratio string `xml:"pxratio,attr,omitempty" json:",omitempty"` // Alternative text for the image. // In an html5 image tag this should be the text for the alt attribute. // This should enable screen readers to properly read back a description of the icon for visually impaired users. AltText string `xml:"altText,attr,omitempty" json:",omitempty"` // Hover text for the image. // In an html5 image tag this should be the text for the title attribute. HoverText string `xml:"hoverText,attr,omitempty" json:",omitempty"` // The view tracking for icons is used to track when the icon creative is displayed. // The player uses the included URI to notify the icon server when the icon has been displayed. IconViewTracking []CDATAString `xml:",omitempty" json:",omitempty"` // URL to open as destination page when user clicks on the icon. IconClickThrough *CDATAString `xml:"IconClicks>IconClickThrough,omitempty" json:",omitempty"` // URLs to ping when user clicks on the the icon. IconClickTracking []CDATAString `xml:"IconClicks>IconClickTracking,omitempty" json:",omitempty"` IconClickFallbackImages *IconClickFallbackImages `xml:"IconClicks>IconClickFallbackImages,omitempty" json:",omitempty"` // URL to a static file, such as an image or SWF file StaticResource *StaticResource `xml:",omitempty" json:",omitempty"` // URL source for an IFrame to display the companion element IFrameResource *CDATAString `xml:",omitempty" json:",omitempty"` // HTML to display the companion element HTMLResource *HTMLResource `xml:",omitempty" json:",omitempty"` }
<Icon> represents advertising industry initiatives like AdChoices.
type IconClickFallbackImage ¶
type IconClickFallbackImage struct { AltText string `xml:"AltText,omitempty"` StaticResource *CDATAString `xml:"StaticResource,omitempty"` Height int `xml:"height,attr,omitempty"` Width int `xml:"width,attr,omitempty"` }
type IconClickFallbackImages ¶
type IconClickFallbackImages struct { // Use to display information when an IconClick occurs IconClickFallbackImage []IconClickFallbackImage `xml:"IconClickFallbackImage"` }
type Impression ¶
type Impression struct { ID string `xml:"id,attr,omitempty" json:",omitempty"` URI string `xml:",cdata" ` }
Impression is a URI that directs the video player to a tracking resource file that the video player should request when the first frame of the ad is displayed
type InLine ¶
type InLine struct { // The name of the ad server that returned the ad AdSystem *AdSystem // A URI representing an error-tracking pixel; this element can occur multiple // times. Errors []CDATAString `xml:"Error,omitempty" json:"Error,omitempty"` // XML node for custom extensions, as defined by the ad server. When used, a // custom element should be nested under <Extensions> to help separate custom // XML elements from VAST elements. The following example includes a custom // xml element within the Extensions element. Extensions *[]Extension `xml:"Extensions>Extension,omitempty" json:",omitempty"` // One or more URIs that directs the video player to a tracking resource file that the // video player should request when the first frame of the ad is displayed Impressions []Impression `xml:"Impression"` // Provides a value that represents a price that can be used by real-time bidding // (RTB) systems. VAST is not designed to handle RTB since other methods exist, // but this element is offered for custom solutions if needed. Pricing *Pricing `xml:",omitempty" json:",omitempty"` // Any ad server that returns a VAST containing an <InLine> ad must generate a pseudo- unique identifier // that is appropriate for all involved parties to track the lifecycle of that ad. // Example: ServerName-47ed3bac-1768-4b9a-9d0e-0b92422ab066 AdServingId string `xml:",omitempty" json:",omitempty"` // The common name of the ad AdTitle PlainString // The name of the advertiser as defined by the ad serving party. // This element can be used to prevent displaying ads with advertiser // competitors. Ad serving parties and publishers should identify how // to interpret values provided within this element. As with any optional // elements, the video player is not required to support it. Advertiser *Advertiser `xml:",omitempty" json:",omitempty"` Category *[]Category `xml:",omitempty" json:",omitempty"` // The container for one or more <Creative> elements Creatives []Creative `xml:"Creatives>Creative"` // A string value that provides a longer description of the ad. Description *CDATAString `xml:",omitempty" json:",omitempty"` // A URI to a survey vendor that could be the survey, a tracking pixel, // or anything to do with the survey. Multiple survey elements can be provided. // A type attribute is available to specify the MIME type being served. // For example, the attribute might be set to type=”text/javascript”. // Surveys can be dynamically inserted into the VAST response as long as // cross-domain issues are avoided. Survey *Survey `xml:",omitempty" json:",omitempty"` // The number of seconds in which the ad is valid for execution. //In cases where the ad is requested ahead of time, this timing indicates how many seconds after the request that the ad expires and cannot be played. //This element is useful for preventing an ad from playing after a timeout has occurred. Expires *int `xml:"Expires,omitempty" json:"Expires,omitempty"` // The ad server may provide URIs for tracking publisher-determined viewability, // for both the InLine ad and any Wrappers, using the <ViewableImpression> element. // Tracking URIs may be provided in three containers: <Viewable>, <NotViewable>, and <ViewUndetermined>. ViewableImpression *ViewableImpression `xml:",omitempty" json:",omitempty"` // The <AdVerifications> element contains one or more <Verification> elements, // which list the resources and metadata required to execute third-party measurement code in order to verify creative playback. // The <AdVerifications> element is used to contain one or more <Verification> elements, // which are used to initiate a controlled container where code can be executed for collecting data to verify ad playback details. AdVerifications *AdVerifications `xml:"AdVerifications,omitempty" json:",omitempty"` }
<InLine> is a vast <InLine> ad element containing actual ad definition
The last ad server in the ad supply chain serves an <InLine> element. Within the nested elements of an <InLine> element are all the files and URIs necessary to display the ad.
type InteractiveCreativeFile ¶
type InteractiveCreativeFile struct { // Identifies the API needed to execute the resource file if applicable. ApiFramework string `xml:"apiFramework,attr,omitempty"` // Identifies the MIME type of the file provided. Type bool `xml:"type,attr,omitempty"` // Useful for interactive use cases. // Identifies whether the ad always drops when the duration is reached, // or if it can potentially extend the duration by pausing the underlying video or delaying the adStopped call after adVideoComplete. // If it set to true the extension of the duration should be user-initiated (typically by engaging with an interactive element to view additional content). VariableDuration bool `xml:"variableDuration,attr,omitempty"` // A CDATA-wrapped URI to a file providing Closed Caption info for the media file. URI string `xml:",cdata"` }
type JavaScriptResource ¶
type JavaScriptResource struct { // Identifies the API needed to execute the resource file if applicable. ApiFramework string `xml:"apiFramework,attr,omitempty"` // If "true", this resource is optimized and able to execute in // an environment without DOM and other browser built-ins (e.g. iOS' JavaScriptCore). BrowserOptional bool `xml:"browserOptional,attr,omitempty"` // A CDATA-wrapped URI to a file providing Closed Caption info for the media file. URI string `xml:",cdata"` }
A container for the URI to the JavaScript file used to collect verification data.
type Linear ¶
type Linear struct { // To specify that a Linear creative can be skipped, the ad server must // include the skipoffset attribute in the <Linear> element. The value // for skipoffset is a time value in the format HH:MM:SS or HH:MM:SS.mmm // or a percentage in the format n%. The .mmm value in the time offset // represents milliseconds and is optional. This skipoffset value // indicates when the skip control should be provided after the creative // begins playing. SkipOffset *Offset `xml:"skipoffset,attr,omitempty" json:",omitempty"` // Duration in standard time format, hh:mm:ss Duration Duration `xml:"Duration,omitempty" json:",omitempty"` Icons *Icons `json:",omitempty"` TrackingEvents *TrackingEvents `xml:"TrackingEvents,omitempty" json:",omitempty"` AdParameters *AdParameters `xml:",omitempty" json:",omitempty"` VideoClicks *VideoClicks `xml:",omitempty" json:",omitempty"` MediaFiles *MediaFiles `xml:"MediaFiles" json:",omitempty"` }
<Linear> is the most common type of video advertisement trafficked in the industry is a “linear ad”, which is an ad that displays in the same area as the content but not at the same time as the content. In fact, the video player must interrupt the content before displaying a linear ad. <Linear> ads are often displayed right before the video content plays. This ad position is called a “pre-roll” position. For this reason, a linear ad is often called a “pre-roll.”
type LinearWrapper ¶
type LinearWrapper struct { Icons *Icons `json:",omitempty"` TrackingEvents *TrackingEvents `xml:"TrackingEvents,omitempty" json:",omitempty"` VideoClicks *VideoClicks `xml:",omitempty" json:",omitempty"` }
<LinearWrapper> defines a wrapped linear creative
type MediaFile ¶
type MediaFile struct { // Optional identifier ID string `xml:"id,attr,omitempty" json:",omitempty"` // Method of delivery of ad (either "streaming" or "progressive") Delivery string `xml:"delivery,attr"` // MIME type. Popular MIME types include, but are not limited to // “video/x-ms-wmv” for Windows Media, and “video/x-flv” for Flash // Video. Image ads or interactive ads can be included in the // MediaFiles section with appropriate Mime types Type string `xml:"type,attr"` // Bitrate of encoded video in Kbps. If bitrate is supplied, MinBitrate // and MaxBitrate should not be supplied. Bitrate int `xml:"bitrate,attr,omitempty" json:",omitempty"` // Pixel dimensions of video. Width int `xml:"width,attr"` // Pixel dimensions of video. Height int `xml:"height,attr"` // Minimum bitrate of an adaptive stream in Kbps. If MinBitrate is supplied, // MaxBitrate must be supplied and Bitrate should not be supplied. MinBitrate int `xml:"minBitrate,attr,omitempty" json:",omitempty"` // Maximum bitrate of an adaptive stream in Kbps. If MaxBitrate is supplied, // MinBitrate must be supplied and Bitrate should not be supplied. MaxBitrate int `xml:"maxBitrate,attr,omitempty" json:",omitempty"` // Whether it is acceptable to scale the image. Scalable bool `xml:"scalable,attr,omitempty" json:",omitempty"` // Whether the ad must have its aspect ratio maintained when scales. MaintainAspectRatio bool `xml:"maintainAspectRatio,attr,omitempty" json:",omitempty"` // The codec used to produce the media file. Codec string `xml:"codec,attr,omitempty" json:",omitempty"` // The APIFramework defines the method to use for communication if the MediaFile // is interactive. Suggested values for this element are “VPAID”, “FlashVars” // (for Flash/Flex), “initParams” (for Silverlight) and “GetVariables” (variables // placed in key/value pairs on the asset request). APIFramework string `xml:"apiFramework,attr,omitempty" json:",omitempty"` URI string `xml:",cdata"` // Label Label string `xml:"label,attr,omitempty" json:",omitempty"` // Optional field that helps eliminate the need to calculate the size based on bitrate and duration. // Units - Bytes FileSize int `xml:"fileSize,attr,omitempty" json:",omitempty"` // Type of media file (2D / 3D / 360 / etc). Optional. // Default value = 2D MediaType string `xml:"mediaType,attr,omitempty" json:",omitempty"` }
<MediaFile> defines a reference to a linear creative asset
type MediaFiles ¶
type MediaFiles struct { MediaFile []MediaFile `xml:",omitempty" json:",omitempty"` Mezzanine []Mezzanine `xml:",omitempty" json:",omitempty"` InteractiveCreativeFile []InteractiveCreativeFile `xml:",omitempty" json:",omitempty"` ClosedCaptionFiles *[]ClosedCaptionFile `xml:"ClosedCaptionFiles>ClosedCaptionFile,omitempty" json:",omitempty"` }
type Mezzanine ¶
type Mezzanine struct { // Method of delivery of ad (either "streaming" or "progressive") Delivery string `xml:"delivery,attr"` // MIME type. Popular MIME types include, but are not limited to // “video/x-ms-wmv” for Windows Media, and “video/x-flv” for Flash // Video. Image ads or interactive ads can be included in the // MediaFiles section with appropriate Mime types Type string `xml:"type,attr"` // Pixel dimensions of video. Width int `xml:"width,attr"` // Pixel dimensions of video. Height int `xml:"height,attr"` // The codec used to produce the media file. Codec string `xml:"codec,attr,omitempty" json:",omitempty"` // Optional identifier ID string `xml:"id,attr,omitempty" json:",omitempty"` // Optional field that helps eliminate the need to calculate the size based on bitrate and duration. // Units - Bytes FileSize int `xml:"fileSize,attr,omitempty" json:",omitempty"` // Type of media file (2D / 3D / 360 / etc). Optional. // Default value = 2D MediaType string `xml:"mediaType,attr,omitempty" json:",omitempty"` // A CDATA-wrapped URI to a raw, high-quality media file URI string `xml:",cdata"` }
type NonLinear ¶
type NonLinear struct { // Optional identifier ID string `xml:"id,attr,omitempty" json:",omitempty"` // Pixel dimensions of companion. Width int `xml:"width,attr,omitempty"` // Pixel dimensions of companion. Height int `xml:"height,attr,omitempty"` // Pixel dimensions of expanding nonlinear ad when in expanded state. ExpandedWidth int `xml:"expandedWidth,attr,omitempty"` // Pixel dimensions of expanding nonlinear ad when in expanded state. ExpandedHeight int `xml:"expandedHeight,attr,omitempty"` // Whether it is acceptable to scale the image. Scalable bool `xml:"scalable,attr,omitempty" json:",omitempty"` // Whether the ad must have its aspect ratio maintained when scales. MaintainAspectRatio bool `xml:"maintainAspectRatio,attr,omitempty" json:",omitempty"` // Suggested duration to display non-linear ad, typically for animation to complete. // Expressed in standard time format hh:mm:ss. MinSuggestedDuration *Duration `xml:"minSuggestedDuration,attr,omitempty" json:",omitempty"` // The apiFramework defines the method to use for communication with the nonlinear element. APIFramework string `xml:"apiFramework,attr,omitempty" json:",omitempty"` // HTML to display the companion element HTMLResource *HTMLResource `xml:",omitempty" json:",omitempty"` // URL source for an IFrame to display the companion element IFrameResource *CDATAString `xml:",omitempty" json:",omitempty"` // URL to a static file, such as an image or SWF file StaticResource *StaticResource `xml:",omitempty" json:",omitempty"` // Data to be passed into the video ad. AdParameters *AdParameters `xml:",omitempty" json:",omitempty"` // URL to open as destination page when user clicks on the non-linear ad unit. NonLinearClickThrough *CDATAString `xml:",omitempty" json:",omitempty"` // URLs to ping when user clicks on the the non-linear ad. NonLinearClickTrackings []NonLinearClickTracking `xml:"NonLinearClickTracking,omitempty" json:",omitempty"` }
<NonLinear> defines a non linear ad
type NonLinearAds ¶
type NonLinearAds struct { TrackingEvents *TrackingEvents `xml:"TrackingEvents,omitempty" json:",omitempty"` // Non linear creatives NonLinears []NonLinear `xml:"NonLinear,omitempty" json:",omitempty"` }
NonLinearAds contains non linear creatives
type NonLinearAdsWrapper ¶
type NonLinearAdsWrapper struct { TrackingEvents *TrackingEvents `xml:"TrackingEvents,omitempty" json:",omitempty"` // Non linear creatives NonLinears []NonLinearWrapper `xml:"NonLinear,omitempty" json:",omitempty"` }
<NonLinearAdsWrapper> contains non linear creatives in a wrapper
type NonLinearClickTracking ¶
type NonLinearClickTracking struct { // An id provided by the ad server to track the click in reports ID string `xml:"id,attr,omitempty" json:",omitempty"` URI string `xml:",cdata"` }
NonLinearClickTracking element is used to track the click
type NonLinearWrapper ¶
type NonLinearWrapper struct { // Optional identifier ID string `xml:"id,attr,omitempty" json:",omitempty"` // Pixel dimensions of companion. Width int `xml:"width,attr,omitempty"` // Pixel dimensions of companion. Height int `xml:"height,attr,omitempty"` // Pixel dimensions of expanding nonlinear ad when in expanded state. ExpandedWidth int `xml:"expandedWidth,attr,omitempty"` // Pixel dimensions of expanding nonlinear ad when in expanded state. ExpandedHeight int `xml:"expandedHeight,attr,omitempty"` // Whether it is acceptable to scale the image. Scalable bool `xml:"scalable,attr,omitempty" json:",omitempty"` // Whether the ad must have its aspect ratio maintained when scales. MaintainAspectRatio bool `xml:"maintainAspectRatio,attr,omitempty" json:",omitempty"` // Suggested duration to display non-linear ad, typically for animation to complete. // Expressed in standard time format hh:mm:ss. MinSuggestedDuration *Duration `xml:"minSuggestedDuration,attr,omitempty" json:",omitempty"` // The apiFramework defines the method to use for communication with the nonlinear element. APIFramework string `xml:"apiFramework,attr,omitempty" json:",omitempty"` // The creativeView should always be requested when present. TrackingEvents *TrackingEvents `xml:"TrackingEvents,omitempty" json:",omitempty"` // URLs to ping when user clicks on the the non-linear ad. NonLinearClickTracking []CDATAString `xml:",omitempty" json:",omitempty"` }
<NonLinearWrapper> defines a non linear ad in a wrapper
type Offset ¶
type Offset struct { // If not nil, the Offset is duration based Duration *Duration // If Duration is nil, the Offset is percent based Percent float32 }
Offset represents either a vast.Duration or a percentage of the video duration.
func (Offset) MarshalText ¶
MarshalText implements the encoding.TextMarshaler interface.
func (*Offset) UnmarshalText ¶
UnmarshalText implements the encoding.TextUnmarshaler interface.
type PlainString ¶
type PlainString struct {
CDATA string `xml:",chardata" json:"Data"`
}
type Pricing ¶
type Pricing struct { // Identifies the pricing model as one of "cpm", "cpc", "cpe" or "cpv". Model string `xml:"model,attr"` // The 3 letter ISO-4217 currency symbol that identifies the currency of // the value provided Currency string `xml:"currency,attr"` // If the value provided is to be obfuscated/encoded, publishers and advertisers // must negotiate the appropriate mechanism to do so. When included as part of // a VAST Wrapper in a chain of Wrappers, only the value offered in the first // Wrapper need be considered. Value string `xml:",cdata"` }
Pricing provides a value that represents a price that can be used by real-time bidding (RTB) systems. VAST is not designed to handle RTB since other methods exist, but this element is offered for custom solutions if needed.
type StaticResource ¶
type StaticResource struct { // Mime type of static resource CreativeType string `xml:"creativeType,attr,omitempty" json:",omitempty"` // URL to a static file, such as an image or SWF file URI string `xml:",cdata"` }
<StaticResource> is the URL to a static file, such as an image or SWF file
type Survey ¶
type Survey struct { // A type attribute is available to specify the MIME type being served. For example, // the attribute might be set to type="text/javascript". // Surveys can be dynamically inserted into the VAST response as long as cross-domain issues are avoided. Type string `xml:"type,attr"` // A URI to any resource relating to an integrated survey. URI string `xml:",cdata"` }
type Tracking ¶
type Tracking struct { // The name of the event to track for the element. The creativeView should // always be requested when present. // // Possible values are creativeView, start, firstQuartile, midpoint, thirdQuartile, // complete, mute, unmute, pause, rewind, resume, fullscreen, exitFullscreen, expand, // collapse, acceptInvitation, close, skip, progress. Event string `xml:"event,attr"` // The time during the video at which this url should be pinged. Must be present for // progress event. Must match (\d{2}:[0-5]\d:[0-5]\d(\.\d\d\d)?|1?\d?\d(\.?\d)*%) Offset *Offset `xml:"offset,attr,omitempty" json:",omitempty"` URI string `xml:",cdata"` // custom attr UA string `xml:"ua,attr,omitempty" json:",omitempty"` }
<Tracking> defines an event tracking URL
type TrackingEvents ¶
type TrackingEvents struct {
Tracking []Tracking `xml:"Tracking,omitempty"`
}
type UniversalAdID ¶
<UniversalAdID> describes a VAST 4.x universal ad id.
type VAST ¶
type VAST struct { XMLName xml.Name `xml:"VAST"` // The version of the VAST spec (should be either "2.0" or "3.0") Version string `xml:"version,attr" json:",omitempty"` // XML namespace. Most likely 'http://www.iab.com/VAST' XMLNS string `xml:"xmlns,attr,omitempty" json:"xmlns,omitempty"` // One or more Ad elements. Advertisers and video content publishers may // associate an <Ad> element with a line item video ad defined in contract // documentation, usually an insertion order. These line item ads typically // specify the creative to display, price, delivery schedule, targeting, // and so on. Ads []Ad `xml:"Ad,omitempty" json:"Ad,omitempty"` // Contains a URI to a tracking resource that the video player should request // upon receiving a “no ad” response Errors []CDATAString `xml:"Error,omitempty" json:",omitempty"` Mute bool `xml:"mute,attr,omitempty" json:",omitempty"` }
VAST is the root <VAST> tag
type Verification ¶
type Verification struct { // An identifier for the verification vendor. The recommended format is [domain]- [useCase], // to avoid name collisions. For example, "company.com-omid". Vendor string `xml:"vendor,attr,omitempty"` // A container for the URI to the JavaScript file used to collect verification data. // Some verification vendors may provide JavaScript executables which work in non-browser environments, // for example, in an iOS app enabled by JavaScriptCore. These resources only require methods of the API framework, // without relying on any browser built-in functionality. JavaScriptResource []JavaScriptResource `xml:"JavaScriptResource,omitempty"` // A reference to a non-JavaScript or custom-integration resource intended for collecting verification data via the listed apiFramework. ExecutableResource []ExecutableResource `xml:"ExecutableResource,omitempty"` // The verification vendor may provide URIs for tracking events relating to the execution of their code during the ad session. TrackingEvents *TrackingEvents `xml:"TrackingEvents,omitempty"` // <VerificationParameters> contains a CDATA-wrapped string intended for bootstrapping the verification code and providing metadata about the current impression. // The format of the string is up to the individual vendor and should be passed along verbatim. VerificationParameters *VerificationParameters `xml:",omitempty"` // ad categories are used in creative separation and for compliance in certain programs BlockedAdCategories []Category `xml:",omitempty"` }
The <Verification> element contains the executable and bootstrapping data required to run the measurement code for a single verification vendor. Multiple <Verification> elements may be listed, in order to support multiple vendors, or if multiple API frameworks are supported. At least one <JavaScriptResource> or <ExecutableResource> should be provided. At most one of these resources should selected for execution, as best matches the technology available in the current environment.
type VerificationParameters ¶
type VerificationParameters struct { // CDATA-wrapped metadata string for the verification executable URI string `xml:",cdata"` }
type VideoClick ¶
type VideoClick struct { ID string `xml:"id,attr,omitempty" json:",omitempty"` URI string `xml:",cdata"` }
<VideoClick> defines a click URL for a linear creative
type VideoClicks ¶
type VideoClicks struct { ClickTrackings []VideoClick `xml:"ClickTracking,omitempty" json:",omitempty"` CustomClicks []VideoClick `xml:"CustomClick,omitempty" json:",omitempty"` ClickThroughs []VideoClick `xml:"ClickThrough,omitempty" json:",omitempty"` }
<VideoClicks> contains types of video clicks
type ViewableImpression ¶
type ViewableImpression struct { // An ad server id for the impression. // Viewable impression resources of the same id should be requested at the same time, // or as close in time as possible, to help prevent discrepancies. ID string `xml:"id,attr"` // The <Viewable> element is used to place a URI that the player triggers if and when // the ad meets criteria for a viewable video ad impression. Viewable []CDATAString `xml:"Viewable,omitempty"` // The <NotViewable> element is a container for placing a URI that the player triggers // if the ad is executed but never meets criteria for a viewable video ad impression. NotViewable []CDATAString `xml:"NotViewable,omitempty"` // The <ViewUndetermined> element is a container for placing a URI that the player triggers // if it cannot determine whether the ad has met criteria for a viewable video ad impression. ViewUndetermined []CDATAString `xml:"ViewUndetermined,omitempty"` }
The ad server may provide URIs for tracking publisher-determined view-ability
type Wrapper ¶
type Wrapper struct { // The name of the ad server that returned the ad AdSystem *AdSystem // A URI representing an error-tracking pixel; this element can occur multiple // times. Errors []CDATAString `xml:"Error,omitempty" json:"Error,omitempty"` // XML node for custom extensions, as defined by the ad server. When used, a // custom element should be nested under <Extensions> to help separate custom // XML elements from VAST elements. The following example includes a custom // xml element within the Extensions element. Extensions *[]Extension `xml:"Extensions>Extension,omitempty" json:",omitempty"` // One or more URIs that directs the video player to a tracking resource file that the // video player should request when the first frame of the ad is displayed Impressions []Impression `xml:"Impression"` // The container for one or more <Creative> elements Creatives []CreativeWrapper `xml:"Creatives>Creative"` // URL of ad tag of downstream Secondary Ad Server VASTAdTagURI CDATAString // Provides a value that represents a price that can be used by real-time bidding // (RTB) systems. VAST is not designed to handle RTB since other methods exist, // but this element is offered for custom solutions if needed. Pricing *Pricing `xml:",omitempty" json:",omitempty"` // The ad server may provide URIs for tracking publisher-determined viewability, // for both the InLine ad and any Wrappers, using the <ViewableImpression> element. // Tracking URIs may be provided in three containers: <Viewable>, <NotViewable>, and <ViewUndetermined>. ViewableImpression *ViewableImpression `xml:",omitempty" json:",omitempty"` // The <AdVerifications> element contains one or more <Verification> elements, // which list the resources and metadata required to execute third-party measurement code in order to verify creative playback. // The <AdVerifications> element is used to contain one or more <Verification> elements, // which are used to initiate a controlled container where code can be executed for collecting data to verify ad playback details. AdVerifications *AdVerifications `xml:"AdVerifications,omitempty" json:",omitempty"` FallbackOnNoAd *bool `xml:"fallbackOnNoAd,attr,omitempty" json:",omitempty"` AllowMultipleAds *bool `xml:"allowMultipleAds,attr,omitempty" json:",omitempty"` FollowAdditionalWrappers *bool `xml:"followAdditionalWrappers,attr,omitempty" json:",omitempty"` }
<Wrapper> element contains a URI reference to a vendor ad server (often called a third party ad server). The destination ad server either provides the ad files within a VAST <InLine> ad element or may provide a secondary Wrapper ad, pointing to yet another ad server. Eventually, the final ad server in the ad supply chain must contain all the necessary files needed to display the ad.