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: Missena #3761

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

ysfbsf
Copy link

@ysfbsf ysfbsf commented Jun 18, 2024

Related Documentation: prebid/prebid.github.io#5437

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, 4d210b9

missena

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/missena/missena.go:55:	Builder		100.0%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:62:	makeParameter	100.0%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:76:	makeRequest	83.3%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:113:	MakeRequests	96.3%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:162:	readGDPR	100.0%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:182:	MakeBids	94.4%
total:									(statements)	93.7%

@@ -0,0 +1,16 @@
endpoint: https://bid.missena.io/
maintainer:
email: yboussafa@missena.com
Copy link
Collaborator

Choose a reason for hiding this comment

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

this looks like a private email, please enter maintenance email

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

"properties": {
"apiKey": {
"type": "string",
"description": "API Key"
Copy link
Collaborator

@przemkaczmarek przemkaczmarek Jul 31, 2024

Choose a reason for hiding this comment

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

You have to add "minimum": 1

Copy link
Collaborator

Choose a reason for hiding this comment

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

You should only add this if you don't want to accept an apiKey of zero length.

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

}

var validParams = []string{
`{"apiKey": ""}`,
Copy link
Collaborator

Choose a reason for hiding this comment

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

when You add "minimum": 1 to missena.json add this example to ivalidParams

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

if request.Device.IP != "" {
headers.Add("X-Forwarded-For", request.Device.IP)
} else if request.Device.IPv6 != "" {
headers.Add("X-Forwarded-For", request.Device.IPv6)
Copy link
Collaborator

Choose a reason for hiding this comment

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

add test for it.
image

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

"properties": {
"apiKey": {
"type": "string",
"description": "API Key"
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should only add this if you don't want to accept an apiKey of zero length.

@@ -0,0 +1,16 @@
endpoint: https://bid.missena.io/
Copy link
Collaborator

Choose a reason for hiding this comment

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

Endpoint is reachable

curl -i --location --request POST https://bid.missena.io/
HTTP/1.1 403 Forbidden
Date: Fri, 30 Aug 2024 20:00:07 GMT
Content-Type: text/plain; charset=utf-8
Content-Length: 9
Connection: keep-alive
Vary: Origin

Forbidden

Copy link
Author

Choose a reason for hiding this comment

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

@bsardo The endpoint is only accessible by calling it with a valid API Key. Example:


curl --location 'https://bid.staging.missena.xyz/?t=PA-34761163' \
--header 'Accept: */*' \
--header 'Accept-Language: en-GB,en-US;q=0.9,en;q=0.8' \
--header 'Cache-Control: no-cache' \
--header 'Connection: keep-alive' \
--header 'Origin: https://publisher.staging.missena.click' \
--header 'Pragma: no-cache' \
--header 'Referer: https://publisher.staging.missena.click/' \
--header 'Sec-Browsing-Topics: ();p=P0000000000000000000000000000000' \
--header 'Sec-Fetch-Dest: empty' \
--header 'Sec-Fetch-Mode: cors' \
--header 'Sec-Fetch-Site: cross-site' \
--header 'User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 16_6 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1' \
--header 'content-type: text/plain' \
--data '{
    "adunit": "msna-sticky-dd",
    "request_id": "53dfce8e0aad03",
    "test": "smart-banner",
    "placement": "sticky"
}'

Copy link
Collaborator

Choose a reason for hiding this comment

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

All good @ysfbsf. All I'm doing here is proving that I can reach your endpoint and sharing that proof with other reviewers. No action required.

endpoint: https://bid.missena.io/
maintainer:
email: yboussafa@missena.com
gvlVendorID: 687
Copy link
Collaborator

Choose a reason for hiding this comment

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

verified GVL ID:

curl https://vendor-list.consensu.org/v3/vendor-list.json | jq '.vendors."687"'
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  628k  100  628k    0     0  3635k      0 --:--:-- --:--:-- --:--:-- 3655k
{
  "id": 687,
  "name": "MISSENA",
  "purposes": [
    1,
    2,
    3,
    4,
    5,
    6,
    7
  ],
  "legIntPurposes": [],
  "flexiblePurposes": [],
  "specialPurposes": [
    2
  ],
  "features": [
    2,
    3
  ],
  "specialFeatures": [],
  "cookieMaxAgeSeconds": 31104000,
  "usesCookies": true,
  "cookieRefresh": true,
  "usesNonCookieAccess": true,
  "dataRetention": {
    "stdRetention": 360,
    "purposes": {},
    "specialPurposes": {}
  },
  "urls": [
    {
      "langId": "en",
      "privacy": "https://missena.com/privacy",
      "legIntClaim": "https://missena.com/privacy"
    }
  ],
  "dataDeclaration": [
    1,
    2,
    3,
    4,
    5,
    6,
    7,
    8,
    10
  ],
  "deviceStorageDisclosureUrl": "https://ad.missena.io/iab.json"
}

Copy link
Author

Choose a reason for hiding this comment

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

@bsardo Do you mean that no need to provide the GVL ID since it's a verified one?

Copy link
Collaborator

Choose a reason for hiding this comment

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

Sorry for the confusion @ysfbsf. No action is required here; you should continue to specify the GVL ID. My comment is just proof to other reviewers that I verified the GVL ID you specified is associated with your bidder.

Comment on lines 42 to 45
var invalidParams = []string{
`{"apiKey": 42}`,
`{"placement": 111}`,
}
Copy link
Collaborator

Choose a reason for hiding this comment

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

I suggest adding the following test cases:

  • placement is valid but apiKey is omitted since it is required
  • apiKey is valid but placement is not

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅


func TestJsonSamples(t *testing.T) {
bidder, buildErr := Builder(openrtb_ext.BidderMissena, config.Adapter{
Endpoint: "https://bid.missena.io"},
Copy link
Collaborator

Choose a reason for hiding this comment

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

I recommend using a fake URL for your endpoint to minimize maintenance should you ever change your production endpoint.

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

var tempErrors []error
gdprApplies, consentString := readGDPR(request)

var missenaInternalParams MissenaInternalParams
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: you could combine this with the gdpr field assignments on lines 144-145 as:

missenaInternalParams := MissenaInternalParams{
	GDPR:        gdprApplies,
	GDPRConsent: consentString,
}

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

Comment on lines 155 to 159
} else if newHttpRequest != nil {
httpRequests = append(httpRequests, newHttpRequest)
}

return httpRequests, finalErrors
Copy link
Collaborator

Choose a reason for hiding this comment

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

Do you need the else if? You could probably just do:

httpRequests = append(httpRequests, newHttpRequest)
return httpRequests, errors

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

Comment on lines 224 to 225
var errors []error
return bidResponse, errors
Copy link
Collaborator

Choose a reason for hiding this comment

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

Simplify to return bidResponse, nil

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅


var missenaInternalParams MissenaInternalParams

for _, imp := range request.Imp {
Copy link
Collaborator

Choose a reason for hiding this comment

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

It appears you are prepared to handle multiple imps but really you only care that at least one of them is valid as you're just preparing a single request without specifying the impression ID, though you are grabbing the params from the last imp you process. Is this what you want or do you want to grab the info from the first imp?

I suggest adding a test where there are multiple imps with different params, specifically placement. I also think you should add a test where one imp results in an error and the other is well formed.

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

Uri: url,
Headers: headers,
Body: body,
ImpIDs: openrtb_ext.GetImpIDs(request.Imp),
Copy link
Collaborator

Choose a reason for hiding this comment

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

If you're only sending a bid request to your server for one imp, that imp is the one that should be specified here rather than specifying all of the imps.

Copy link
Author

Choose a reason for hiding this comment

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

Done ✅

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, 8c79b48

missena

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/missena/missena.go:55:	Builder		100.0%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:62:	makeParameter	100.0%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:76:	makeRequest	94.4%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:113:	MakeRequests	88.0%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:166:	readGDPR	100.0%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:186:	MakeBids	94.1%
total:									(statements)	93.4%

@@ -0,0 +1,16 @@
endpoint: https://bid.missena.io/
maintainer:
email: prebid@missena.com
Copy link
Collaborator

Choose a reason for hiding this comment

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

We've sent a test email to prebid@missena.com. Please respond to the email with a message of "received".

Copy link
Author

Choose a reason for hiding this comment

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

@bsardo Can you send the email again?

Copy link
Collaborator

Choose a reason for hiding this comment

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

@ysfbsf Sent

Copy link
Collaborator

Choose a reason for hiding this comment

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

Confirmed

Comment on lines +13 to +16
userSync:
redirect:
url: https://sync.missena.io/iframe?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}
userMacro: $UID
Copy link
Collaborator

Choose a reason for hiding this comment

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

Is this working correctly? I didn't see the redirect to the PBS setuid endpoint with the missena user ID so that it can be set on the PBS cookie.

Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not appear to be working. Two things:

  1. I see iframe in your URL which leads me to believe your user sync is of type iframe instead of redirect. If that's the case, you should indicate as such:
userSync:
  iframe:
    url: ...
    userMacro: $UID
  1. When I initiate a user sync I do not see the redirect to the PBS setuid endpoint, which will be specified in the redirect portion of your user sync query string (redirect={{.RedirectURL}}). This is where your user ID is set on the PBS cookie.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Please move this test under the supplemental folder or rename to simple-banner-ipv6.json.

Copy link
Collaborator

Choose a reason for hiding this comment

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

You might want to consider adding a third imp to this test so that two imps are valid and one is invalid. That would make the intended behavior clear for when there are multiple valid imps.

Comment on lines 157 to 161
if len(httpRequests) == 0 && len(errors) == 0 {
errors = append(errors, &errortypes.BadInput{
Message: "No valid impressions found",
})
}
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 you can delete this if block. The only time this condition would be true is if the bid request does not contain any imps but the code upstream will validate that there is at least one impression before calling your adapter.

return &missenaRequest
}

func (a *adapter) makeRequest(missenaParams MissenaInternalParams, reqInfo *adapters.ExtraRequestInfo, imp *openrtb2.Imp, request *openrtb2.BidRequest) (*adapters.RequestData, error) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: instead of passing a pointer to the imp, I suggest just passing the imp ID as a string to keep things simple since that's the only field you're using on the impression.

func (a *adapter) makeRequest(missenaParams MissenaInternalParams, reqInfo *adapters.ExtraRequestInfo, imp *openrtb2.Imp, request *openrtb2.BidRequest) (*adapters.RequestData, error) {

url := a.endpoint + "?t=" + missenaParams.ApiKey
parameter := a.makeParameter(missenaParams, request)
Copy link
Collaborator

Choose a reason for hiding this comment

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

You could simplify your adapter a bit eliminating a function call by deleting the makeParameter function and moving that function's contents in line so that you construct the MissenaAdRequest instance here.

Comment on lines 89 to 93
if request.Device != nil {
headers.Add("User-Agent", request.Device.UA)
}

if request.Device != nil {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nitpick: you can simplify your logic by getting rid of the first device nil check and instead moving headers.Add("User-Agent", request.Device.UA) into the second device nil check.

}

func (a *adapter) MakeRequests(request *openrtb2.BidRequest, requestInfo *adapters.ExtraRequestInfo) ([]*adapters.RequestData, []error) {
// print the request
Copy link
Collaborator

Choose a reason for hiding this comment

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

Delete comment

consentString = extUser.Consent
}
}
gdprApplies := true
Copy link
Collaborator

Choose a reason for hiding this comment

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

Just checking, are you sure you always want to default to gdpr applies if no gdpr signal has been provided? Perhaps a supplemental test should be added for when gdpr is not set.

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, 00993a5

missena

Refer here for heat map coverage report

github.com/prebid/prebid-server/v2/adapters/missena/missena.go:55:	Builder		100.0%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:62:	makeRequest	94.1%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:106:	MakeRequests	91.3%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:152:	readGDPR	100.0%
github.com/prebid/prebid-server/v2/adapters/missena/missena.go:172:	MakeBids	94.1%
total:									(statements)	94.4%

Copy link
Collaborator

@bsardo bsardo left a comment

Choose a reason for hiding this comment

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

LGTM except for the user sync.

Comment on lines +13 to +16
userSync:
redirect:
url: https://sync.missena.io/iframe?gdpr={{.GDPR}}&consent={{.GDPRConsent}}&us_privacy={{.USPrivacy}}&redirect={{.RedirectURL}}
userMacro: $UID
Copy link
Collaborator

Choose a reason for hiding this comment

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

This does not appear to be working. Two things:

  1. I see iframe in your URL which leads me to believe your user sync is of type iframe instead of redirect. If that's the case, you should indicate as such:
userSync:
  iframe:
    url: ...
    userMacro: $UID
  1. When I initiate a user sync I do not see the redirect to the PBS setuid endpoint, which will be specified in the redirect portion of your user sync query string (redirect={{.RedirectURL}}). This is where your user ID is set on the PBS cookie.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

3 participants