Skip to content

Commit

Permalink
Use advertiserDomains from ad response to pass to otb adomain parameter
Browse files Browse the repository at this point in the history
  • Loading branch information
antosarho committed Dec 17, 2024
1 parent f3b5bce commit e316853
Show file tree
Hide file tree
Showing 23 changed files with 35 additions and 17 deletions.
28 changes: 11 additions & 17 deletions adapters/adnuntius/adnuntius.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,16 @@ type Ad struct {
GrossBid struct {
Amount float64
}
DealID string `json:"dealId,omitempty"`
AdId string
CreativeWidth string
CreativeHeight string
CreativeId string
LineItemId string
Html string
DestinationUrls map[string]string
Advertiser adnAdvertiser `json:"advertiser,omitempty"`
DealID string `json:"dealId,omitempty"`
AdId string
CreativeWidth string
CreativeHeight string
CreativeId string
LineItemId string
Html string
DestinationUrls map[string]string
AdvertiserDomains []string
Advertiser adnAdvertiser `json:"advertiser,omitempty"`
}

type AdUnit struct {
Expand Down Expand Up @@ -458,13 +459,6 @@ func generateAdResponse(ad Ad, imp openrtb2.Imp, html string, request *openrtb2.
}}
}

adDomain := []string{}
for _, url := range ad.DestinationUrls {
domainArray := strings.Split(url, "/")
domain := strings.Replace(domainArray[2], "www.", "", -1)
adDomain = append(adDomain, domain)
}

bid := openrtb2.Bid{
ID: ad.AdId,
ImpID: imp.ID,
Expand All @@ -476,7 +470,7 @@ func generateAdResponse(ad Ad, imp openrtb2.Imp, html string, request *openrtb2.
CrID: ad.CreativeId,
Price: price * 1000,
AdM: html,
ADomain: adDomain,
ADomain: ad.AdvertiserDomains,
Ext: extJson,
}
return &bid, nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": { "amount": 20.0, "currency": "NOK" },
"grossBid": {"amount": 0.1, "currency": "NOK"},
"netBid": {"amount": 0.075, "currency": "NOK"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": { "amount": 20.0, "currency": "NOK" },
"grossBid": {"amount": 0.1, "currency": "NOK"},
"netBid": {"amount": 0.075, "currency": "NOK"},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand All @@ -106,6 +107,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"cpm": {
"amount": 1.0,
"currency": "NOK"
Expand Down Expand Up @@ -104,6 +105,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 0.001,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@
"destinationUrls": {
"url": "http://www.google.com"
},
"advertiserDomains": ["google.com"],
"bid": {
"amount": 20.0,
"currency": "NOK"
Expand Down

0 comments on commit e316853

Please sign in to comment.