video-ad-sdk
Version:
VAST/VPAID SDK that allows video ads to be played on top of any player
15 lines (14 loc) • 566 B
JavaScript
import { getAdErrorURI, getVastErrorURI } from '../../vastSelectors';
import { pixelTracker } from './pixelTracker';
/**
* Tracks an error.
*
* @param vastChain the ad VAST Chain.
* @param options Options Map
*/
export const trackError = (vastChain, { errorCode, tracker = pixelTracker }) => {
vastChain.forEach(({ ad, parsedXML }) => {
const errorURIs = (ad && getAdErrorURI(ad)) || getVastErrorURI(parsedXML);
errorURIs === null || errorURIs === void 0 ? void 0 : errorURIs.forEach((uri) => uri && tracker(uri, { errorCode }));
});
};