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: SmartHub #1932

Merged
merged 8 commits into from
Aug 5, 2021
Merged

New Adapter: SmartHub #1932

merged 8 commits into from
Aug 5, 2021

Conversation

SmartHubSolutions
Copy link
Contributor

No description provided.

@SmartHubSolutions
Copy link
Contributor Author

@VeronikaSolovei9 @AlexBVolcy @SyntaxNode

Hello, guys! :) Could you please confirm that we meet requirements to start a review process? Maybe we've done something wrong and need to fix this or add something else?

There is our PR with docs: prebid/prebid.github.io#3131

@SyntaxNode SyntaxNode requested review from guscarreon and removed request for AlexBVolcy July 26, 2021 17:19
@SyntaxNode SyntaxNode assigned guscarreon and unassigned AlexBVolcy Jul 26, 2021
ADAPTER_VER = "1.0.0"
)

type SmartHubAdapter struct {
Copy link
Contributor

Choose a reason for hiding this comment

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

Please rename this to adapter. There's no need to repeat the package name in the adapter type. Please review our new adapter docs: https://docs.prebid.org/prebid-server/developers/add-new-bidder-go.html

Copy link
Contributor Author

@SmartHubSolutions SmartHubSolutions Jul 27, 2021

Choose a reason for hiding this comment

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

Thank you, I've fixed this. Do other things look correct?

Copy link
Contributor

@VeronikaSolovei9 VeronikaSolovei9 left a comment

Choose a reason for hiding this comment

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

Hello @SmartHubSolutions, I apologize for the delay in review.
I added some comments, other than that it looks good to me.
Thank you for adding documentation PR!

reqInfo *adapters.ExtraRequestInfo,
) (
requestsToBidder []*adapters.RequestData,
errs []error,
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason behind naming output parameters? In MakeBids function as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is no reason. I've removed in both

}}
}

bid := bids[0]
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it always only one bid in 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.

Yes, we don't support more than one bid in response

