Discarding only pre rolls

85 views
Skip to first unread message

Nalin saxena

unread,
Apr 23, 2024, 3:01:39 PMApr 23
to Interactive Media Ads SDK
Hi IMA Team,

We are using IMA HTML5 SDK.

What we want to achieve- We want to only cancel the pre roll ads if after a set configured value (at our end) as elapsed pre rolls are not fetched. We will resume to content post that.

We do not want to loose the midrolls in this case.

Can you suggest the best way to implement this?


IMA SDK

unread,
Apr 23, 2024, 3:09:57 PMApr 23
to ima...@googlegroups.com
Hi Nalin,

Thank you for contacting us.

For discarding pre roll ads you can use discardAdBreak method when pre roll ads are about to start.

If an ad break is currently playing, discard it and resume content. Otherwise, ignore the next scheduled ad break. For example, this can be called immediately after the ads manager loads to ignore a preroll without losing future midrolls or postrolls. This is a no-op unless the ad request returned a playlist or VMAP response.

For more detail refer this.

This message is in relation to case "ref:!00D1U01174p.!5004Q02tPI8J:ref" (ADR-00232346)

Thanks,
 
Google Logo IMA SDK Team

 

Nalin saxena

unread,
Apr 24, 2024, 9:54:19 AMApr 24
to Interactive Media Ads SDK
Hi ,

thank you for your response,

Will calling discardAdBreak on LOADED event of pre-roll  cancel the pre-roll ?

Does the sdk fire any event when discardAdBreak is fired ? 

 https://developers.google.com/interactive-media-ads/docs/sdks/html5/client-side/reference/js/google.ima.AdEvent

Thank you
Best 
Nalin

IMA SDK

unread,
Apr 24, 2024, 4:47:35 PMApr 24
to ima...@googlegroups.com
Hey Nalin,


Thank you for contacting us.

I am checking your issue, i will get back with the solution shortly.

IMA SDK

unread,
Apr 24, 2024, 5:29:31 PMApr 24
to ima...@googlegroups.com
Hi Nalin,

Yes, if you are using VMAP source ad, then after ad loaded event then after discardAdBreak() will work and discard the ads for pre roll too.
Since the ad was not started so no event will fire after loaded event.
You can achieve this thing by below code,
 if (adEvent.type == google.ima.AdEvent.Type.LOADED) {
this.adsManager_.discardAdBreak();
// Handle your upcoming things, here ads will not start and no event will fire after this.
}

Thanks

Nalin saxena

unread,
Apr 29, 2024, 2:00:39 PMApr 29
to Interactive Media Ads SDK
Hi Team,

Thanks for your previous response , It seems to be working at a higher level , the pre rolls are getting omitted and midrolls stay intact

However on taking a deeper look https://imasdk.googleapis.com/js/sdkloader/ima3_debug.js with the help of debug version of ima I can see that the below logs are getting printed

[  2.343s] [VastAdSource] processInlineAd, successCallback with 1 ads
[  2.344s] [ima.loader.SequentialAdsLoader] Starting request from queue.
  [  2.344s] [ima.loader.AdsLoaderImpl] dispatchAdBreakAdsLoaded_, ads.length: 1

[  2.368s] [UrlReporter] Reporting urls for event : show_ad
[  2.370s] [UrlMacrosReplacer] No macro definition found for: UACH 

The one I have marked in red is my concern , if we are calling discard Ad break why is the show ad impression still fired ? Is this a bug with sdk ?
Message has been deleted

Manish Kumar

unread,
May 6, 2024, 1:02:41 PMMay 6
to Interactive Media Ads SDK
Hi Team,

As per the lifecycle event CONTENT_PAUSE_REQUESTED is called after AD_LOADED.
If I call discardAdBreak() after AD_LOADED, we are still receiving the CONTENT_PAUSE_REQUESTED event. 
Is this the expected behavior or is there any async flow going on ?


On Tuesday, April 30, 2024 at 5:12:09 AM UTC+5:30 IMA SDK wrote:
Hi Nalin,

Thanks for contacting again.

I've checked the shared info in debug environment. 
show_ad is a internal SDK log message not made for reporting purpose, I can see, it is not impacting and engaging with any events. 
These thing can be checked in production as well debug env both.
Please note if any ads are discarding then no trackings are supposed to performed through SDK.
But if you want to track these thing on your side, you can add custom code just before where you are discarding the ads.

Please get back to us in case you are facing any other issue with IMA SDK.

 
This message is in relation to case "ref:!00D1U01174p.!5004Q02tPI8J:ref" (ADR-00232346)

Thanks,
 
Google Logo IMA SDK Team


Disclaimer: “The information contained herein (including any accompanying documents) is confidential and is intended solely for the addressee(s). If you have erroneously received this e-mail, please immediately delete the message and any attachments and notify the sender. Also, if you are not the intended recipient, you are hereby notified that any disclosure, copying, distribution or taking any action in reliance on the contents of this message or any accompanying document is strictly prohibited and is unlawful. The organization is not responsible for any damage caused by a virus or alteration of the e-mail by a third party or otherwise. E-mail is not a 100% virus-free or secure medium. It is your responsibility to ensure that viruses do not adversely affect your system and that your messages to us meet your own security requirements. The contents of this message may not necessarily represent the views or policies of Viacom 18 Media Pvt. Ltd."

Interactive Media Ads SDK

unread,
May 6, 2024, 1:18:48 PMMay 6
to Interactive Media Ads SDK
This is expected, CONTENT_PAUSE_REQUESTED will be called to indicate that there are no more ads to be played and content should resume.
Message has been deleted

IMA SDK

unread,
May 7, 2024, 2:26:08 AMMay 7
to ima...@googlegroups.com
Hi Nalin,

Yes, this is expected behavior, CONTENT_PAUSE_REQUESTED will be call after discardAdBreak().
This can be check by adding eventHandler and console log event in Sample project. 

var events = [
.....
google.ima.AdEvent.Type.CONTENT_PAUSE_REQUESTED,
....
];
Ads.prototype.onAdEvent_ = function(adEvent) {
this.application_.log('Ad event: ' + adEvent.type);
For tracking purpose you can refer this event too CONTENT_PAUSE_REQUESTED but in case you are having some special condition in which you wanted to track only discardAdBreak case, then as mentioned previously you should put your tracking code inside LOADED where you are discarding the ads.

Like below

if event == LOADED {
if (your condition to discardAdBreak) {
this.adsManager_.discardAdBreak();
// Put your tracking here.
}
}

You can use CONTENT_PAUSE_REQUESTED too but might be this event will be calling for non discarding ads case too so it will be difficult to get the exact case of pausing ads.
Please do reach out to us again in case facing any other issue related to IMA SDK,
Reply all
Reply to author
Forward
0 new messages