Documentation ¶
Index ¶
- Constants
- type CookieSyncBidders
- type PBSCookie
- func (cookie *PBSCookie) AllowSyncs() bool
- func (cookie *PBSCookie) GetId(bidderName openrtb_ext.BidderName) (id string, exists bool)
- func (cookie *PBSCookie) GetUID(familyName string) (string, bool, bool)
- func (cookie *PBSCookie) GetUIDs() map[string]string
- func (cookie *PBSCookie) HasLiveSync(familyName string) bool
- func (cookie *PBSCookie) LiveSyncCount() int
- func (cookie *PBSCookie) MarshalJSON() ([]byte, error)
- func (cookie *PBSCookie) SetCookieOnResponse(w http.ResponseWriter, domain string, ttl time.Duration)
- func (cookie *PBSCookie) SetPreference(allow bool)
- func (cookie *PBSCookie) ToHTTPCookie(ttl time.Duration) *http.Cookie
- func (cookie *PBSCookie) TrySync(familyName string, uid string) error
- func (cookie *PBSCookie) UnmarshalJSON(b []byte) error
- func (cookie *PBSCookie) Unsync(familyName string)
- type UsersyncInfo
- type Usersyncer
Constants ¶
const DEFAULT_TTL = 14 * 24 * time.Hour
DEFAULT_TTL is the default amount of time which a cookie is considered valid.
const UID_COOKIE_NAME = "uids"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CookieSyncBidders ¶
type CookieSyncBidders struct { BidderCode string `json:"bidder"` NoCookie bool `json:"no_cookie,omitempty"` UsersyncInfo *UsersyncInfo `json:"usersync,omitempty"` }
type PBSCookie ¶
type PBSCookie struct {
// contains filtered or unexported fields
}
PBSCookie is the cookie used in Prebid Server.
To get an instance of this from a request, use ParsePBSCookieFromRequest. To write an instance onto a response, use SetCookieOnResponse.
func ParsePBSCookie ¶
ParsePBSCookie parses the UserSync cookie from a raw HTTP cookie.
func ParsePBSCookieFromRequest ¶
func ParsePBSCookieFromRequest(r *http.Request, cookie *config.HostCookie) *PBSCookie
ParsePBSCookieFromRequest parses the UserSyncMap from an HTTP Request.
func (*PBSCookie) AllowSyncs ¶
AllowSyncs is true if the user lets bidders sync cookies, and false otherwise.
func (*PBSCookie) GetId ¶
func (cookie *PBSCookie) GetId(bidderName openrtb_ext.BidderName) (id string, exists bool)
GetId wraps GetUID, letting callers fetch the ID given an OpenRTB BidderName.
func (*PBSCookie) GetUID ¶
GetUID Gets this user's ID for the given family. 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 (*PBSCookie) HasLiveSync ¶
HasLiveSync returns true if we have an active UID for the given family, and false otherwise.
func (*PBSCookie) LiveSyncCount ¶
LiveSyncCount returns the number of families which have active UIDs for this user.
func (*PBSCookie) MarshalJSON ¶
func (*PBSCookie) SetCookieOnResponse ¶
func (cookie *PBSCookie) SetCookieOnResponse(w http.ResponseWriter, domain string, ttl time.Duration)
SetCookieOnResponse is a shortcut for "ToHTTPCookie(); cookie.setDomain(domain); setCookie(w, cookie)"
func (*PBSCookie) SetPreference ¶
SetPreference is used to change whether or not we're allowed to sync cookies for this user.
func (*PBSCookie) ToHTTPCookie ¶
Gets an HTTP cookie containing all the data from this UserSyncMap. This is a snapshot--not a live view.
func (*PBSCookie) TrySync ¶
TrySync tries to set the UID for some family name. It returns an error if the set didn't happen.
func (*PBSCookie) UnmarshalJSON ¶
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 UsersyncInfo ¶
type Usersyncer ¶
type Usersyncer interface { // GetUsersyncInfo returns basic info the browser needs in order to run a user sync. // The returned UsersyncInfo object must not be mutated by callers. // // gdpr should be 1 if GDPR is active, 0 if not, and an empty string if we're not sure. // consent should be an empty string or a raw base64 url-encoded IAB Vendor Consent String. // // For more information about user syncs, see http://clearcode.cc/2015/12/cookie-syncing/ GetUsersyncInfo(gdpr string, consent string) (*UsersyncInfo, error) // FamilyName should be the same as the `BidderName` for this Usersyncer. // This function only exists for legacy reasons. // TODO #362: when the appnexus usersyncer is consistent, delete this and use the key // of NewSyncerMap() here instead. FamilyName() string // GDPRVendorID returns the ID in the IAB Global Vendor List which refers to this Bidder. // // The Global Vendor list can be found here: https://vendorlist.consensu.org/vendorlist.json // Bidders can register for the list here: https://register.consensu.org/ // // If you're not on the list, this should return 0. If cookie sync requests have GDPR consent info, // or the Prebid Server host company configures its deploy to be "cautious" when no GDPR info exists // in the request, it will _not_ sync user IDs with you. GDPRVendorID() uint16 }