-
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
Rubicon analytics #2278
Rubicon analytics #2278
Conversation
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.
Overall LGTM. Just a few comments/questions.
src/adaptermanager.js
Outdated
@@ -112,6 +112,8 @@ function getAdUnitCopyForPrebidServer(adUnits) { | |||
let adUnitsCopy = utils.deepClone(adUnits); | |||
|
|||
adUnitsCopy.forEach((adUnit) => { | |||
// TODO: fix! this should probably happen in the adapter rather than here. now all the analytics adapters as well as | |||
// `getBids` above need to deal w/ potentially two different size formats. |
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.
good callout
@@ -130,6 +137,7 @@ export default function AnalyticsAdapter({ url, analyticsType, global, handler } | |||
utils._each(_handlers, (handler, event) => { | |||
events.off(event, handler); | |||
}); | |||
this.enableAnalytics = this._oldEnable ? this._oldEnable : _enable; |
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'm not clear on what this change is for.
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.
enableAnalytics
is overwritten w/ the error message function above when an analytics adapter is enabled. This new code I added sets enableAnalytics
back to the correct enable function when analytics is disabled (can't just set it back to _enable
as some analytics extend enalbeAnalytics
with a new function).
Probably not a use case you'd encounter much in production (disabling analytics and then enabling again), but in test cases it was an issue. Many of the analytics adapters were causing issues with other test suites as they were not cleaning up their event handlers, probably in part because cleaning them up (using disableAnalytics
) didn't allow you to listen again since enableAnalytics
was overwritten; this fixes that.
@@ -194,7 +194,7 @@ $$PREBID_GLOBAL$$.setTargetingForAst = function() { | |||
targeting.setTargetingForAst(); | |||
|
|||
// emit event | |||
events.emit(SET_TARGETING); | |||
events.emit(SET_TARGETING, targeting.getAllTargeting()); |
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.
do we doc the event signatures anywhere? Probably needs to be done since we are adding params.
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.
Nowhere that I know of. The events themselves are documented on the publisher API reference page, but it doesn't include details of what arguments the events pass to the event handlers.
I did add a new event bidderDone
event though that should be added to that page. Just created a pull-request: prebid/prebid.github.io#695
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.
@snapwich Looks good. Left some minor comments
case GOOD: | ||
bid.status = 'success'; | ||
break; | ||
case NO_BID: |
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 we do not have NO_BID case any more.
https://github.com/prebid/Prebid.js/blob/master/src/adapters/bidderFactory.js#L299
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.
There's still some instances that can result in NO_BIDs such as in prebid server adapter, currency module, etc. I'll probably leave this here just in case; I can remove later if NO_BIDs end up being removed entirely from the prebid code base.
}; | ||
|
||
// basically lodash#pick that also allows transformation functions and property renaming | ||
function _pick(obj, properties) { |
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.
Should we move this to utils ?
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 could, but I don't think it's necessary. I'd rather leave it here until such time that someone else decides they need to heavily utilize a pick function. Plus I deviated a bit from lodash's implementation of pick
, which could be confusing for others to use if they're not familiar with my intent.
# Conflicts: # src/adaptermanager.js
resolved conflicts |
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.
LGTM
@mjacobsonny -- Rich submitted a doc change for the new bidderDone event. Any others you were looking for? We don't want to put this on the analytics adapter list just yet. |
rubicon analytics adapter
Type of change
Description of change
This includes the new Rubicon analytics adapter. The endpoint will be changed, but for now can be configured with the
endpoint
option when callingpbjs.enableAnalytics
Other information
The karma testing library was updated to use the mocha reporter. It includes more information, better debug information (such as object diffing), and is just overall a better reporter than the
progress-reporter
.An additional
BIDDER_DONE
event was added that signals when a bid adapter has finished responding to bids (this is a solution to better determine no-bids).The
SET_TARGETING
event was modified to also pass the targeting that was set as an event argument.Also a few bug fixes, such as cleaning up handlers left around by other analytics adapters (was causing errors in unrelated tests).