• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

prebid / Prebid.js / 16809528788

07 Aug 2025 03:57PM UTC coverage: 96.254%. Remained the same
16809528788

push

github

web-flow
Risemediatech Bid Adapter : New Bidder Adapter (#13600)

* RM-845 : Initial implementation for risemediatech bid adapter

* RM-845 : Added bidder parameter documentation for risemediatech Bid Adapter

* RM-845 : minor modifications

* RM-845 : Handled es lint errors

* RM-847 : Unit Test for Risemediatech Bid Adapter

* Updated unit tests

* Modified the bid adapter code and unit tests

* Modified prebid js code to remove validations and also added bidfloor to the request.

* added the vastxml field in the response for the video media type

* Fixed incorrect media type issue

* Added test mode impressions support

* Added test mode for video ad units

* Added bidfloor for example video ad unit

* Updated default TTL

* Minro fixes

* Update docs

* Minor changes

* Minor changes

* Code cleanup

* Changes as per review

* Semantic changes

* Added support for Http Status 204 No Bids Scenarios

* Updated failing unit tests.

* Modified the check for no bids

* Reverted the status check

* linter modifications

* Updated the documentation for the adapter and formatted adapter

* Modified the documentation as per discussion

* Resolved linter errors from upstream repo PR

39576 of 48646 branches covered (81.36%)

237 of 244 new or added lines in 2 files covered. (97.13%)

148 existing lines in 17 files now uncovered.

195874 of 203497 relevant lines covered (96.25%)

123.67 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

22.58
/modules/debugging/responses.js
1
const ORTB_NATIVE_ASSET_TYPES = ['img', 'video', 'link', 'data', 'title'];
2✔
2

3
function getSlotDivid(adUnitCode) {
UNCOV
4
  const slot = window.googletag?.pubads?.()?.getSlots?.()?.find?.((slot) => {
×
UNCOV
5
    return slot.getAdUnitPath() === adUnitCode || slot.getSlotElementId() === adUnitCode
×
6
  });
UNCOV
7
  return slot?.getSlotElementId();
×
8
}
9

10
export default function ({Renderer, BANNER, NATIVE, VIDEO}) {
51✔
11
  return {
51✔
12
    [BANNER]: (bid, bidResponse) => {
13
      if (!bidResponse.hasOwnProperty('ad') && !bidResponse.hasOwnProperty('adUrl')) {
18✔
14
        let [size, repeat] = (bidResponse.width ?? bidResponse.wratio) < (bidResponse.height ?? bidResponse.hratio) ? [bidResponse.width, 'repeat-y'] : [bidResponse.height, 'repeat-x'];
18!
15
        size = size == null ? '100%' : `${size}px`;
18!
16
        bidResponse.ad = `<html><body><div style="display: inline-block; height: ${bidResponse.height == null ? '100%' : bidResponse.height + 'px'}; width: ${bidResponse.width == null ? '100%' : bidResponse.width + 'px'}; background-image: url(https://vcdn.adnxs.com/p/creative-image/27/c0/52/67/27c05267-5a6d-4874-834e-18e218493c32.png); background-size: ${size}; background-repeat: ${repeat}"></div></body></html>`;
18!
17
      }
18
    },
19
    [VIDEO]: (bid, bidResponse) => {
UNCOV
20
      if (!bidResponse.hasOwnProperty('vastXml') && !bidResponse.hasOwnProperty('vastUrl')) {
×
21
        bidResponse.vastXml = '<?xml version="1.0" encoding="UTF-8"?><VAST version="3.0"><Ad><InLine><AdSystem>GDFP</AdSystem><AdTitle>Demo</AdTitle><Description><![CDATA[Demo]]></Description><Creatives><Creative><Linear ><Duration>00:00:11</Duration><VideoClicks><ClickThrough><![CDATA[https://prebid.org/]]></ClickThrough></VideoClicks><MediaFiles><MediaFile delivery="progressive" width="640" height="360" type="video/mp4" scalable="true" maintainAspectRatio="true"><![CDATA[https://s3.amazonaws.com/files.prebid.org/creatives/PrebidLogo.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>';
×
22
        bidResponse.renderer = Renderer.install({
×
23
          url: 'https://cdn.jwplayer.com/libraries/l5MchIxB.js',
24
        });
25
        bidResponse.renderer.setRender(function (bid, doc) {
×
26
          const parentId = getSlotDivid(bid.adUnitCode) ?? bid.adUnitCode;
×
UNCOV
27
          const div = doc.createElement('div');
×
UNCOV
28
          div.id = `${parentId}-video-player`;
×
UNCOV
29
          doc.getElementById(parentId).appendChild(div);
×
UNCOV
30
          const player = window.jwplayer(div.id).setup({
×
31
            debug: true,
32
            width: bidResponse.width,
33
            height: bidResponse.height,
34
            advertising: {
35
              client: 'vast',
36
              outstream: true,
37
              endstate: 'close'
38
            },
39
          });
40
          player.on('ready', async function () {
×
UNCOV
41
            if (bid.vastUrl) {
×
UNCOV
42
              player.loadAdTag(bid.vastUrl);
×
43
            } else {
UNCOV
44
              player.loadAdXml(bid.vastXml);
×
45
            }
46
          });
47
        })
48
      }
49
    },
50
    [NATIVE]: (bid, bidResponse) => {
UNCOV
51
      if (!bidResponse.hasOwnProperty('native')) {
×
UNCOV
52
        bidResponse.native = {
×
53
          ortb: {
54
            link: {
55
              url: 'https://www.link.example',
56
              clicktrackers: ['https://impression.example']
57
            },
58
            assets: bid.nativeOrtbRequest.assets.map(mapDefaultNativeOrtbAsset)
59
          }
60
        }
61
      }
62
    }
63
  }
64

65
  function mapDefaultNativeOrtbAsset(asset) {
UNCOV
66
    const assetType = ORTB_NATIVE_ASSET_TYPES.find(type => asset.hasOwnProperty(type));
×
UNCOV
67
    switch (assetType) {
×
68
      case 'img':
UNCOV
69
        return {
×
70
          ...asset,
71
          img: {
72
            type: 3,
73
            w: 600,
74
            h: 500,
75
            url: 'https://vcdn.adnxs.com/p/creative-image/27/c0/52/67/27c05267-5a6d-4874-834e-18e218493c32.png',
76
          }
77
        }
78
      case 'video':
UNCOV
79
        return {
×
80
          ...asset,
81
          video: {
82
            vasttag: '<?xml version="1.0" encoding="UTF-8"?><VAST version="3.0"><Ad><InLine><AdSystem>GDFP</AdSystem><AdTitle>Demo</AdTitle><Description><![CDATA[Demo]]></Description><Creatives><Creative><Linear ><Duration>00:00:11</Duration><VideoClicks><ClickThrough><![CDATA[https://prebid.org/]]></ClickThrough></VideoClicks><MediaFiles><MediaFile delivery="progressive" width="640" height="360" type="video/mp4" scalable="true" maintainAspectRatio="true"><![CDATA[https://s3.amazonaws.com/files.prebid.org/creatives/PrebidLogo.mp4]]></MediaFile></MediaFiles></Linear></Creative></Creatives></InLine></Ad></VAST>'
83
          }
84
        }
85
      case 'data': {
UNCOV
86
        return {
×
87
          ...asset,
88
          data: {
89
            value: '5 stars'
90
          }
91
        }
92
      }
93
      case 'title': {
UNCOV
94
        return {
×
95
          ...asset,
96
          title: {
97
            text: 'Prebid Native Example'
98
          }
99
        }
100
      }
101
    }
102
  }
103
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc