forked from prebid/prebid-server
-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
UOE-11092-P1: Supporing OM based impression tracker for partners (#920)
* UOE-11092: Support enable/disable imp_counting_method(1px) feature for bidders Co-authored-by: Avinash Kapre <[email protected]>
- Loading branch information
1 parent
bcc32d1
commit 0babd5d
Showing
18 changed files
with
739 additions
and
160 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
48 changes: 48 additions & 0 deletions
48
modules/pubmatic/openwrap/publisherfeature/impcountingmethod.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package publisherfeature | ||
|
||
import ( | ||
"strings" | ||
|
||
"github.com/prebid/prebid-server/v2/modules/pubmatic/openwrap/models" | ||
) | ||
|
||
type impCountingMethod struct { | ||
enabledBidders [2]map[string]struct{} | ||
index int32 | ||
} | ||
|
||
func newImpCountingMethod() impCountingMethod { | ||
return impCountingMethod{ | ||
enabledBidders: [2]map[string]struct{}{ | ||
make(map[string]struct{}), | ||
make(map[string]struct{}), | ||
}, | ||
index: 0, | ||
} | ||
} | ||
|
||
func (fe *feature) updateImpCountingMethodEnabledBidders() { | ||
if fe.publisherFeature == nil { | ||
return | ||
} | ||
|
||
enabledBidders := make(map[string]struct{}) | ||
for pubID, feature := range fe.publisherFeature { | ||
if val, ok := feature[models.FeatureImpCountingMethod]; ok && pubID == 0 && val.Enabled == 1 { | ||
bidders := strings.Split(val.Value, ",") | ||
for _, bidder := range bidders { | ||
bidder = strings.TrimSpace(bidder) | ||
if bidder != "" { | ||
enabledBidders[bidder] = struct{}{} | ||
} | ||
} | ||
} | ||
} | ||
|
||
fe.impCountingMethod.enabledBidders[fe.impCountingMethod.index^1] = enabledBidders | ||
fe.impCountingMethod.index ^= 1 | ||
} | ||
|
||
func (fe *feature) GetImpCountingMethodEnabledBidders() map[string]struct{} { | ||
return fe.impCountingMethod.enabledBidders[fe.impCountingMethod.index] | ||
} |
Oops, something went wrong.