Skip to content

Conversation

@gravelg
Copy link
Contributor

@gravelg gravelg commented Nov 14, 2025

The targeting also needs to be added to seatbid[].bid[]

@gravelg gravelg requested a review from scr-oath November 17, 2025 15:57
@bsardo bsardo changed the title fix: also put scope3 rtd targeting in seatbid Scope3: Add rtd targeting in seatbid Nov 19, 2025
@bsardo bsardo added the module label Nov 19, 2025
require.False(t, exists)

// Verify targeting section exists (add_to_targeting: true)
prebidData, exists := extMap["prebid"].(map[string]interface{})
Copy link
Contributor

Choose a reason for hiding this comment

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

Here and elsewhere, I do wonder if gjson would make this easier than all of the casting, but in test code, I don't care that much. One possible benefit is that you can just get the result at any depth of gjsonpath and then check if result.Exists() rather than needing to check and cast each level.

scr-oath
scr-oath previously approved these changes Nov 21, 2025
} else {
targetingMap[segment] = "true"
if m.cfg.SingleSegmentKey != "" {
currentVal := gjson.GetBytes(payload.BidResponse.Ext, "prebid.targeting."+m.cfg.SingleSegmentKey)
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like "prebid.targeting."+m.cfg.SingleSegmentKey could be a member - there's no need to do string concat for every request if the m.cfg.SingleSegmentKey never changes once the server is running.

Copy link
Contributor

Choose a reason for hiding this comment

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

Put another way - at Builder time, do the concat and just set m.cfg.SingleSegmentKey to that (or make new struct field if you want/need it untouched for some reason)

Comment on lines +320 to +339
if currentVal.Exists() {
newPayload, err := sjson.SetBytes(payload.BidResponse.Ext, "prebid.targeting."+m.cfg.SingleSegmentKey, currentVal.String()+","+segment)
if err != nil {
return payload, err
}
payload.BidResponse.Ext = newPayload
} else {
newPayload, err := sjson.SetBytes(payload.BidResponse.Ext, "prebid.targeting."+m.cfg.SingleSegmentKey, segment)
if err != nil {
return payload, err
}
payload.BidResponse.Ext = newPayload
}
} else {
newPayload, err := sjson.SetBytes(payload.BidResponse.Ext, "prebid.targeting."+segment, "true")
if err != nil {
return payload, err
}
payload.BidResponse.Ext = newPayload
}
Copy link
Contributor

Choose a reason for hiding this comment

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

I feel like this could be simplified significantly by having the logic choose or override the key and value and doing the newpayload and error checking only once.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants