Skip to content

Commit

Permalink
enable statefarm for 1% traffic (prebid#236)
Browse files Browse the repository at this point in the history
  • Loading branch information
shunj-nb authored Feb 14, 2024
1 parent fb57718 commit ee51dab
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions pkg/modules/update_bundle/module/hook_raw_bidder_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,31 @@ import (
"strings"

"github.com/prebid/prebid-server/hooks/hookstage"
u "github.com/rjNemo/underscore"
)

func handleRawBidderResponsesHook(
payload hookstage.RawBidderResponsePayload,
context hookstage.ModuleInvocationContext,
) (result hookstage.HookResult[hookstage.RawBidderResponsePayload], err error) {

shouldBlock := true

if miCtxData, found := context.ModuleContext[MSP_UPDATE_BUNDLE_EXPS]; found {
pmExps := miCtxData.([]string)
if u.Contains(pmExps, "enable_state_farm_true") {
shouldBlock = false
}
}
if shouldBlock {
for _, bid := range payload.Bids {
if bid.Bid != nil && u.Contains(bid.Bid.ADomain, "statefarm.com") {
result.Reject = true
return result, nil
}
}
}

placementId := ""
if data, ok := context.ModuleContext[MSP_UPDATE_BUNDLE_PLACEMENT]; ok {
placementId = data.(string)
Expand Down

0 comments on commit ee51dab

Please sign in to comment.