Documentation ¶
Index ¶
- Variables
- func BuildSyncers(hostConfig *config.Configuration, bidderInfos config.BidderInfos) (map[string]Syncer, []error)
- func SyncHostCookie(r *http.Request, requestCookie *Cookie, host *config.HostCookie)
- func WriteCookie(w http.ResponseWriter, encodedCookie string, cfg *config.HostCookie, ...)
- type Base64Decoder
- type Base64Encoder
- type BidderEvaluation
- type BidderFilter
- type BidderFilterMode
- type Chooser
- type Cookie
- func (cookie *Cookie) AllowSyncs() bool
- func (cookie *Cookie) GetUID(key string) (uid string, isUIDFound bool, isUIDActive bool)
- func (cookie *Cookie) GetUIDs() map[string]string
- func (cookie *Cookie) HasAnyLiveSyncs() bool
- func (cookie *Cookie) HasLiveSync(key string) bool
- func (cookie *Cookie) MarshalJSON() ([]byte, error)
- func (cookie *Cookie) PrepareCookieForWrite(cfg *config.HostCookie, encoder Encoder, ejector Ejector) (string, error)
- func (cookie *Cookie) SetOptOut(optOut bool)
- func (cookie *Cookie) Sync(key string, uid string) error
- func (cookie *Cookie) UnmarshalJSON(b []byte) error
- func (cookie *Cookie) Unsync(key string)
- type Cooperative
- type Decoder
- type Ejector
- type Encoder
- type OldestEjector
- type PriorityBidderEjector
- type Privacy
- type Request
- type Result
- type SpecificBidderFilter
- type Status
- type Sync
- type SyncType
- type SyncTypeFilter
- type Syncer
- type SyncerBuildError
- type SyncerChoice
- type UIDEntry
- type UniformBidderFilter
Constants ¶
This section is empty.
Variables ¶
var ( ErrSyncerEndpointRequired = errors.New("at least one endpoint (iframe and/or redirect) is required") ErrSyncerKeyRequired = errors.New("key is required") )
Functions ¶
func BuildSyncers ¶
func BuildSyncers(hostConfig *config.Configuration, bidderInfos config.BidderInfos) (map[string]Syncer, []error)
func SyncHostCookie ¶
func SyncHostCookie(r *http.Request, requestCookie *Cookie, host *config.HostCookie)
SyncHostCookie syncs the request cookie with the host cookie
func WriteCookie ¶
func WriteCookie(w http.ResponseWriter, encodedCookie string, cfg *config.HostCookie, setSiteCookie bool)
WriteCookie sets the prepared cookie onto the header
Types ¶
type Base64Decoder ¶
type Base64Decoder struct{}
func (Base64Decoder) Decode ¶
func (d Base64Decoder) Decode(encodedValue string) *Cookie
type Base64Encoder ¶
type Base64Encoder struct{}
type BidderEvaluation ¶
BidderEvaluation specifies which bidders were considered to be synced.
type BidderFilter ¶
type BidderFilter interface { // Allowed returns true if the filter determines the bidder has permission and false if either // the bidder does not have permission or if the filter has an invalid mode. Allowed(bidder string) bool }
BidderFilter determines if a bidder has permission to perform a user sync activity.
func NewSpecificBidderFilter ¶
func NewSpecificBidderFilter(bidders []string, mode BidderFilterMode) BidderFilter
NewSpecificBidderFilter returns a new instance of the NewSpecificBidderFilter filter.
func NewUniformBidderFilter ¶
func NewUniformBidderFilter(mode BidderFilterMode) BidderFilter
NewUniformBidderFilter returns a new instance of the UniformBidderFilter filter.
type BidderFilterMode ¶
type BidderFilterMode int
BidderFilterMode represents the inclusion mode of a BidderFilter.
const ( BidderFilterModeInclude BidderFilterMode = iota BidderFilterModeExclude )
type Chooser ¶
type Chooser interface { // Choose considers bidders to sync, filters the bidders, and returns the result of the // user sync selection. Choose(request Request, cookie *Cookie) Result }
Chooser determines which syncers are eligible for a given request.
func NewChooser ¶
func NewChooser(bidderSyncerLookup map[string]Syncer, biddersKnown map[string]struct{}, bidderInfo map[string]config.BidderInfo) Chooser
NewChooser returns a new instance of the standard chooser implementation.
type Cookie ¶
type Cookie struct {
// contains filtered or unexported fields
}
Cookie is the cookie used in Prebid Server.
To get an instance of this from a request, use ReadCookie. To write an instance onto a response, use WriteCookie.
func ReadCookie ¶
ReadCookie reads the cookie from the request
func (*Cookie) AllowSyncs ¶
AllowSyncs is true if the user lets bidders sync cookies, and false otherwise.
func (*Cookie) HasAnyLiveSyncs ¶
HasAnyLiveSyncs returns true if this cookie has at least one active sync.
func (*Cookie) HasLiveSync ¶
HasLiveSync returns true if we have an active UID for the given syncer key, and false otherwise.
func (*Cookie) MarshalJSON ¶
func (*Cookie) PrepareCookieForWrite ¶
func (cookie *Cookie) PrepareCookieForWrite(cfg *config.HostCookie, encoder Encoder, ejector Ejector) (string, error)
PrepareCookieForWrite ejects UIDs as long as the cookie is too full
func (*Cookie) SetOptOut ¶
SetOptOut is used to change whether or not we're allowed to sync cookies for this user.
func (*Cookie) Sync ¶
Sync tries to set the UID for some syncer key. It returns an error if the set didn't happen.
func (*Cookie) UnmarshalJSON ¶
type Cooperative ¶
Cooperative specifies the settings for cooperative syncing for a given request, where bidders other than those used by the publisher are considered for syncing.
type OldestEjector ¶
type OldestEjector struct{}
type PriorityBidderEjector ¶
type Privacy ¶
type Privacy interface { GDPRAllowsHostCookie() bool GDPRInScope() bool GDPRAllowsBidderSync(bidder string) bool CCPAAllowsBidderSync(bidder string) bool ActivityAllowsUserSync(bidder string) bool }
Privacy determines which privacy policies will be enforced for a user sync request.
type Request ¶
type Request struct { Bidders []string Cooperative Cooperative Limit int Privacy Privacy SyncTypeFilter SyncTypeFilter GPPSID string Debug bool }
Request specifies a user sync request.
type Result ¶
type Result struct { BiddersEvaluated []BidderEvaluation Status Status SyncersChosen []SyncerChoice }
Result specifies which bidders were included in the evaluation and which syncers were chosen.
type SpecificBidderFilter ¶
type SpecificBidderFilter struct {
// contains filtered or unexported fields
}
SpecificBidderFilter implements the BidderFilter which applies the same mode for a list of bidders.
func (SpecificBidderFilter) Allowed ¶
func (f SpecificBidderFilter) Allowed(bidder string) bool
Allowed returns true if the bidder is specified and the mode is include or if the bidder is not specified and the mode is exclude and returns false in the opposite cases or when the mode is invalid.
type Status ¶
type Status int
Status specifies the result of a sync evaluation.
const ( // StatusOK specifies user syncing is permitted. StatusOK Status = iota // StatusBlockedByUserOptOut specifies a user's cookie explicitly signals an opt-out. StatusBlockedByUserOptOut // StatusAlreadySynced specifies a user's cookie has an existing non-expired sync for a specific bidder. StatusAlreadySynced // StatusUnknownBidder specifies a requested bidder is unknown to Prebid Server. StatusUnknownBidder // StatusTypeNotSupported specifies a requested sync type is not supported by a specific bidder. StatusTypeNotSupported // StatusDuplicate specifies the bidder is a duplicate or shared a syncer key with another bidder choice. StatusDuplicate // StatusBlockedByPrivacy specifies a bidder sync url is not allowed by privacy activities StatusBlockedByPrivacy // StatusBlockedByRegulationScope specifies the bidder chose to not sync given GDPR being in scope or because of a GPPSID StatusBlockedByRegulationScope // StatusUnconfiguredBidder refers to a bidder who hasn't been configured to have a syncer key, but is known by Prebid Server StatusUnconfiguredBidder // StatusBlockedByDisabledUsersync refers to a bidder who won't be synced because it's been disabled in its config by the host StatusBlockedByDisabledUsersync )
type SyncType ¶
type SyncType string
SyncType specifies the mechanism used to perform a user sync.
const ( // SyncTypeUnknown specifies the user sync type is invalid or not specified. SyncTypeUnknown SyncType = "" // SyncTypeIFrame specifies the user sync is to be performed within an HTML iframe // and to expect the server to return a valid HTML page with an embedded script. SyncTypeIFrame SyncType = "iframe" // SyncTypeRedirect specifies the user sync is to be performed within an HTML image // and to expect the server to return a 302 redirect. SyncTypeRedirect SyncType = "redirect" )
type SyncTypeFilter ¶
type SyncTypeFilter struct { IFrame BidderFilter Redirect BidderFilter }
SyncTypeFilter determines which sync types, if any, the bidder is permitted to use.
func (SyncTypeFilter) ForBidder ¶
func (t SyncTypeFilter) ForBidder(bidder string) []SyncType
ForBidder returns a slice of sync types the bidder is permitted to use.
type Syncer ¶
type Syncer interface { // Key is the name of the syncer as stored in the user's cookie. This is often, but not // necessarily, a one-to-one mapping with a bidder. Key() string // DefaultSyncType is the default SyncType for this syncer. DefaultSyncType() SyncType // SupportsType returns true if the syncer supports at least one of the specified sync types. SupportsType(syncTypes []SyncType) bool // GetSync returns a user sync for the user's device to perform, or an error if the none of the // sync types are supported or if macro substitution fails. GetSync(syncTypes []SyncType, userSyncMacros macros.UserSyncPrivacy) (Sync, error) }
Syncer represents the user sync configuration for a bidder or a shared set of bidders.
type SyncerBuildError ¶
SyncerBuildError represents an error with building a syncer.
func (SyncerBuildError) Error ¶
func (e SyncerBuildError) Error() string
Error implements the standard error interface.
type SyncerChoice ¶
SyncerChoice specifies a syncer chosen.
type UIDEntry ¶
type UIDEntry struct { // UID is the ID given to a user by a particular bidder UID string `json:"uid"` // Expires is the time at which this UID should no longer apply. Expires time.Time `json:"expires"` }
UIDEntry bundles the UID with an Expiration date.
type UniformBidderFilter ¶
type UniformBidderFilter struct {
// contains filtered or unexported fields
}
UniformBidderFilter implements the BidderFilter interface which applies the same mode for all bidders.
func (UniformBidderFilter) Allowed ¶
func (f UniformBidderFilter) Allowed(bidder string) bool
Allowed returns true if the mode is include and false if the mode is either exclude or invalid.