Skip to content

mediafuseBidAdapter - Updates, Refactor and Fixes.#14537

Open
ibhattacharya-dev wants to merge 3 commits intoprebid:masterfrom
ibhattacharya-dev:mediafuse-adapter-update
Open

mediafuseBidAdapter - Updates, Refactor and Fixes.#14537
ibhattacharya-dev wants to merge 3 commits intoprebid:masterfrom
ibhattacharya-dev:mediafuse-adapter-update

Conversation

@ibhattacharya-dev
Copy link
Contributor

Type of change

  • Bugfix

  • Feature

  • New bidder adapter

  • Updated bidder adapter

  • Code style update (formatting, local variables)

  • Refactoring (no functional changes, no api changes)

  • Build related changes

  • CI related changes

  • Does this change affect user-facing APIs or examples documented on http://prebid.org?

  • Other

Description of change

Refactored the mediafuseBidAdapter to follow the standard ortbConverter module.
Structure now follows MSFT Bid Adapter due to pending replacement of AppNexus Bid Adapter by the newer Microsoft Bid Adapter for better maintainability.
Fixed Test issues flagged in last Pull Request.

Other information

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: 8a2d492b76

ℹ️ 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".


const extANData = {
prebid: true,
hb_source: 1, // 1 = client/web-originated header bidding request (Xandr source enum)

Choose a reason for hiding this comment

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

P1 Badge Preserve adpod source flag in appnexus request ext

The adapter now hard-codes ext.appnexus.hb_source to 1, so ad pod bids (mediaTypes.video.context === 'adpod') are no longer marked with the adpod source value (7) used previously. In production this makes adpod traffic look like standard instream traffic to Xandr, which can break pod-specific auction behavior (including pod routing/category controls) for publishers already using adpod.

Useful? React with 👍 / 👎.

delete tag.ad_types;
}
chunkedRequests.forEach(batch => {
const data = converter.toORTB({ bidRequests: batch, bidderRequest });

Choose a reason for hiding this comment

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

P1 Badge Restore adpod placement expansion before ORTB conversion

This path converts each incoming bid request directly to ORTB without any adpod-specific expansion, but the previous implementation duplicated adpod placements using adPodDurationSec/durationRangeSec before chunking. For mediaTypes.video.context === 'adpod', this regresses pod fill because only one imp is requested instead of the expected number of pod opportunities.

Useful? React with 👍 / 👎.

extANData.video_frameworks = videoParams.frameworks;
}
} else {
imp.video[param] = videoParams[param];

Choose a reason for hiding this comment

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

P2 Badge Map string playback_method values to numeric enum

The refactor now copies params.video.playback_method straight into imp.video without normalizing legacy string values (e.g. auto_play_sound_off) to Xandr’s numeric enum. Existing publisher configs that still send the string form will emit an invalid type in the outbound request and can lose intended playback targeting.

Useful? React with 👍 / 👎.

function hasOmidSupport(bid) {
let hasOmid = false;
const bidderParams = bid?.params;
const videoParams = bid?.mediaTypes?.video?.api;

Choose a reason for hiding this comment

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

P2 Badge Keep OMID detection for params.video.frameworks

OMID support is now inferred from mediaTypes.video.api (plus top-level params.frameworks), but this drops the legacy params.video.frameworks check that the old adapter used. Bids that still signal OMID via params.video.frameworks: [6] will miss ext.appnexus.iab_support, which can prevent OMID-capable inventory/creative negotiation in those integrations.

Useful? React with 👍 / 👎.

@coveralls
Copy link
Collaborator

coveralls commented Feb 28, 2026

Pull Request Test Coverage Report for Build 22587861530

Warning: This coverage report may be inaccurate.

This pull request's base commit is no longer the HEAD commit of its target branch. This means it includes changes from outside the original pull request, including, potentially, unrelated coverage changes.

Details

  • 1175 of 1237 (94.99%) changed or added relevant lines in 2 files are covered.
  • 46 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+33.2%) to 96.348%

Changes Missing Coverage Covered Lines Changed/Added Lines %
test/spec/modules/mediafuseBidAdapter_spec.js 773 775 99.74%
modules/mediafuseBidAdapter.js 402 462 87.01%
Files with Coverage Reduction New Missed Lines %
src/adloader.js 9 76.92%
src/utils.js 37 90.51%
Totals Coverage Status
Change from base Build #3: 33.2%
Covered Lines: 217731
Relevant Lines: 225983

💛 - Coveralls

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: 71e6d9521a

ℹ️ 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 +470 to +474
if (FEATURES.VIDEO && mediaType === VIDEO) {
bidResponse.ttl = 3600;
if (bid.nurl) {
bidResponse.vastImpUrl = bid.nurl;
}

Choose a reason for hiding this comment

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

P1 Badge Restore adpod response metadata for duration/category targeting

The new video response path returns only generic video fields and no longer builds adpod-specific metadata (video.context, video.durationSeconds, video.dealTier, meta.primaryCatId). For mediaTypes.video.context === 'adpod', the adpod hooks in modules/adpod.js depend on these fields to validate/bucket bids and generate hb_pb_cat_dur; without them, adpod bids can be rejected or produce invalid targeting keys even when the auction otherwise succeeds.

Useful? React with 👍 / 👎.

Comment on lines +385 to +386
if (appObjBid) {
request.app = Object.assign({}, request.app, appObjBid.params.app);

Choose a reason for hiding this comment

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

P2 Badge Move legacy app.device_id into ORTB device object

This compatibility branch now copies params.app directly onto request.app but does not map legacy params.app.device_id into request.device. Existing mobile/webview integrations that still provide identifiers through params.app.device_id will lose device IDs in the ORTB device payload after this refactor, reducing identity match and bidder targeting quality.

Useful? React with 👍 / 👎.

@ibhattacharya-dev ibhattacharya-dev marked this pull request as draft March 2, 2026 12:40
@ibhattacharya-dev ibhattacharya-dev marked this pull request as ready for review March 2, 2026 18:01
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: aad02fe737

ℹ️ 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".

}

const request = formatRequest(payload, bidderRequest);
return request;

Choose a reason for hiding this comment

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

P1 Badge Restore adpod brand-category uniqueness request flag

When pbjs.setConfig({adpod: {brandCategoryExclusion: true}}) is enabled, the previous adapter set brand_category_uniqueness on outbound requests, but this refactor returns the request without adding any equivalent flag. In adpod traffic this can change auction behavior by allowing same-category creatives within a pod, which breaks existing brand-category-exclusion expectations for publishers using this config.

Useful? React with 👍 / 👎.

extANData.video_frameworks = videoParams.frameworks;
}
} else {
imp.video[param] = videoParams[param];

Choose a reason for hiding this comment

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

P2 Badge Normalize legacy video context values before assigning

This branch copies params.video.context straight into imp.video.context, but legacy Mediafuse/AppNexus configs commonly provide string values such as pre_roll, mid_roll, and post_roll that previously were mapped to Xandr numeric enums. Sending the raw string drops that mapping and can silently lose intended video-context targeting for existing integrations.

Useful? React with 👍 / 👎.

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.

2 participants