-
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
Kargo Adapter for Prebid 1.0 #1729
Conversation
hey @samuelhorwitz, is there any reason you made this PR against the This helps us with branch maintenance, because otherwise all the patches & bugfixes to your adapter between now and the 1.0 release will become merge conflicts. CurrencyIt looks like you're doing the right thing to me. Import the @snapwich may want to overrule me here, as he's more familiar with the module... but your code here looks like it should work to me. |
I can change the base of this PR, but should I actually rebase my branch off of master? If I change the base without rebasing, this PR will become much more complicated to review, but if I rebase from master I will be working off of a branch that doesn't include any of the 1.0 updates |
You should create a branch from master, and open a PR against master. The 1.0 branch doesn't change any adapter-facing APIs in the
|
modules/kargoBidAdapter.js
Outdated
const HOST = 'https://krk.kargo.com'; | ||
export const spec = { | ||
code: BIDDER_CODE, | ||
aliases: [], |
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 need to define this if it's an empty array.... you can just leave it out.
modules/kargoBidAdapter.js
Outdated
if (adUnit.receivedTracker) { | ||
let el = document.createElement('img'); | ||
el.src = adUnit.receivedTracker; | ||
document.body.appendChild(el); |
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.
sync pixels need to be added using the userSync module
You can also implement getUserSyncs, in which case the bidderFactory
will put them in the userSync
module for you. This would probably be easier for you to test.
Either way, prebid-core will attach them to the page after the auction's over.
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.
When do user syncs fire? We can just leave this off if it's not an immediate thing... we use this tracker to log that an ad unit was received by the page but if it's not fired in a deterministically "soon" fashion then it's better we just leave it off.
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.
Aha... ok. Not a user sync at all, then.
Yeah... there's no real good way to do that. Publishers get annoyed by libraries making extra requests because of the impact it has on page load times.
You could use the user sync module if you want... by default, we fire them 3 seconds after the auction has completed.
However, it still wouldn't be reliable. Since it affects the publishers' page performance, Prebid made this configurable... so they can limit the number that fire, opt out totally, etc.
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 okay cool, I will remove it then
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.
Sure thing.
If this is a feature you guys really need, I'd recommend opening an issue about it. I don't know how the Prebid.JS leadership feels about supporting this, but that's a good way to get discussion going with some more eyes on it.
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've created a ticket here #1762 but it's not urgent for us to have this support and I've just removed the code
modules/kargoBidAdapter.js
Outdated
return bidResponses; | ||
}, | ||
|
||
// PRIVATE |
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.
You can make these truly private if you pull them off the spec
object, and just define them as helper functions in the top level of your file.
If they're not export
ed, they're safe.
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.
For some reason I thought I mocked these more than I did in tests so I made them "private" as opposed to out of closure scope. I don't think I actually do, though. That being said, I don't really mind either way, I added that comment to visually separate the interface functionality from the behind the scenes functionality.
modules/kargoBidAdapter.js
Outdated
let adUnit = adUnits[adUnitId]; | ||
bidResponses.push({ | ||
requestId: bids[adUnitId].bidId, | ||
bidderCode: spec.code, |
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.
Our docs are bad here, but... don't send back the bidderCode
on bids. The bidderFactory
adds it to you, and this won't work quite right if someone aliases your adapter (which can be done by customers at runtime)
modules/kargoBidAdapter.js
Outdated
|
||
_getCrbIds() { | ||
try { | ||
const crb = JSON.parse(decodeURIComponent(spec._readCookie('krg_crb'))); |
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.
what's this cookie you are reading? How do you have access to it if you are in the pub domain?
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.
These are first party cookies our pubs are likely to already have on their page from our various other integrations.
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.
ok that's what I thought. Thanks for clarifying.
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 problem
So, I just modified this PR to be derived from master/pointing to master. However I will need to re-run some of my own tests to make sure all my changes still work. |
Sounds good, let me know when you're comfortable with it. |
Okay everything seems good from our tests! Thank you |
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.
Looks good to me. I left a few non-essential suggestions I just noticed while testing things... but not a big deal.
modules/kargoBidAdapter.md
Outdated
``` | ||
var adUnits = [{ | ||
code: 'div-gpt-ad-1460505748561-1', | ||
sizes: [[300,250][1,1]], |
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.
Looks like you're missing a comma here.
**Module Type**: Bidder Adapter | ||
**Maintainer**: [email protected] | ||
|
||
# Description |
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.
You might want to mention something about how this only works on mobile.
I tried this and thought I wasn't getting a bid back... but I put my browser in mobile mode and then it worked. Didn't realize that was a dependency. Others may run into the same problem.
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 updated this as well but its below the line commented on so Github didnt dismiss it
agh... sorry about this, but one more change, because #1742 got merged before we could get this in. The first argument to interpretResponse now looks like this:
You'll have to update the spec so that it looks through that object as well now. |
Alright, done! |
Hey, sorry about this but now I have one last thing I need to add also! It should be a very quick/small change to what we send to our bidder. |
no worries... do what you've gotta do ^^ |
Alright finished again! |
* 'master' of https://github.com/prebid/Prebid.js: (22 commits) Update GetIntent adapter to 1.0 version (prebid#1721) Add `usePaymentRule` param to AN bidders (prebid#1778) New hooks API (replaces monkey-patching for currency) (prebid#1683) Change prebidServer to call client user syncs if they exist (prebid#1734) Fix Centro adapter to allow requests of the same units (prebid#1746) add vastUrl + media type for video bids Prebid Server (prebid#1739) Update adxcg adapter for prebid 1.0 (prebid#1741) Update yieldmoBid adapter request url (prebid#1771) Upgrade Quantcast adapter for Prebid 1.0 (prebid#1753) Fidelity Media Adapter update. Prebid v1.0 (prebid#1719) Kargo Adapter for Prebid 1.0 (prebid#1729) updated for prebid 1.0 api (prebid#1722) Add AdOcean adapter (prebid#1735) Update Conversant adapter to Prebid 1.0 (prebid#1711) Fix test-coverage bug (prebid#1765) Migrating TrustX adapter to 1.0 (prebid#1709) Update Improve Digital adapter for Prebid 1.0 (prebid#1728) Fixed the argument type on getUserSyncs. (prebid#1767) nanointeractive bid adapter (prebid#1627) Validating bid response params (prebid#1738) ...
* tag '0.32.0' of https://github.com/prebid/Prebid.js: (44 commits) Prebid 0.32.0 Release Commenting out tests that are failing in IE10 (prebid#1710) Update dfp.buildVideoUrl to accept adserver url (prebid#1663) Update rubicon adapter with new properties and 1.0 changes (prebid#1776) Added adUnitCode for compatibility (prebid#1781) Remove 'supported' from analytics adapter info (prebid#1780) Add TTL parameter to bid (prebid#1784) Update GetIntent adapter to 1.0 version (prebid#1721) Add `usePaymentRule` param to AN bidders (prebid#1778) New hooks API (replaces monkey-patching for currency) (prebid#1683) Change prebidServer to call client user syncs if they exist (prebid#1734) Fix Centro adapter to allow requests of the same units (prebid#1746) add vastUrl + media type for video bids Prebid Server (prebid#1739) Update adxcg adapter for prebid 1.0 (prebid#1741) Update yieldmoBid adapter request url (prebid#1771) Upgrade Quantcast adapter for Prebid 1.0 (prebid#1753) Fidelity Media Adapter update. Prebid v1.0 (prebid#1719) Kargo Adapter for Prebid 1.0 (prebid#1729) updated for prebid 1.0 api (prebid#1722) Add AdOcean adapter (prebid#1735) ...
Description of change
Kargo Adapter migrated to Prebid 1.0
Notes
As a side note, I would like some clarification on currency support. Does the publisher always specify conversion rates? We have multiple currency support being added into our server-side code and I would like to know the best way to configure things so that our rates our used when the pub specifies a compatible non-USD currency. We will be returning our CPMs in the currency the publisher specifies already converted on our end. I'm unsure however of how I should implement this in the adapter. Thank you!