Skip to content

Comments

Vast trackers: additional event injection feature#14409

Open
vivekyadav15 wants to merge 6 commits intoprebid:masterfrom
media-net:vast-tracker-feature
Open

Vast trackers: additional event injection feature#14409
vivekyadav15 wants to merge 6 commits intoprebid:masterfrom
media-net:vast-tracker-feature

Conversation

@vivekyadav15
Copy link
Contributor

@vivekyadav15 vivekyadav15 commented Feb 3, 2026

Summary

Adds support for analytics adapters to register and inject three VAST tracker types:

  • Impression → injected into VAST as <Impression><![CDATA[url]]></Impression>
  • Error → injected into VAST as <Error><![CDATA[url]]></Error>
  • TrackingEvents → injected into VAST as <TrackingEvents><Tracking event="..."><![CDATA[url]]></Tracking></TrackingEvents>

Analytics adapter contract

registerVastTrackers(MODULE_TYPE_ANALYTICS, name, trackerFn)

trackerFn(bid, {auction, bidRequest}) returns:

{
  impression: string[],
  error: string[],
  trackingEvents: Array<{ event: string, url: string }>
}

How it works for vastXml (direct XML injection)

If the bid already has bidResponse.vastXml, we parse it and append:

  • <Impression> nodes for impression[]
  • <Error> nodes for error[]
  • <Tracking> nodes under <Linear><TrackingEvents> for trackingEvents[]

If <TrackingEvents> (or <Linear>) is missing, the code creates the required nodes before appending tracking events.

How it works for vastUrl / VAST URI (wrapper flow)

If the bid does not have vastXml and instead uses a vastUrl, the video cache wrapper generates a Wrapper VAST XML that:

  • sets <VASTAdTagURI> to the bidder’s VAST URI
  • includes the same trackers (impression/error/trackingEvents) in that wrapper XML

So trackers are applied in both cases:

  • Inline VAST XML → injected directly into the XML
  • VAST URI → added into the generated wrapper XML around the URI

This PR highlights the issue #14353.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4b5fe9eb45

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines 215 to +216
function getVastXml(bid) {
return bid.vastXml ? bid.vastXml : wrapURI(bid.vastUrl, bid.vastImpUrl);
return bid.vastXml ? bid.vastXml : wrapURI(bid.vastUrl, bid.vastTrackers);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Preserve vastImpUrl when wrapping vastUrl bids

This call only passes bid.vastTrackers into wrapURI, so bids that still populate the legacy vastImpUrl (which multiple adapters in this repo do) will no longer get their impression trackers injected when the bid only has vastUrl. That’s a behavior regression for existing adapters unless they’re all updated to emit vastTrackers. Consider merging vastImpUrl into vastTrackers.impression (or passing both) to keep backward compatibility.

Useful? React with 👍 / 👎.

@coveralls
Copy link
Collaborator

Pull Request Test Coverage Report for Build 21713757215

Details

  • 158 of 158 (100.0%) changed or added relevant lines in 4 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.004%) to 96.235%

Totals Coverage Status
Change from base Build 21696531338: 0.004%
Covered Lines: 209840
Relevant Lines: 218050

💛 - Coveralls

if (isValidVastTracker(trackers, trackerToAdd)) {
trackers.push(trackerToAdd);

if (isPlainObject(trackersToAdd)) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not backwards compatible is it? since there's only one user IMO it's worth refactoring it as part of this.

return [
{
event: 'impressions',
url: `${GET_ENDPOINT_RA}?${getLoggingPayload(queryParams, LOG_RA)}`,
},
];

* VAST trackers to attach to this bid (impression, error, and tracking events).
*/
vastImpUrl?: string | string []
vastTrackers?: VastTrackers
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's more adapters that are populating vastImpUrl - either they should be refactored or this should keep accepting it

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. We could introduce a fallback (vastImpUrl) for backward compatibility. However, this would require maintaining two separate mechanisms for the same feature. To minimize confusion and reduce long-term maintenance overhead, I recommend standardizing on the new vastTrackers approach instead of supporting both.

  2. To ensure the latest changes related to vastImpUrl are consistently applied across all impacted components, we can update the following files:

    • targetVideoUtils/bidderUtils.js
    • adrelevantisBidAdapter.js
    • appnexusBidAdapter.js
    • mediafuseBidAdapter.js
    • medianetAnalyticsAdapter.js

Please let me know if you have a different opinion or any concerns.

@patmmccann patmmccann changed the title Vast tracker feature Vast trackers: additional event injection feature Feb 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants