Documentation ¶
Index ¶
- Variables
- func BuildSyncers(hostConfig *config.Configuration, bidderInfos config.BidderInfos) (map[string]Syncer, []error)
- type BidderEvaluation
- type BidderFilter
- type BidderFilterMode
- type Chooser
- type Cookie
- func (cookie *Cookie) AllowSyncs() bool
- func (cookie *Cookie) GetUID(key string) (string, bool, 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) SetCookieOnResponse(w http.ResponseWriter, setSiteCookie bool, cfg *config.HostCookie, ...)
- func (cookie *Cookie) SetOptOut(optOut bool)
- func (cookie *Cookie) ToHTTPCookie(ttl time.Duration) *http.Cookie
- func (cookie *Cookie) TrySync(key string, uid string) error
- func (cookie *Cookie) UnmarshalJSON(b []byte) error
- func (cookie *Cookie) Unsync(key string)
- type Cooperative
- type Privacy
- type Request
- type Result
- type SpecificBidderFilter
- type Status
- type Sync
- type SyncType
- type SyncTypeFilter
- type Syncer
- type SyncerBuildError
- type SyncerChoice
- type UniformBidderFilter
Constants ¶
This section is empty.
Variables ¶
var ErrSyncerDefaultSyncTypeRequired = errors.New("default sync type is required when more then one sync endpoint is configured")
var ErrSyncerEndpointRequired = errors.New("at least one endpoint (iframe and/or redirect) is required")
var ErrSyncerKeyRequired = errors.New("key is required")
Functions ¶
func BuildSyncers ¶ added in v0.173.0
func BuildSyncers(hostConfig *config.Configuration, bidderInfos config.BidderInfos) (map[string]Syncer, []error)
Types ¶
type BidderEvaluation ¶ added in v0.173.0
BidderEvaluation specifies which bidders were considered to be synced.
type BidderFilter ¶ added in v0.173.0
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 ¶ added in v0.173.0
func NewSpecificBidderFilter(bidders []string, mode BidderFilterMode) BidderFilter
NewSpecificBidderFilter returns a new instance of the NewSpecificBidderFilter filter.
func NewUniformBidderFilter ¶ added in v0.173.0
func NewUniformBidderFilter(mode BidderFilterMode) BidderFilter
NewUniformBidderFilter returns a new instance of the UniformBidderFilter filter.
type BidderFilterMode ¶ added in v0.173.0
type BidderFilterMode int
BidderFilterMode represents the inclusion mode of a BidderFilter.
const ( BidderFilterModeInclude BidderFilterMode = iota BidderFilterModeExclude )
type Chooser ¶ added in v0.173.0
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 ¶ added in v0.173.0
NewChooser returns a new instance of the standard chooser implementation.
type Cookie ¶ added in v0.173.0
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 ParseCookieFromRequest. To write an instance onto a response, use SetCookieOnResponse.
func ParseCookie ¶ added in v0.173.0
ParseCookie parses the UserSync cookie from a raw HTTP cookie.
func ParseCookieFromRequest ¶ added in v0.173.0
func ParseCookieFromRequest(r *http.Request, cookie *config.HostCookie) *Cookie
ParseCookieFromRequest parses the UserSyncMap from an HTTP Request.
func (*Cookie) AllowSyncs ¶ added in v0.173.0
AllowSyncs is true if the user lets bidders sync cookies, and false otherwise.
func (*Cookie) GetUID ¶ added in v0.173.0
GetUID Gets this user's ID for the given syncer key. The first returned value is the user's ID. The second returned value is true if we had a value stored, and false if we didn't. The third returned value is true if that value is "active", and false if it's expired.
If no value was stored, then the "isActive" return value will be false.
func (*Cookie) HasAnyLiveSyncs ¶ added in v0.173.0
HasAnyLiveSyncs returns true if this cookie has at least one active sync.
func (*Cookie) HasLiveSync ¶ added in v0.173.0
HasLiveSync returns true if we have an active UID for the given syncer key, and false otherwise.
func (*Cookie) MarshalJSON ¶ added in v0.173.0
func (*Cookie) SetCookieOnResponse ¶ added in v0.173.0
func (cookie *Cookie) SetCookieOnResponse(w http.ResponseWriter, setSiteCookie bool, cfg *config.HostCookie, ttl time.Duration)
SetCookieOnResponse is a shortcut for "ToHTTPCookie(); cookie.setDomain(domain); setCookie(w, cookie)"
func (*Cookie) SetOptOut ¶ added in v0.173.0
SetOptOut is used to change whether or not we're allowed to sync cookies for this user.
func (*Cookie) ToHTTPCookie ¶ added in v0.173.0
Gets an HTTP cookie containing all the data from this UserSyncMap. This is a snapshot--not a live view.
func (*Cookie) TrySync ¶ added in v0.173.0
TrySync tries to set the UID for some syncer key. It returns an error if the set didn't happen.
func (*Cookie) UnmarshalJSON ¶ added in v0.173.0
UnmarshalJSON holds some transition code.
"Legacy" cookies had UIDs *without* expiration dates, and recognized "0" as a legitimate UID for audienceNetwork. "Current" cookies always include UIDs with expiration dates, and never allow "0" for audienceNetwork.
This Unmarshal method interprets both data formats, and does some conversions on legacy data to make it current. If you're seeing this message after March 2018, it's safe to assume that all the legacy cookies have been updated and remove the legacy logic.
type Cooperative ¶ added in v0.173.0
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 Privacy ¶ added in v0.173.0
type Privacy interface { GDPRAllowsHostCookie() bool GDPRAllowsBidderSync(bidder string) bool CCPAAllowsBidderSync(bidder string) bool }
Privacy determines which privacy policies will be enforced for a user sync request.
type Request ¶ added in v0.173.0
type Request struct { Bidders []string Cooperative Cooperative Limit int Privacy Privacy SyncTypeFilter SyncTypeFilter }
Request specifies a user sync request.
type Result ¶ added in v0.173.0
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 ¶ added in v0.173.0
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 ¶ added in v0.173.0
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 ¶ added in v0.173.0
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 // StatusBlockedByGDPR specifies a user's GDPR TCF consent explicitly forbids host cookies // or specific bidder syncing. StatusBlockedByGDPR // StatusBlockedByCCPA specifies a user's CCPA consent explicitly forbids bidder syncing. StatusBlockedByCCPA // 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 )
type SyncType ¶ added in v0.173.0
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" )
func SyncTypeParse ¶ added in v0.173.0
SyncTypeParse returns the SyncType parsed from a string, case insensitive.
type SyncTypeFilter ¶ added in v0.173.0
type SyncTypeFilter struct { IFrame BidderFilter Redirect BidderFilter }
SyncTypeFilter determines which sync types, if any, the bidder is permitted to use.
func (SyncTypeFilter) ForBidder ¶ added in v0.173.0
func (t SyncTypeFilter) ForBidder(bidder string) []SyncType
ForBidder returns a slice of sync types the bidder is permitted to use.
type Syncer ¶ added in v0.173.0
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, privacyPolicies privacy.Policies) (Sync, error) }
Syncer represents the user sync configuration for a bidder or a shared set of bidders.
type SyncerBuildError ¶ added in v0.173.0
SyncerBuildError represents an error with building a syncer.
func (SyncerBuildError) Error ¶ added in v0.173.0
func (e SyncerBuildError) Error() string
Error implements the standard error interface.
type SyncerChoice ¶ added in v0.173.0
SyncerChoice specifies a syncer chosen.
type UniformBidderFilter ¶ added in v0.173.0
type UniformBidderFilter struct {
// contains filtered or unexported fields
}
UniformBidderFilter implements the BidderFilter interface which applies the same mode for all bidders.
func (UniformBidderFilter) Allowed ¶ added in v0.173.0
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.