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

Adnuntius: Add Price Type #3084

Merged
merged 6 commits into from
Sep 29, 2023
Merged

Adnuntius: Add Price Type #3084

merged 6 commits into from
Sep 29, 2023

Conversation

mikael-lundin
Copy link
Contributor

This PR will allow Prebid server to request a price type. The ad will be returned with either net, or gross bid depending on what you specify.

@github-actions
Copy link

github-actions bot commented Sep 7, 2023

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, d0f130d

adnuntius

Refer here for heat map coverage report

github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:90:	Builder			100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:100:	MakeRequests		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:104:	setHeaders		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:120:	makeEndpointUrl		89.3%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:170:	getImpSizes		90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:193:	generateRequests	90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:287:	MakeBids		81.8%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:314:	getGDPR			85.7%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:339:	generateAdResponse	90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:393:	generateBidResponse	88.0%
total:									(statements)		89.4%

adDomain := []string{}
for _, url := range ad.DestinationUrls {
domainArray := strings.Split(url, "/")
domain := strings.Replace(domainArray[2], "www.", "", -1)
adDomain = append(adDomain, domain)
}

// strings.ToLower(str)
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick: should remove comment

@@ -5,4 +5,5 @@ type ImpExtAdnunitus struct {
Network string `json:"network"`
NoCookies bool `json:"noCookies"`
MaxDeals int `json:"maxDeals"`
PriceType string `json:"priceType,omitempty"`
Copy link
Contributor

@onkarvhanumante onkarvhanumante Sep 11, 2023

Choose a reason for hiding this comment

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

should also update
https://github.com/prebid/prebid-server/blob/71f76eb39e23d778e7ff3356711004775851e56e/static/bidder-params/adnuntius.json bidder params to include priceType as optional param

@mikael-lundin bidder params is also missing entry for maxDeals. Requesting to update bidder param json to include description for priceType and maxDeals

@@ -5,4 +5,5 @@ type ImpExtAdnunitus struct {
Network string `json:"network"`
NoCookies bool `json:"noCookies"`
MaxDeals int `json:"maxDeals"`
PriceType string `json:"priceType,omitempty"`
Copy link
Contributor

@onkarvhanumante onkarvhanumante Sep 11, 2023

Choose a reason for hiding this comment

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

update params tests to add valid and invalid tests for PriceType and maxDeals

@mikael-lundin
Copy link
Contributor Author

Thanks for the feedback, I've changed it and pushed to this PR.

@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 88ee484

adnuntius

Refer here for heat map coverage report

github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:90:	Builder			100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:100:	MakeRequests		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:104:	setHeaders		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:120:	makeEndpointUrl		89.3%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:170:	getImpSizes		90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:193:	generateRequests	90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:287:	MakeBids		81.8%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:314:	getGDPR			85.7%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:339:	generateAdResponse	90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:391:	generateBidResponse	88.0%
total:									(statements)		89.4%

@onkarvhanumante
Copy link
Contributor

@mikael-lundin should create docs PR to include details for PriceType and maxDeals

Comment on lines 44 to 48
Currency string
}
GrossBid struct {
Amount float64
Currency string
Copy link
Contributor

Choose a reason for hiding this comment

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

@mikael-lundin could you help to understand how values are set to NetBid.Currency and GrossBid.Currency. If these vars are not in use then can should remove them

Copy link
Contributor Author

Choose a reason for hiding this comment

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

They are always returned from the ad-server so they will always be included in the response.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

But yeah you are right they can be removed. :)

@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, a7ce04f

adnuntius

Refer here for heat map coverage report

github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:88:	Builder			100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:98:	MakeRequests		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:102:	setHeaders		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:118:	makeEndpointUrl		89.3%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:168:	getImpSizes		90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:191:	generateRequests	90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:285:	MakeBids		81.8%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:312:	getGDPR			85.7%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:337:	generateAdResponse	90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:389:	generateBidResponse	88.0%
total:									(statements)		89.4%

@@ -344,6 +350,18 @@ func generateAdResponse(ad Ad, impId string, html string, request *openrtb2.BidR
}}
}

