Skip to content

mileRtdProvider initial commit#14636

Merged
patmmccann merged 4 commits into
prebid:masterfrom
automatad:mileRtdModule
May 9, 2026
Merged

mileRtdProvider initial commit#14636
patmmccann merged 4 commits into
prebid:masterfrom
automatad:mileRtdModule

Conversation

@mohanjpAtmd
Copy link
Copy Markdown
Contributor

@mohanjpAtmd mohanjpAtmd commented Mar 24, 2026

Type of change

  • Feature

Description of change

New RTD module for Mile Tech(Automatad). This module hooks on Prebid's lifecycle events like onAuctionInitEvent and onBidResponseEvent which RTD core module provides and adds ad server targeting as key values based on an external loaded JS which provides the values.

Configuration

Use the RTD module with provider name mile:

pbjs.setConfig({
  realTimeData: {
    dataProviders: [
      {
        name: "mile",
        waitForIt: false,
        params: {
          runtimeScriptUrl: "https://cdn.example.com/mile-rtd-runtime.js",
          runtimeGlobalName: "mileRtdRuntime", // optional, default shown
        },
      },
    ],
  },
});

Params

  • runtimeScriptUrl (optional): URL of runtime script to load.
  • runtimeGlobalName (optional): global object name exposing getMileTargetingByAdUnit; defaults to mileRtdRuntime.

@mohanjpAtmd mohanjpAtmd marked this pull request as ready for review March 25, 2026 14:36
@patmmccann
Copy link
Copy Markdown
Collaborator

Why is prebid involved? Why don't you just have your script call the gam set targeting API?

@mohanjpAtmd
Copy link
Copy Markdown
Contributor Author

mohanjpAtmd commented Mar 26, 2026

Why is prebid involved? Why don't you just have your script call the gam set targeting API?

We hook on Prebid's onAuctionInitEvent and onBidResponseEvent events and we make use of RTD core module's auctionDelay or waitForIt features so that we are able to set the required ad server targeting in time.

As a RTD module it makes it easier for the publishers to integrate this functionality to their stack.

@patmmccann
Copy link
Copy Markdown
Collaborator

@codex is this module affecting the bid request or processing the bid response in any meaningful way or are they just using this module to send data to gam

@patmmccann patmmccann self-assigned this Mar 28, 2026
@chatgpt-codex-connector
Copy link
Copy Markdown

Codex couldn't complete this request. Try again later.

Copy link
Copy Markdown

@jdcauley jdcauley left a comment

Choose a reason for hiding this comment

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

A few observations after reviewing the implementation against the patterns used by the other ~51 RTD modules in this repo.

The main concern is the isFlooringEnforcedForAuction gate — this module only applies targeting when floor enforcement is active. Across the entire RTD module ecosystem, no other module gates behavior on enforceJS or enforcements, and only one (oxxionRtdProvider) even references floorData at all. This makes the module look purpose-built to influence floor pricing rather than provide general real-time targeting data.

Suggested changes:

  1. Remove the floor enforcement gate. If the targeting data is genuinely useful for ad serving, it should apply regardless of floor state. This is the most important change to address the architectural concern.

  2. Consider using getTargetingData() instead of direct slot.setTargeting() on GPT. Only 2-3 modules out of 51 directly manipulate GPT slots; the standard pattern (used by ~13 modules) is to return targeting through Prebid's getTargetingData() interface. This makes targeting transparent to publishers and other modules.

  3. If the event hooks (onAuctionInitEvent/onBidResponseEvent) are needed over getTargetingData(), document why. These hooks are rare (2-3 modules each), so clarifying what they provide that the standard interface doesn't would help reviewers.

Comment thread modules/mileRtdProvider.js Outdated
Comment thread modules/mileRtdProvider.js Outdated
if (targetingValue != null) {
slot.setTargeting(TARGETING_KEY, targetingValue);
}
});
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Only 2-3 out of 51 RTD modules directly manipulate GPT slots. The more common pattern (~13 modules) is to implement getTargetingData() on the submodule, which returns targeting through Prebid's pipeline and makes it visible to publishers.

