Skip to content

Commit

Permalink
handle diff types of customData
Browse files Browse the repository at this point in the history
  • Loading branch information
MishelleBit committed Nov 18, 2024
1 parent 18cf454 commit cbe75ab
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 18 deletions.
23 changes: 15 additions & 8 deletions adapters/flipp/flipp.go
Original file line number Diff line number Diff line change
Expand Up @@ -243,18 +243,25 @@ func buildBid(decision *InlineModel, impId string, flippExtParams openrtb_ext.Im
if decision.Contents[0].Data.Width != 0 {
bid.W = decision.Contents[0].Data.Width
}
customDataInterface := decision.Contents[0].Data.CustomData
customDataMap := customDataInterface.(map[string]interface{})

bid.H = defaultStandardHeight
customDataKey = "standardHeight"
if flippExtParams.Options.StartCompact {
bid.H = defaultCompactHeight
customDataKey = "compactHeight"
} else {
bid.H = defaultStandardHeight
}
if value, exists := customDataMap[customDataKey]; exists {
if floatVal, ok := value.(float64); ok {
bid.H = int64(floatVal)

if customDataInterface := decision.Contents[0].Data.CustomData; customDataInterface != nil {
if customDataMap, ok := customDataInterface.(map[string]interface{}); ok {
customDataKey := "standardHeight"
if flippExtParams.Options.StartCompact {
customDataKey = "compactHeight"
}

if value, exists := customDataMap[customDataKey]; exists {
if floatVal, ok := value.(float64); ok {
bid.H = int64(floatVal)
}
}
}
}
}
Expand Down
15 changes: 5 additions & 10 deletions adapters/flipp/flipptest/exemplary/simple-banner-dtx.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
"siteId": 1243066,
"zoneIds": [285431],
"options": {
"startCompact": true
"startCompact": true
}
}
}
Expand Down Expand Up @@ -70,7 +70,7 @@
285431
],
"options": {
"startCompact": true
"startCompact": true
}
}
],
Expand All @@ -93,13 +93,8 @@
"clickUrl": "https://e-11090.adzerk.net/r?e=eyJ2IjoiMS4xMSIsImF2IjoxOTg4MDI3LCJhdCI6NDMwOSwiYnQiOjAsImNtIjo2MzI4NTM5MiwiY2giOjU4MDgxLCJjayI6e30sImNyIjo4MTMyNTY5MCwiZGkiOiJiOTg3MGNkYTA5MTU0NDlmOTkwZGNkZTNmNjYyNGNhMyIsImRqIjowLCJpaSI6IjJmNjYwMjMyODBmYjQ4NTRiYTY0YzFlYzA1ZDU5MTNiIiwiZG0iOjMsImZjIjoxODM1OTkxMTUsImZsIjoxNzU0MjE3OTUsImlwIjoiMTQyLjE4MS41OC41MiIsIm53IjoxMDkyMiwicGMiOjAsIm9wIjowLCJlYyI6MCwiZ20iOjAsImVwIjpudWxsLCJwciI6MjMyNjk5LCJydCI6MywicnMiOjUwMCwic2EiOiIzNCIsInNiIjoiaS0wNDZjMWNlNWRjYmExMTVjNSIsInNwIjozNzIzMDU1LCJzdCI6MTI0MzA2NiwidWsiOiJkOTU1N2Q2NS1kNWI5LTQyOTItYjg2My0xNGEyOTcyNTk3ZjQiLCJ6biI6Mjg1NDMxLCJ0cyI6MTY4MDU1NTc4MzkyMiwicG4iOiJpbmxpbmUiLCJnYyI6dHJ1ZSwiZ0MiOnRydWUsImdzIjoibm9uZSIsInR6IjoiQW1lcmljYS9OZXdfWW9yayIsInVyIjoiaHR0cDovL3d3dy5mbGlwcC5jb20ifQ&s=Mnss8P1kc37Eftik5RJvLJb4S9Y",
"contents": [
{
"data": {
"customData": {
"campaignConfigUrl": "https://campaign-config.flipp.com/dist-campaign-admin/215",
"campaignNameIdentifier": "US Grocery Demo (Kroger)",
"standardHeight": 900,
"compactHeight": 700
},
"data": {
"customData": null,
"height": 1800,
"width": 300
},
Expand Down Expand Up @@ -167,7 +162,7 @@
"adm": "creativeContent",
"crid": "81325690",
"w": 300,
"h": 700
"h": 600
},
"type": "banner"
}
Expand Down

0 comments on commit cbe75ab

Please sign in to comment.