Skip to content
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 Analytics Adapter: Bid response time logging #8510

Merged
merged 21 commits into from
Jul 7, 2022

Conversation

jsadwith
Copy link
Contributor

@jsadwith jsadwith commented Jun 1, 2022

Type of change

  • Feature

Description of change

Adds support for bid response time logging for Kargo bids

  • contact email of the adapter’s maintainer: jeremy@kargo.com
  • official adapter submission

Other information

Related: prebid/prebid.github.io#3818

@ChrisHuie ChrisHuie self-requested a review June 8, 2022 14:48
@ChrisHuie ChrisHuie self-assigned this Jun 8, 2022
@patmmccann patmmccann requested review from robertrmartinez and removed request for ChrisHuie June 14, 2022 14:32
@jsadwith
Copy link
Contributor Author

@robertrmartinez do you need anything from our end to get started on the review?

@robertrmartinez
Copy link
Collaborator

@jsadwith

So with this code it looks like

=> On a given page load
=> Only the first bid response from kargo will be sent with its information to your endpoint.

Any bid response from kargo after that WILL NOT be sent.

What if a pub runs many aucitons on a given page? Do you still only want just one bidResponse event sent to your data pipeline?

@jsadwith
Copy link
Contributor Author

@robertrmartinez thanks for pointing that out. I've updated the code to reset the bool on auction end. We don't want to send multiple events for the same auction, but this should reset it for any additional auctions on the page.

@robertrmartinez
Copy link
Collaborator

For majority of use cases this is prob fine.

If pub runs multiple auctions at a time, then you can get weird results where only one event will be sent depending on when auction end fires per auction.

But seems like you do not really care too much about this.

If you did then what you could do is set a map of bools instead of just one global one. Offset by the auctionId so you only set it once per auctionId found.

No big deal though.

}

_logBidResponseData.auctionId = bidResponse.auctionId;
_logBidResponseData.responseTime = bidResponse.responseTimestamp - bidResponse.requestTimestamp;
Copy link
Collaborator

Choose a reason for hiding this comment

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

I think prebid core sets a param on this object called timeToRespond which is essentially this.

Also, you want to only track when your exchange does a VALID bid response? Not when it no-bids or errors?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated to use timeToResponse - thanks for pointing that out.

Confirmed - for now we want to just track valid bid responses.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this still is using response - request timestamps.

It is really up to you, just noting that there is timeToRespond available which is essentially the same thing.

@jsadwith
Copy link
Contributor Author

Great idea on using a map to store the auction IDs - I decided just to use an array of auction IDs to keep it more simple. Is that okay or would you prefer the map?

Copy link
Collaborator

@robertrmartinez robertrmartinez left a comment

Choose a reason for hiding this comment

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

Sorry for such a long delay. I had an extended holiday.

It is fine as is, just left 2 more minor comments, feel free to use them or just let me know if you are fine with how it is!

}

_logBidResponseData.auctionId = bidResponse.auctionId;
_logBidResponseData.responseTime = bidResponse.responseTimestamp - bidResponse.requestTimestamp;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Looks like this still is using response - request timestamps.

It is really up to you, just noting that there is timeToRespond available which is essentially the same thing.

modules/kargoAnalyticsAdapter.js Show resolved Hide resolved
@jsadwith
Copy link
Contributor Author

jsadwith commented Jul 6, 2022

Ahh - looks like I didn't push the last change using timeToRespond - thanks for pointing that out. All set now.

}

_logBidResponseData.auctionId = bidResponse.auctionId;
_logBidResponseData.responseTime = bidResponse.timeToRespond;
Copy link
Collaborator

Choose a reason for hiding this comment

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

so having this object at module scope we could possibly see issues if two auctions are running at same time.

The right thing would prob be to just create a local object based off your wanted params here.

Even the auctionTimeout part may change between auctions.

Now it is probably fine majority of the time. So I can be fine with leaving it if you want.

Let me know.

@robertrmartinez robertrmartinez merged commit 932f581 into prebid:master Jul 7, 2022
bwhisp pushed a commit to bwhisp/Prebid.js that referenced this pull request Jul 13, 2022
* Kargo Bid Adapter: Use currency from Bid Response

* Kargo Bid Adapter: Fix failed test

* Kargo Bid Adapter: adding media type to bid response, supporting vastXml response (prebid#8426)

* kargo adapter - adding mediaType to bid response, conditionally set vastXml field

* kargo adapter - updating tests

* Kargo Bid Adapter: onTimeout Support (#6)

* Adding additional param

* Adding response time function

* Remove debug

* Updating response time log to be set by bid response

* Adding screen width/height to request

* Test fix

* Test fix

* Removing interpretResponse signaling

* Simplifying send data function

* Kargo Analytics Adapter: Update with bid response time support

* Renaming event route for auction data

* Reset bid response data sent bool

* Using array to store logged auctions

* Update to use timeToResponse

* Test fix

Co-authored-by: Wei Wong <wwong@kargo.com>
Co-authored-by: Andy Rusiecki <andy.rusiecki@gmail.com>
ahmadlob referenced this pull request in taboola/Prebid.js Jul 27, 2022
* Kargo Bid Adapter: Use currency from Bid Response

* Kargo Bid Adapter: Fix failed test

* Kargo Bid Adapter: adding media type to bid response, supporting vastXml response (#8426)

* kargo adapter - adding mediaType to bid response, conditionally set vastXml field

* kargo adapter - updating tests

* Kargo Bid Adapter: onTimeout Support (#6)

* Adding additional param

* Adding response time function

* Remove debug

* Updating response time log to be set by bid response

* Adding screen width/height to request

* Test fix

* Test fix

* Removing interpretResponse signaling

* Simplifying send data function

* Kargo Analytics Adapter: Update with bid response time support

* Renaming event route for auction data

* Reset bid response data sent bool

* Using array to store logged auctions

* Update to use timeToResponse

* Test fix

Co-authored-by: Wei Wong <wwong@kargo.com>
Co-authored-by: Andy Rusiecki <andy.rusiecki@gmail.com>
RomainLofaso pushed a commit to criteo-forks/Prebid.js that referenced this pull request Aug 8, 2022
* Kargo Bid Adapter: Use currency from Bid Response

* Kargo Bid Adapter: Fix failed test

* Kargo Bid Adapter: adding media type to bid response, supporting vastXml response (prebid#8426)

* kargo adapter - adding mediaType to bid response, conditionally set vastXml field

* kargo adapter - updating tests

* Kargo Bid Adapter: onTimeout Support (#6)

* Adding additional param

* Adding response time function

* Remove debug

* Updating response time log to be set by bid response

* Adding screen width/height to request

* Test fix

* Test fix

* Removing interpretResponse signaling

* Simplifying send data function

* Kargo Analytics Adapter: Update with bid response time support

* Renaming event route for auction data

* Reset bid response data sent bool

* Using array to store logged auctions

* Update to use timeToResponse

* Test fix

Co-authored-by: Wei Wong <wwong@kargo.com>
Co-authored-by: Andy Rusiecki <andy.rusiecki@gmail.com>
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