-
Notifications
You must be signed in to change notification settings - Fork 2.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update AdButler adapter for Prebid v1.0 #1664
Conversation
Only attempt to build a bid response if we have the information of which bid to respond to.
Now stubbing adLoader instead of spying. Additional changes to ensure all tests still passed.
Prevent AdButler TypeErrors and pass bid request object into the bid response.
Add optional domain parameter to AdButler adapter.
# Conflicts: # src/adapters/adbutler.js # test/spec/adapters/adbutler_spec.js
placementCode: '/123456/header-bid-tag-1' | ||
import {expect} from 'chai'; | ||
import adapterManager from 'src/adaptermanager'; | ||
import bidManager from 'src/bidmanager'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We probably should have been more explicit about this in our docs, but... the bidmanager
is going away in 1.0. The good news is that your tests can be simplified.
New your tests can just create objects with dummy data (bid request, server response, etc), pass them into the spec
methods directly, and then make assertions on the return values. No need to worry about mocks, fake servers, or anything like that. The tests on the bidderFactory
will make sure that your adapter's bids make it into the auction.
Check out the appnexusAst adapter for some working examples..
modules/adbutlerBidAdapter.js
Outdated
export const spec = { | ||
code: BIDDER_CODE, | ||
pageID: Math.floor(Math.random() * 10e6), | ||
zoneCounters: {}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No mutable globals allowed... see the 1.0 conventions.
Can this be moved inside your buildRequests
function?
bidResponse.width = width; | ||
bidResponse.height = height; | ||
bidResponse.ad = serverResponse.ad_code; | ||
bidResponse.ad += spec.addTrackingPixels(serverResponse.tracking_pixels); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Adapters shouldn't add tracking pixels during the auction anymore. Implement getUserSyncs instead. prebid-core
will make sure those pixels get added to the page alongside everyone else's
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the info @dbemiller. We offer our customers the option to track impressions on the client-side. If they've chosen this, their impression pixel would have been added here. Just to verify, if the publisher has userSync disabled, this means there is a chance their impression wouldn't be counted in this way. Is that correct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct. Since tracking pixels affect the publisher's page performance, the prebid leadership decided that they should have the ultimate decision in whether or not to allow them.
That said, most publishers leave the default options... so it's not likely to impact you too much.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I understand the desire to improve publisher page performance. My only concern is that when all syncs are blocked, the winning bidder will not have any way to know that they have won a particular auction. Is there any way for us to provide Prebid with a URL that can be pinged or placed if our bid has won the auction?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there might be some confusion here. It's acceptable to add a tracking pixel to a bid response. This will only fire if the bid wins the auction. I think that's what this is so should be fine.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, thanks for the clarification. Yeah, this function just appends the tracking pixel(s) to the ad code in the bid response.
Also: don't forget to add your |
Thanks for your help! I've committed the recommended changes. |
@mkendall07 to the rescue!... sorry about that. |
This code looks good to me... the only thing preventing merge from my POV is the failing tests. I expected this to be one of those intermittent failures, since it's the c1x adapter tests... but it doesn't look like it is. The tests pass in master, and fail reliably in this branch. Looks like they're doing all sorts of things with |
Hmm. It's strange that my changes are causing an issue since, with the new Prebid requirements, they don't use either window or |
Hey @dbemiller , I just wanted to give you a bit of an update. I've figured out why the c1x test are failing. In their adapter they are referencing Do you think you'd be able to merge my changes in, or will we have to wait for them to update? |
@dharton we definitely can't merge something with broken tests. It would break the CI, so then the tests would fail on everyone else's PRs. If it's just their tests which are broken, I'd recommend fixing them here. We haven't heard back from them about prebid 1.0 updates yet (to my knowledge)... so they might not ever come back to update & fix them. This is always a risk of unit tests with side effects. Your new code looks like it's much safer. |
One other issue I just noticed... this PR introduces an empty file: |
looks great... nice code! |
* 'master' of https://github.com/prebid/Prebid.js: (414 commits) Make response headers available to the specs (prebid#1748) add option to run tests in a specific file (prebid#1727) Update JCM Adapter to 1.0 (prebid#1715) Finished an unfinished comment. (prebid#1749) Platform.io Bidder Adapter update. Prebid v1.0. (prebid#1705) Fix window.top.host cross origin issue when in nested iframes. (prebid#1730) fix log message not displaying when referencing missing bidder (prebid#1737) Allow more than one placement from one page (prebid#1692) Justpremium Adapter bugfix (prebid#1716) Updating license (prebid#1717) realvuBidAdapter (prebid#1571) Update JSDoc to call the module `pbjs` (prebid#1572) Update Beachfront adapter for v1.0 (prebid#1675) Update AdButler adapter for Prebid v1.0 (prebid#1664) Increment pre version Fix for prebid#1628 (allowing standard bidCpmAdjustment) (prebid#1645) Prebid 0.31.0 Release Support native click tracking (prebid#1691) Initial commit for video support for pbs (prebid#1706) Fixes: Immediate adapter response may end auction (prebid#1690) ...
Type of change
Description of change
Update AdButler adapter for Prebid v1.0