price := ad.Bid.Amount
priceType, _, _, _ := jsonparser.Get(imp.Ext, "bidder", "priceType")
Copy link
Contributor

Choose a reason for hiding this comment

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

Please do not ignore 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.

I changed the way I fetched the value. because the way I did it above, it wouldn't allow for the key to be omitted it seemed. Hope my new way of doing it is good.

priceType, _, _, _ := jsonparser.Get(imp.Ext, "bidder", "priceType")

if string(priceType) != "" {
if strings.ToLower(string(priceType)) == "net" {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please prefer to use strings.EqualFold for a case insensitive comparison.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thanks, this is changed.

@SyntaxNode SyntaxNode changed the title Adnuntius Bid Adapter Adnuntius: Add Price Type Sep 12, 2023
@mikael-lundin
Copy link
Contributor Author

I'm waiting for this PR to go through before adding the prebid server things:
https://github.com/prebid/prebid.github.io/pull/4849/files

Is it ok to have one name for prebid client and another for prebid server? it seems when I looked into the documentation that server prefered the name "priceType"

@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, e847ee1

adnuntius

Refer here for heat map coverage report

github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:88:	Builder			100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:98:	MakeRequests		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:102:	setHeaders		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:118:	makeEndpointUrl		89.3%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:168:	getImpSizes		90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:191:	generateRequests	92.5%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:286:	MakeBids		81.8%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:313:	getGDPR			85.7%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:338:	generateAdResponse	84.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:403:	generateBidResponse	88.0%
total:									(statements)		89.1%

@onkarvhanumante
Copy link
Contributor

I'm waiting for this PR to go through before adding the prebid server things: https://github.com/prebid/prebid.github.io/pull/4849/files

Is it ok to have one name for prebid client and another for prebid server? it seems when I looked into the documentation that server prefered the name "priceType"

assuming prebid.js is being referred as prebid client. It would be better if both prebid js and prebid server use same name for new bidder info param.

@mikael-lundin
Copy link
Contributor Author

Good to know, I will make change the name in prebid server as well.

@onkarvhanumante
Copy link
Contributor

Good to know, I will make change the name in prebid server as well.

@mikael-lundin any updates to move this PR forward

@mikael-lundin
Copy link
Contributor Author

Yes, will be done today! sorry for the wait.

@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 429a99c

adnuntius

Refer here for heat map coverage report

github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:88:	Builder			100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:98:	MakeRequests		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:102:	setHeaders		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:118:	makeEndpointUrl		89.3%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:168:	getImpSizes		90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:191:	generateRequests	92.5%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:286:	MakeBids		81.8%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:313:	getGDPR			85.7%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:338:	generateAdResponse	84.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:403:	generateBidResponse	88.0%
total:									(statements)		89.1%

Comment on lines 24 to 26
"priceType": {
"type": "string",
"description": "Allows you to specify Net or Gross bids."
Copy link
Contributor

Choose a reason for hiding this comment

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

should update priceType to bidType

Copy link
Contributor Author

Choose a reason for hiding this comment

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

My bad .:/

@github-actions
Copy link

Code coverage summary

Note:

  • Prebid team doesn't anticipate tests covering code paths that might result in marshal and unmarshal errors
  • Coverage summary encompasses all commits leading up to the latest one, 9096e25

adnuntius

Refer here for heat map coverage report

github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:88:	Builder			100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:98:	MakeRequests		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:102:	setHeaders		100.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:118:	makeEndpointUrl		89.3%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:168:	getImpSizes		90.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:191:	generateRequests	92.5%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:286:	MakeBids		81.8%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:313:	getGDPR			85.7%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:338:	generateAdResponse	84.0%
github.com/prebid/prebid-server/adapters/adnuntius/adnuntius.go:403:	generateBidResponse	88.0%
total:									(statements)		89.1%

@gargcreation1992 gargcreation1992 merged commit 4ad946b into prebid:master Sep 29, 2023
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants