Skip to content

Commit

Permalink
taboola-support-app-in-prebid-server
Browse files Browse the repository at this point in the history
  • Loading branch information
ahmadlob committed Jul 7, 2024
1 parent 99431ad commit fc5621a
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 19 deletions.
27 changes: 16 additions & 11 deletions adapters/taboola/taboola.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,14 @@ func (a *adapter) buildRequest(request *openrtb2.BidRequest) (*adapters.RequestD
return nil, fmt.Errorf("unsupported media type for imp: %v", request.Imp[0])
}

url, err := a.buildEndpointURL(request.Site.ID, mediaType)
var taboolaPublisherId string
if request.Site != nil && request.Site.ID != "" {
taboolaPublisherId = request.Site.ID
} else if request.App != nil && request.App.ID != "" {
taboolaPublisherId = request.App.ID
}

url, err := a.buildEndpointURL(taboolaPublisherId, mediaType)
if err != nil {
return nil, err
}
Expand Down Expand Up @@ -207,22 +214,20 @@ func createTaboolaRequests(request *openrtb2.BidRequest) (taboolaRequests []*ope
ID: taboolaExt.PublisherId,
}

if modifiedRequest.Site == nil {
newSite := &openrtb2.Site{
ID: taboolaExt.PublisherId,
Name: taboolaExt.PublisherId,
Domain: evaluateDomain(taboolaExt.PublisherDomain, request),
Publisher: publisher,
}
modifiedRequest.Site = newSite
} else {
if modifiedRequest.Site != nil {
modifiedSite := *modifiedRequest.Site
modifiedSite.Publisher = publisher
modifiedSite.ID = taboolaExt.PublisherId
modifiedSite.Name = taboolaExt.PublisherId
modifiedSite.Domain = evaluateDomain(taboolaExt.PublisherDomain, request)
modifiedSite.Publisher = publisher
modifiedRequest.Site = &modifiedSite
}
if modifiedRequest.App != nil {
modifiedApp := *modifiedRequest.App
modifiedApp.ID = taboolaExt.PublisherId
modifiedApp.Publisher = publisher
modifiedRequest.App = &modifiedApp
}

if taboolaExt.BCat != nil {
modifiedRequest.BCat = taboolaExt.BCat
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,14 @@
"ext": {
"bidder": {
"publisherId": "publisher-id",
"tagid": "tag-id"
"tagid": "tag-id",
"tagId": "tag-Id"
}
}
}
],
"app": {
"domain": "http://domain.com"
"bundle": "com.app.my"
},
"device": {
"ua": "Mozilla/5.0 (Linux; Android 12; Pixel 6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/93.0.4577.62 Mobile Safari/537.36",
Expand Down Expand Up @@ -62,21 +63,19 @@
}
]
},
"tagid" : "tag-id",
"tagid" : "tag-Id",
"ext": {
"bidder": {
"publisherId": "publisher-id",
"tagid": "tag-id"
"tagid": "tag-id",
"tagId": "tag-Id"
}
}
}
],
"app": {
"domain": "http://domain.com"
},
"site": {
"id": "publisher-id",
"name": "publisher-id",
"bundle": "com.app.my",
"publisher": {
"id": "publisher-id"
}
Expand Down

0 comments on commit fc5621a

Please sign in to comment.