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

Taboola: app support #3795

Merged
merged 1 commit into from
Aug 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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)
Comment on lines +134 to +141
Copy link
Contributor

Choose a reason for hiding this comment

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

Please add a json test case for this change.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gargcreation1992 I did added a test file
bannerAppRequest.json

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
Loading