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

Triplelift Native: Mapping tag_code #3745

Merged
merged 25 commits into from
Jul 24, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
af6ee65
Triplelift: adding native endpoint
patrickloughrey Oct 26, 2022
0d8d6f7
Triplelift: adding native endpoint
patrickloughrey Oct 27, 2022
409ec19
Merge branch 'prebid:master' into master
patrickloughrey Jun 27, 2023
8d02b4a
Merge branch 'prebid:master' into master
patrickloughrey Jun 30, 2023
1558343
Adding GPP support
patrickloughrey Jun 30, 2023
b589893
Adding GPP support
patrickloughrey Jun 30, 2023
d838adf
Merge branch 'prebid:master' into master
patrickloughrey Jun 10, 2024
c126782
Merge branch 'prebid:master' into master
patrickloughrey Jun 11, 2024
394f8ba
Triplelift: mapping tag_code
patrickloughrey Jun 11, 2024
d8dd2f7
Merge branch 'master' of https://github.com/patrickloughrey/prebid-se…
patrickloughrey Jun 11, 2024
5680b42
Merge branch 'prebid:master' into master
patrickloughrey Jun 11, 2024
08bca4b
Triplelift: mapping tag_code
patrickloughrey Jun 11, 2024
24d292d
Merge branch 'master' of https://github.com/patrickloughrey/prebid-se…
patrickloughrey Jun 11, 2024
f76615a
Triplelift: mapping tag_code
patrickloughrey Jun 11, 2024
5831b00
Fix ext parsing
patrickloughrey Jun 11, 2024
a710384
Merge branch 'prebid:master' into master
patrickloughrey Jul 1, 2024
2cf98db
Adding test params
patrickloughrey Jul 1, 2024
914cd4c
Fixing placement parsing logic
patrickloughrey Jul 5, 2024
4bb4a02
Merge branch 'prebid:master' into master
patrickloughrey Jul 5, 2024
9af6f57
Fixing placement parsing logic
patrickloughrey Jul 5, 2024
788502a
Fixing placement parsing logic
patrickloughrey Jul 5, 2024
f7379c6
Merge branch 'prebid:master' into master
patrickloughrey Jul 23, 2024
2bdc52a
Removing log statements
patrickloughrey Jul 23, 2024
eeeff4f
Added test case for inner else
patrickloughrey Jul 23, 2024
e9b9346
Added test case for inner else
patrickloughrey Jul 23, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions adapters/triplelift_native/triplelift_native.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,10 +37,11 @@ func getBidType(ext TripleliftRespExt) openrtb_ext.BidType {
return openrtb_ext.BidTypeNative
}

func processImp(imp *openrtb2.Imp) error {
func processImp(imp *openrtb2.Imp, req *openrtb2.BidRequest) error {
// get the triplelift extension
var ext adapters.ExtImpBidder
var tlext openrtb_ext.ExtImpTriplelift

if err := json.Unmarshal(imp.Ext, &ext); err != nil {
return err
}
Expand All @@ -53,7 +54,16 @@ func processImp(imp *openrtb2.Imp) error {
if tlext.InvCode == "" {
return fmt.Errorf("no inv_code specified")
}
imp.TagID = tlext.InvCode
if req.Site != nil {
siteCopy := *req.Site
patrickloughrey marked this conversation as resolved.
Show resolved Hide resolved
if siteCopy.Domain == "msn.com" {
imp.TagID = tlext.TagCode
} else {
imp.TagID = tlext.InvCode
}
patrickloughrey marked this conversation as resolved.
Show resolved Hide resolved
} else {
imp.TagID = tlext.InvCode
}
patrickloughrey marked this conversation as resolved.
Show resolved Hide resolved
// floor is optional
if tlext.Floor == nil {
return nil
Expand Down Expand Up @@ -89,7 +99,7 @@ func (a *TripleliftNativeAdapter) MakeRequests(request *openrtb2.BidRequest, ext
var validImps []openrtb2.Imp
// pre-process the imps
for _, imp := range tlRequest.Imp {
if err := processImp(&imp); err == nil {
if err := processImp(&imp, request); err == nil {
patrickloughrey marked this conversation as resolved.
Show resolved Hide resolved
validImps = append(validImps, imp)
} else {
errs = append(errs, err)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
{
"mockBidRequest": {
"id": "test-request-id",
"site": { "publisher": {"id":"foo","name":"foo"}, "domain": "msn.com"},
"imp": [
{
"native": {
"request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}"
},
"id": "test-imp-id",
"ext": {
"bidder": {
"inventoryCode": "foo",
"floor" : 20
},
"data": {
"tag_code": "bar"
}
}
}
]
},
"httpCalls": [
{
"expectedRequest": {
"uri": "http://tlx.3lift.net/s2sn/auction?supplier_id=20",
"body": {
"id": "test-request-id",
"imp": [
{
"id": "test-imp-id",
"native": {
"request" : "{\"plcmtcnt\":1,\"plcmttype\":2,\"privacy\":1,\"context\":1,\"contextsubtype\":12,\"eventtrackers\":[{\"event\":1,\"methods\":[1,2]},{\"event\":2,\"methods\":[1]}],\"assets\":[{\"data\":{\"type\":12},\"required\":1},{\"title\":{\"len\":50},\"required\":1},{\"img\":{\"w\":80,\"h\":80,\"type\":1},\"required\":1},{\"img\":{\"w\":1200,\"h\":627,\"type\":3},\"required\":1},{\"data\":{\"type\":3},\"required\":0},{\"data\":{\"len\":100,\"type\":2},\"required\":1},{\"video\":{\"mimes\":[\"video/mpeg\",\"video/mp4\"],\"minduration\":2,\"protocols\":[2,5],\"maxduration\":2,\"ext\":{\"playbackmethod\":[1,2]}},\"required\":1}],\"ver\":\"1.2\"}"
},
"tagid": "bar",
"bidfloor": 20,
"ext": {
"bidder": {
"inventoryCode": "foo",
"floor" : 20
}
}
}
],
"site": {
"publisher": {
"id": "foo",
"name": "foo"
},
"domain": "msn.com"
}
},
"impIDs":["test-imp-id"]
},
"mockResponse": {
"status": 204
}
}
],
"expectedBidResponses": []
}

1 change: 1 addition & 0 deletions openrtb_ext/imp_triplelift.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ package openrtb_ext
type ExtImpTriplelift struct {
InvCode string `json:"inventoryCode"`
Floor *float64 `json:"floor"`
TagCode string `json:"tag_code"`
}
4 changes: 4 additions & 0 deletions static/bidder-params/triplelift_native.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
"type": "string",
"description": "TripleLift inventory code for this ad unit (provided to you by your partner manager)"
},
"tag_code": {
"type": "string",
"description": "TripleLift placement name for MSN"
},
"floor" : {"description" : "the bid floor, in usd", "type": "number" }
},
"required": ["inventoryCode"]
Expand Down
Loading