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

New Adapter: AdTonos #3853

Merged
merged 2 commits into from
Sep 12, 2024
Merged

New Adapter: AdTonos #3853

merged 2 commits into from
Sep 12, 2024

Conversation

rkaw92
Copy link
Contributor

@rkaw92 rkaw92 commented Aug 12, 2024

Hi! Meet AdTonos, an audio ad exchange and Prebid member 👋

Docs: prebid/prebid.github.io#5543

func getMediaTypeForImp(responseImpId string, requestImps []openrtb2.Imp) (openrtb_ext.BidType, error) {
for _, requestImp := range requestImps {
if requestImp.ID == responseImpId {
if requestImp.Audio != nil {

Choose a reason for hiding this comment

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

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeAudio, nil. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(Leaving this here because AdTonos is an audio ad exchange - we incidentally do audio-as-video for publishers which absolutely cannot play an audio ad due to technical constraints, but really we just want to return VASTs with sound only.)

Copy link
Contributor

Choose a reason for hiding this comment

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

@rkaw92 what bot is suggesting is to use Mtype field in the response to decide returned mediaType for an impression instead of relying on impID. For example,

func getBidType(bid openrtb2.Bid) (openrtb_ext.BidType, error) {
	// determinate media type by bid response field mtype
	switch bid.MType {
	case openrtb2.MarkupBanner:
		return openrtb_ext.BidTypeBanner, nil
	case openrtb2.MarkupVideo:
		return openrtb_ext.BidTypeVideo, nil
	case openrtb2.MarkupAudio:
		return openrtb_ext.BidTypeAudio, nil
	case openrtb2.MarkupNative:
		return openrtb_ext.BidTypeNative, nil
	}

	return "", &errortypes.BadInput{
		Message: fmt.Sprintf("Could not define media type for impression: %s", bid.ImpID),
	}
}

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Okay, makes sense. We don't have a way of always returning mtype currently, but I can add logic that will optionally use it when present, and fall back to the current heuristic if not. In the future, when mtype coverage increases, the code will have anticipated it.

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've added handling for when mtype is explicitly indicated and left the guesstimation in place as a fallback, does that look better?

if requestImp.ID == responseImpId {
if requestImp.Audio != nil {
return openrtb_ext.BidTypeAudio, nil
} else if requestImp.Video != nil {

Choose a reason for hiding this comment

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

Consider this as a suggestion. The current implementation follows an anti-pattern, assumes that if there is a multi-format request, the media type defaults to openrtb_ext.BidTypeVideo, nil. Prebid server expects the media type to be explicitly set in the adapter response. Therefore, we strongly recommend implementing a pattern where the adapter server sets the MType field in the response to accurately determine the media type for the impression.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

the media type defaults to openrtb_ext.BidTypeVideo, nil.

I think the review bot may be wrong here - we default to audio, not video.

Copy link
Contributor

Choose a reason for hiding this comment

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

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, c3cca60

adtonos

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:21:	Builder			100.0%
github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:33:	MakeRequests		76.5%
github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:72:	buildEndpointURL	100.0%
github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:77:	MakeBids		84.2%
github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:111:	getMediaTypeForImp	87.5%
total:									(statements)		84.3%

@@ -0,0 +1,24 @@
endpoint: https://exchange.adtonos.com/bid/{{.PublisherID}}
maintainer:
email: support@adtonos.com
Copy link
Contributor

Choose a reason for hiding this comment

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

Sent email for verification.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you, I believe a response has been sent back accordingly.

Copy link
Contributor

Choose a reason for hiding this comment

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

email verified. thanks!

userSync:
redirect:
url: https://play.adtonos.com/redir?to={{.RedirectURL}}
userMacro: '@UUID@'
Copy link
Contributor

Choose a reason for hiding this comment

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

user sync works.

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, 1147599

adtonos

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:21:	Builder			100.0%
github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:33:	MakeRequests		76.5%
github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:72:	buildEndpointURL	100.0%
github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:77:	MakeBids		84.2%
github.com/prebid/prebid-server/v2/adapters/adtonos/adtonos.go:111:	getMediaTypeForBid	71.4%
total:									(statements)		80.7%

@rkaw92
Copy link
Contributor Author

rkaw92 commented Aug 23, 2024

Hi, any more blockers here? I believe I've addressed all the suggestions.

Sorry, must have had an old version of the page loaded. Thanks!

@bsardo bsardo merged commit ffdd75f into prebid:master Sep 12, 2024
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.

5 participants