@@ -71,9 +71,10 @@ import (
"github.com/prebid/prebid-server/adapters/rhythmone"
"github.com/prebid/prebid-server/adapters/rtbhouse"
"github.com/prebid/prebid-server/adapters/rubicon"
"github.com/prebid/prebid-server/adapters/sa_lunamedia"
salunamedia "github.com/prebid/prebid-server/adapters/sa_lunamedia"
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you please don't add aliases for other bidders? There shouldn't be any name conflicts.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, of course. I've removed them

errs []error,
) {
if len(openRTBRequest.Imp) == 0 {
return nil, []error{&errortypes.BadInput{Message: "Missing Imp object"}}
Copy link
Contributor

Choose a reason for hiding this comment

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

Nitpick: Prebid server core filters out requests with empty []Imp arrays so there's no need for this check. I realize this isn't a lot overhead so you could leave it or remove it if you want.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed this

endpointParams := macros.EndpointTemplateParams{
Host: params.Host,
AccountID: params.Seat,
SourceId: params.Token,
Copy link
Contributor

Choose a reason for hiding this comment

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

I see you pass all three parameters to your URL. Do you need all three to NOT be empty? As of right now, you marked them as required inside static/bidder-params/smarthub.json but they can still be zero-lenght strings. In case you need that any or all three of your parameters to not be empty you could add the minLength property like:

   {
     "$schema": "http://json-schema.org/draft-04/schema#",
     "title": "SmartHub Adapter Params",
     "description": "A schema which validates params accepted by the SmartHub adapter",
     "type": "object",
     "properties": {
       "host": {
         "type": "string",
         "description": "Network host to send request"
 +       "minLength": 1
       },
       "seat": {
         "type": "string",
         "description": "Seat"
 +       "minLength": 1
       },
       "token": {
         "type": "string",
         "description": "Token"
 +       "minLength": 1
       }
     },
     "required": [
       "host",
       "seat",
       "token"
     ]
   }
static/bidder-params/smarthub.json

Without the additions shown above, an all empty parameter req.Imp[i].Ext would be allowed. In other words, for the moment, a test case like this is currently passing:

   var invalidParams = []string{
   	``,
   	`null`,
   	`true`,
   	`5`,
   	`[]`,
   	`{}`,
   	`{"anyparam": "anyvalue"}`,
   	`{"host":"smarthub.test"}`,
   	`{"seat":"9Q20EdGxzgWdfPYShScl"}`,
   	`{"token":"Y9Evrh40ejsrCR4EtidUt1cSxhJsz8X1"}`,
   	`{"seat":"9Q20EdGxzgWdfPYShScl", "token":"alNYtemWggraDVbhJrsOs9pXc3Eld32E"}`,
   	`{"host":"smarthub.test", "token":"LNywdP2ebX5iETF8gvBeEoB6Cam64eeq"}`,
   	`{"host":"smarthub.test", "seat":"9Q20EdGxzgWdfPYShScl"}`,
 + 	`{"host":"", "seat":"", "token":""}`,  // <-- all empty fields test case is passing right now
   }
adapters/smarthub/params_test.go

Copy link
Contributor

Choose a reason for hiding this comment

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

If that's what you intended, it's fine

Copy link
Contributor Author

@SmartHubSolutions SmartHubSolutions Jul 28, 2021

Choose a reason for hiding this comment

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

Yes, thanks a lot for pointing the mistake! All three parameters mustn't be an empty string. I've fixed this in static/bidder-params/smarthub.json and also added possible cases to test into invalidParams

Copy link
Contributor

@VeronikaSolovei9 VeronikaSolovei9 left a comment

Choose a reason for hiding this comment

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

Thank you for addressing comments. LGTM.

config/config.go Outdated
@@ -946,6 +947,7 @@ func SetupViper(v *viper.Viper, filename string) {
v.SetDefault("adapters.silvermob.endpoint", "http://{{.Host}}.silvermob.com/marketplace/api/dsp/bid/{{.ZoneID}}")
v.SetDefault("adapters.smaato.endpoint", "https://prebid.ad.smaato.net/oapi/prebid")
v.SetDefault("adapters.smartadserver.endpoint", "https://ssb-global.smartadserver.com")
v.SetDefault("adapters.smarthub.endpoint", "http://{{.Host}}/?seat={{.AccountID}}&token={{.SourceId}}")
Copy link
Contributor

Choose a reason for hiding this comment

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

Hello @SmartHubSolutions . Despite being a proxy server, our policy is that Prebid server can pass subdomains but not whole domains. Can you please modify?
Allowed:

952      v.SetDefault("adapters.smarthub.endpoint", "http://{{.Host}}.restofsmarthubdomain.com/?seat={{.AccountID}}&token={{.SourceId}}")
config/config.go

Not-allowed:

952      v.SetDefault("adapters.smarthub.endpoint", "http://{{.Host}}/?seat={{.AccountID}}&token={{.SourceId}}")
config/config.go

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, impossible for us. Replacing of all host is the only one way how we work with our partners. We need to leave this how it is. BTW, there are a lot of adapters with the same pattern. Several examples:

858	v.SetDefault("adapters.adkernel.endpoint", "http://{{.Host}}/hb?zone={{.ZoneID}}")
config/config.go

link

918	v.SetDefault("adapters.invibes.endpoint", "https://{{.Host}}/bid/ServerBidAdContent")
config/config.go

link

978	v.SetDefault("adapters.zeroclickfraud.endpoint", "http://{{.Host}}/openrtb2?sid={{.SourceId}}")
config/config.go

link

Copy link
Contributor

Choose a reason for hiding this comment

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

@SmartHubSolutions We're aware that there are a few other adapters that use this approach for the hosts but it's an anti-pattern that we as a Prebid Server committee strongly oppose and are currently working with these adapters to correct their behavior. We're focused on making sure that this pattern isn't used for any other adapters going further. It's odd to ask the publisher to specify the server address of the bidder, it greatly harms Prebid Server's performance which is based on keep alive connections to bidders, and allowing the publisher to pass the host through opens up PBS to a variety of attacks.

Can you please help us understand your use case for this? We'd be happy to work with you to find a better solution for your use case, if possible.

In case the use case here is to have the Publishers specify the host based on the region they are in then the recommended approach for that is to use a default endpoint pointing to your company's global load balancer. If you don't have a global load balancer, consider marking the adapter as disabled by default and add instructions in your bidder docs to let hosts know which endpoints to use for their geo regions, or ask them to contact you directly to setup if you don't want to publicly post those endpoints.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@mansinahar Thank you for this detailed explanation! Now, everything is clear. I'll discuss this with my team to find a solution. We'll definitely find it and back soon.

Copy link
Contributor Author

@SmartHubSolutions SmartHubSolutions Aug 4, 2021

Choose a reason for hiding this comment

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

@mansinahar I've written below how we had changed URL template.Does it meet requirements now? :) Can we continue our review process?

@@ -0,0 +1,13 @@
maintainer:
email: "[email protected]"
Copy link
Contributor

Choose a reason for hiding this comment

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

Just double-checking: are you registered with IAB Europe? If you don't, that's fine. If you do, IAB's GVL id number must be written into this file as shown below. Just double-checking in case you are.

 1   maintainer:
 2     email: "[email protected]"
   + gvlVendorID: <IABs_GVL_ID>
 3   capabilities:
 4     app:
 5       mediaTypes:
 6         - banner
 7         - video
 8         - native
 9     site:
10       mediaTypes:
11         - banner
12         - video
13         - native
static/bidder-info/smarthub.yaml

Copy link
Contributor Author

Choose a reason for hiding this comment

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

SmartHub is the solution for different companies which every has own registration and Vendor ID. Every company which receive traffic will process European data by itself. If a company doesn't have Vendor ID, SmartHub clean all data due to IAB recommendations. SmartHub completely support GDPR, but I think it's incorrect to write our Vendor ID here

@SmartHubSolutions
Copy link
Contributor Author

@guscarreon @mansinahar Hi!
We've fixed the way how to build endpoint URL according your recommendations. Thank you! Now our URL template looks like:

"http://{{.Host}}-prebid.smart-hub.io/?seat={{.AccountID}}&token={{.SourceId}}"

Also, we've updated docs PR: prebid/prebid.github.io#3131
Could we continue the review process?

Copy link
Contributor

@VeronikaSolovei9 VeronikaSolovei9 left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@guscarreon guscarreon left a comment

Choose a reason for hiding this comment

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

@SmartHubSolutions thank you for addressing our feedback. Your code looks pretty good.

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