Closed savke24 closed 4 months ago
Hello, it seems you're describing the same issue than #429.
No it doesn't need a player object to work but it will need to be initialized with your instance of vast client (optional), the ad object and the creative that you will play. See https://github.com/dailymotion/vast-client-js/blob/master/docs/api/vast-tracker.md for more examples
// with a vastClient instance
const vastTracker = new VASTTracker(vastClient, ad, creative);
// without a vastClient instance
const vastTracker = new VASTTracker(null, ad, creative);
Then you will be responsible to call the VASTTracker trackImpression method at the right time to fire the corresponding VAST trackers. You can check the video tag events on MDN to find the one that correspond the most to your need. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/video#events
// loadeddata event will be triggered by the video tag when the first frame of the media has finished loading.
player.addEventListener('loadeddata', () => {
vastTracker.trackImpression()
});
For other trackers feel free to check all VASTTracker public methods available
Let me know, if it helps 😉
Hi @ZacharieTFR thank You for Your respond.
When you say : "
Then you will be responsible to call the VASTTracker trackImpression method at the right time to fire the corresponding trackers. "
What do you mean by that ? If call trackImpression method outside of player event, will be fired correctly and before calling that method does video needs to be played ?
Yes, it will be fired correctly if the VAST contains an <Impression>
element. But the IAB VAST specification says:
All \<Impression> URIs in the InLine response and any Wrapper responses preceding it should be triggered at the same time when the impression for the ad occurs, or as close in time as possible to when the impression occurs, to prevent impression-counting discrepancies.
so you must call trackImpression as soon as the ad is displayed.
Hi i have idea of trying to implement something like or exactly like Server side adding Ads.
Basically i would like to use this library on client side to fetch VAST tag (which i was able to do) and get ad content url (mp4 file)it self which i than forward to API which is doing slicing in .ts chunks and updating m3u8 manifest.(some basic version of that logic i already have).
What i don't know and can't figure it out is does Vast Tracker require some player object and player events so impression can be successfully executed or it can work with out it and how?
Thank You.
0