Suggestion: consider replacing setSlotTargeting with a getTargetingData() implementation on the submodule definition. This would also eliminate the direct googletag dependency.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

This is a great point, we should put this in our cove review guidelines and open an issue to fix the 2-3 you mention

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi, the intent of our RTD module is to influence GAM pricing rules and we wish to do it by passing relevant targeting to the ad server(GAM). We agree with your assessment about floor enforcement gate and we have removed it.

However we require the use of setTargeting to ensure that the GAM targeting happens timely. getTargetingData on the other hand is triggered at auctionEnd which can be too late for the targeting keys to be passed to GAM because of failSafe timeouts that most publishers implement. We would want our targeting to be triggered at auctionInit and bidResponse which is not possible with your suggested method.

We also found out this GPT setTargeting pattern being used by other RTD modules, some examples of which are as below:
relevadRtdProvider
sirDataRtdProvider

Please review and let us know how to proceed, thanks.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

this is the main hang up at the moment, i've opened an issue to fix those two.

This is interesting: "getTargetingData on the other hand is triggered at auctionEnd which can be too late for the targeting keys to be passed to GAM because of failSafe timeouts that most publishers implement. " and we'll talk about it in the next PMC

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

see #14711 and #14712 for a couple different options

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

i closed that pr, great point

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mohanjpAtmd please proceed with using our methods, we're picking up #14706 (comment) right away to solve the issue you identified

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mohanjpAtmd there's a pr on the board to solve the issue you flagged about targeting; we welcome your feedback

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @patmmccann, with this change we are able to use adUnit.adserverTargeting to set the targeting at auctionInit at ad unit level. However we also need to be able to set targeting at bidResponse event. Which utility function do you suggest we use for this?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Hi @patmmccann On testing this again we are now able to verify that adUnit.adserverTargeting approach works for us in setting the targeting on auctionInit and bidResponse events and these targetings are getting passed even when the failsafe timeout triggers before the Prebid's auctionEnd.

The change to use adUnit.adserverTargeting is committed to this branch. Please review and let us know how we can proceed.

@github-actions
Copy link
Copy Markdown

Whoa there partner! This project is migrating to typescript. Consider changing the new JS files to TS, with well-defined types for what interacts with the prebid public API (for example: bid params and configuration). Thanks!

  • modules/mileRtdProvider.js

Comment thread modules/mileRtdProvider.ts
@coveralls
Copy link
Copy Markdown
Collaborator

Pull Request Test Coverage Report for Build 23860972488

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

  • 188 of 193 (97.41%) changed or added relevant lines in 2 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.001%) to 96.348%

Changes Missing Coverage Covered Lines Changed/Added Lines %
modules/mileRtdProvider.ts 71 76 93.42%
Totals Coverage Status
Change from base Build 23392478268: 0.001%
Covered Lines: 216573
Relevant Lines: 224782

💛 - Coveralls

Comment thread modules/mileRtdProvider.ts Outdated
Comment on lines +149 to +150
const slotElementId = slot.getSlotElementId?.();
const adUnitPath = slot.getAdUnitPath?.();
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I recommend using isAdunitCodeMatchingSlot to keep it consistent with how the rest of prebid decides how to match ad units with GPT slots.

Copy link
Copy Markdown
Contributor Author

@mohanjpAtmd mohanjpAtmd Apr 22, 2026

Choose a reason for hiding this comment

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

hi @dgirardi we need the actual slotElementId and adUnitPath values, not just checking if they match. We use them to retrieve the targetingValue as shown in line number 151.

Copy link
Copy Markdown
Collaborator

@patmmccann patmmccann left a comment

Choose a reason for hiding this comment

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

should be ready to use our methods with the failsafe timeout concern fixed

@mohanjpAtmd mohanjpAtmd requested a review from patmmccann May 8, 2026 17:26
@patmmccann patmmccann merged commit a7618ce into prebid:master May 9, 2026
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants