Documentation ¶
Index ¶
- Constants
- Variables
- func AdjustPrice(price billing.Money, factor float64, remove bool) billing.Money
- func PrepareURL(url string, response Responser, it ResponserItem) string
- func PriceRevenueShareReduceFactors(price billing.Money, rs revenueShareReducerFactorer, remove bool) billing.Money
- func PriceSourceFactors(price billing.Money, src Source, remove bool) billing.Money
- func PriceSystemCommission(price billing.Money, item systemComissionFactorer, remove bool) billing.Money
- func ReturnResponse(o *Response)
- type AccessPoint
- type BaseFilter
- type BidRequest
- func (r *BidRequest) Age() uint
- func (r *BidRequest) Ages() [2]uint
- func (r *BidRequest) AppID() uint64
- func (r *BidRequest) AppInfo() *udetect.App
- func (r *BidRequest) BrowserID() uint64
- func (r *BidRequest) BrowserInfo() *udetect.Browser
- func (r *BidRequest) CarrierInfo() *udetect.Carrier
- func (r *BidRequest) Categories() []uint64
- func (r *BidRequest) City() string
- func (r *BidRequest) DeviceID() uint64
- func (r *BidRequest) DeviceInfo() *udetect.Device
- func (r *BidRequest) DeviceType() uint64
- func (r *BidRequest) Domain() []string
- func (r *BidRequest) DomainName() string
- func (r *BidRequest) ExtTargetIDs() []string
- func (r *BidRequest) FormatBitset() *searchtypes.NumberBitset[uint]
- func (r *BidRequest) FormatTypeMask() types.FormatTypeBitset
- func (r *BidRequest) Formats() []*types.Format
- func (r *BidRequest) Gender() byte
- func (r *BidRequest) GeoCode() string
- func (r *BidRequest) GeoID() uint64
- func (r *BidRequest) GeoInfo() *udetect.Geo
- func (r *BidRequest) Get(key string) any
- func (r *BidRequest) HTTPRequest() *fasthttp.RequestCtx
- func (r *BidRequest) Height() int
- func (r *BidRequest) ImpressionByID(id string) *Impression
- func (r *BidRequest) ImpressionByIDvariation(id string) *Impression
- func (r *BidRequest) ImpressionUpdate(fn func(imp *Impression) bool)
- func (r *BidRequest) Init(formats types.FormatsAccessor)
- func (r *BidRequest) IsAdblock() bool
- func (r *BidRequest) IsIPv6() bool
- func (r *BidRequest) IsPrivateBrowsing() bool
- func (r *BidRequest) IsProxy() bool
- func (r *BidRequest) IsRobot() bool
- func (r *BidRequest) IsSecure() bool
- func (r *BidRequest) Keywords() []string
- func (r *BidRequest) LanguageID() uint64
- func (r *BidRequest) MinECPM() (minBid billing.Money)
- func (r *BidRequest) OSID() uint64
- func (r *BidRequest) OSInfo() *udetect.OS
- func (r *BidRequest) ProjectID() uint64
- func (r *BidRequest) Release()
- func (r *BidRequest) ServiceDomain() string
- func (r *BidRequest) Set(key string, val any)
- func (r *BidRequest) SetSourceFilter(ids ...uint64)
- func (r *BidRequest) Sex() uint
- func (r *BidRequest) SiteInfo() *udetect.Site
- func (r *BidRequest) Size() (w, h int)
- func (r *BidRequest) SourceFilterCheck(id uint64) bool
- func (r *BidRequest) String() (res string)
- func (r *BidRequest) Tags() []string
- func (r *BidRequest) TargetID() uint64
- func (r *BidRequest) TargetIDs() []uint64
- func (r *BidRequest) Time() time.Time
- func (r *BidRequest) Unset(keys ...string)
- func (r *BidRequest) UserInfo() *User
- func (r *BidRequest) Validate() error
- func (r *BidRequest) Width() int
- type Data
- type Impression
- func (i *Impression) AccountID() uint64
- func (i *Impression) CommissionShareFactor() float64
- func (i *Impression) ContextSubType() openrtbnreq.ContextSubTypeID
- func (i *Impression) ContextType() openrtbnreq.ContextTypeID
- func (i *Impression) FormatBitset() *searchtypes.NumberBitset[uint]
- func (i *Impression) FormatByType(tp types.FormatType) *types.Format
- func (i *Impression) Formats() (f []*types.Format)
- func (i *Impression) Get(key string) any
- func (i *Impression) IDByFormat(format *types.Format) string
- func (i *Impression) Init(formats types.FormatsAccessor)
- func (i *Impression) IsDirect() bool
- func (i *Impression) IsNative() bool
- func (i *Impression) IsStandart() bool
- func (i *Impression) PlacementType() openrtbnreq.PlacementTypeID
- func (i *Impression) PurchasePrice(action admodels.Action) billing.Money
- func (i *Impression) RTBNativeRequest() *openrtbnreq.Request
- func (i *Impression) RTBNativeRequestV3() *openrtbnreq3.Request
- func (i *Impression) Set(key string, val any)
- func (i *Impression) TargetID() uint
- func (i *Impression) Unset(keys ...string)
- type NoSupportError
- type PriceFactor
- type RequestStrategy
- type Response
- func (r *Response) AddItem(it ResponserItemCommon)
- func (r *Response) Ads() []ResponserItemCommon
- func (r *Response) AuctionID() string
- func (r *Response) AuctionType() types.AuctionType
- func (r *Response) Context(ctx ...context.Context) context.Context
- func (r *Response) Count() int
- func (r *Response) Error() error
- func (r *Response) Get(key string) any
- func (r *Response) Item(impid string) ResponserItemCommon
- func (r *Response) Release()
- func (r *Response) Request() *BidRequest
- func (r *Response) Source() Source
- func (r *Response) Validate() (err error)
- type ResponseEmpty
- func (r ResponseEmpty) Ads() []ResponserItemCommon
- func (r ResponseEmpty) AuctionID() string
- func (r ResponseEmpty) AuctionType() types.AuctionType
- func (r *ResponseEmpty) Context(ctx ...context.Context) context.Context
- func (r ResponseEmpty) Count() int
- func (r ResponseEmpty) Error() error
- func (r ResponseEmpty) ExtImpressionID() string
- func (r ResponseEmpty) ExtTargetID() string
- func (r *ResponseEmpty) Get(key string) (res any)
- func (r ResponseEmpty) ID() string
- func (r ResponseEmpty) Impression() *Impression
- func (r ResponseEmpty) ImpressionID() string
- func (r ResponseEmpty) InternalAuctionCPMBid() billing.Money
- func (r ResponseEmpty) Item(impid string) ResponserItemCommon
- func (r ResponseEmpty) PriorityFormatType() types.FormatType
- func (r *ResponseEmpty) Release()
- func (r ResponseEmpty) Request() *BidRequest
- func (r ResponseEmpty) Source() Source
- func (r ResponseEmpty) Validate() error
- type ResponseItemBlank
- func (*ResponseItemBlank) AccountID() uint64
- func (*ResponseItemBlank) ActionURL() string
- func (*ResponseItemBlank) AdID() uint64
- func (*ResponseItemBlank) Asset(name string) *admodels.AdAsset
- func (*ResponseItemBlank) Assets() admodels.AdAssets
- func (it *ResponseItemBlank) BidPrice() billing.Money
- func (*ResponseItemBlank) CampaignID() uint64
- func (*ResponseItemBlank) ClickTrackerLinks() []string
- func (it *ResponseItemBlank) CommissionShareFactor() float64
- func (*ResponseItemBlank) ContentFields() map[string]any
- func (*ResponseItemBlank) ContentItem(name string) any
- func (*ResponseItemBlank) ContentItemString(name string) string
- func (*ResponseItemBlank) Context(ctx ...context.Context) context.Context
- func (it *ResponseItemBlank) ECPM() billing.Money
- func (it *ResponseItemBlank) ExtImpressionID() string
- func (it *ResponseItemBlank) ExtTargetID() string
- func (it *ResponseItemBlank) FinalPrice(action admodels.Action) billing.Money
- func (it *ResponseItemBlank) FixedPurchasePrice(action admodels.Action) billing.Money
- func (it *ResponseItemBlank) Format() *types.Format
- func (*ResponseItemBlank) Get(key string) any
- func (*ResponseItemBlank) Height() int
- func (it *ResponseItemBlank) ID() string
- func (it *ResponseItemBlank) Impression() *Impression
- func (it *ResponseItemBlank) ImpressionID() string
- func (*ResponseItemBlank) ImpressionTrackerLinks() []string
- func (it *ResponseItemBlank) InternalAuctionCPMBid() billing.Money
- func (*ResponseItemBlank) IsBackup() bool
- func (*ResponseItemBlank) IsDirect() bool
- func (*ResponseItemBlank) MainAsset() *admodels.AdAsset
- func (*ResponseItemBlank) NetworkName() string
- func (it *ResponseItemBlank) PotentialPrice(action admodels.Action) billing.Money
- func (it *ResponseItemBlank) Price(action admodels.Action) billing.Money
- func (it *ResponseItemBlank) PriceTestMode() bool
- func (it *ResponseItemBlank) PricingModel() types.PricingModel
- func (it *ResponseItemBlank) PriorityFormatType() types.FormatType
- func (it *ResponseItemBlank) PurchasePrice(action admodels.Action) billing.Money
- func (*ResponseItemBlank) Second() *SecondAd
- func (it *ResponseItemBlank) SetAuctionCPMBid(price billing.Money, includeFactors ...PriceFactor) error
- func (it *ResponseItemBlank) SetBidPrice(bid billing.Money) error
- func (it *ResponseItemBlank) Source() Source
- func (it *ResponseItemBlank) SourceCorrectionFactor() float64
- func (it *ResponseItemBlank) TargetCorrectionFactor() float64
- func (*ResponseItemBlank) Validate() error
- func (*ResponseItemBlank) ViewTrackerLinks() []string
- func (*ResponseItemBlank) Width() int
- type ResponseItemBlock
- func (i *ResponseItemBlock) Ads() []ResponserItem
- func (i *ResponseItemBlock) Context(ctx ...context.Context) context.Context
- func (i *ResponseItemBlock) Count() int
- func (i *ResponseItemBlock) ExtImpressionID() string
- func (i *ResponseItemBlock) ExtTargetID() string
- func (i *ResponseItemBlock) Get(key string) any
- func (i *ResponseItemBlock) ID() string
- func (i *ResponseItemBlock) Impression() *Impression
- func (i *ResponseItemBlock) ImpressionID() string
- func (i *ResponseItemBlock) InternalAuctionCPMBid() (bid billing.Money)
- func (i *ResponseItemBlock) Price(action admodels.Action) (price billing.Money)
- func (i *ResponseItemBlock) PriorityFormatType() types.FormatType
- func (i *ResponseItemBlock) Validate() (err error)
- type ResponseItemEmpty
- func (*ResponseItemEmpty) AccountID() uint64
- func (*ResponseItemEmpty) ActionURL() string
- func (*ResponseItemEmpty) AdID() uint64
- func (*ResponseItemEmpty) Asset(name string) *admodels.AdAsset
- func (*ResponseItemEmpty) Assets() admodels.AdAssets
- func (*ResponseItemEmpty) BidPrice() billing.Money
- func (*ResponseItemEmpty) CampaignID() uint64
- func (*ResponseItemEmpty) ClickTrackerLinks() []string
- func (*ResponseItemEmpty) CommissionShareFactor() float64
- func (*ResponseItemEmpty) ContentFields() map[string]any
- func (*ResponseItemEmpty) ContentItem(name string) any
- func (*ResponseItemEmpty) ContentItemString(name string) string
- func (*ResponseItemEmpty) Context(ctx ...context.Context) context.Context
- func (*ResponseItemEmpty) ECPM() billing.Money
- func (*ResponseItemEmpty) ExtImpressionID() string
- func (*ResponseItemEmpty) ExtTargetID() string
- func (*ResponseItemEmpty) FinalPrice(action admodels.Action) billing.Money
- func (*ResponseItemEmpty) Format() *types.Format
- func (*ResponseItemEmpty) Get(key string) any
- func (*ResponseItemEmpty) Height() int
- func (*ResponseItemEmpty) ID() string
- func (*ResponseItemEmpty) Impression() *Impression
- func (*ResponseItemEmpty) ImpressionID() string
- func (*ResponseItemEmpty) ImpressionTrackerLinks() []string
- func (*ResponseItemEmpty) InternalAuctionCPMBid() billing.Money
- func (*ResponseItemEmpty) IsBackup() bool
- func (*ResponseItemEmpty) IsDirect() bool
- func (*ResponseItemEmpty) MainAsset() *admodels.AdAsset
- func (*ResponseItemEmpty) NetworkName() string
- func (*ResponseItemEmpty) PotentialPercent() float64
- func (*ResponseItemEmpty) PotentialPrice(action admodels.Action) billing.Money
- func (*ResponseItemEmpty) Price(action admodels.Action) billing.Money
- func (*ResponseItemEmpty) PriceTestMode() bool
- func (*ResponseItemEmpty) PricingModel() types.PricingModel
- func (*ResponseItemEmpty) PriorityFormatType() types.FormatType
- func (*ResponseItemEmpty) PurchasePrice(action admodels.Action) billing.Money
- func (*ResponseItemEmpty) Second() *SecondAd
- func (*ResponseItemEmpty) SetAuctionCPMBid(price billing.Money, includeFactors ...PriceFactor) error
- func (*ResponseItemEmpty) SetBidPrice(price billing.Money) error
- func (*ResponseItemEmpty) Source() Source
- func (it *ResponseItemEmpty) SourceCorrectionFactor() float64
- func (it *ResponseItemEmpty) TargetCorrectionFactor() float64
- func (*ResponseItemEmpty) Validate() error
- func (*ResponseItemEmpty) ViewTrackerLinks() []string
- func (*ResponseItemEmpty) Width() int
- type Responser
- type ResponserItem
- type ResponserItemCommon
- type ResponserMultipleItem
- type SecondAd
- type Segment
- type Source
- type SourceAccessor
- type SourceEmpty
- func (*SourceEmpty) Bid(request *BidRequest) Responser
- func (*SourceEmpty) ID() uint64
- func (*SourceEmpty) ObjectKey() uint64
- func (s *SourceEmpty) PriceCorrectionReduceFactor() float64
- func (*SourceEmpty) ProcessResponseItem(Responser, ResponserItem)
- func (*SourceEmpty) Protocol() string
- func (*SourceEmpty) RequestStrategy() RequestStrategy
- func (*SourceEmpty) Test(request *BidRequest) bool
- type SourceIterator
- type SourceMinimal
- type SourceTesteChecker
- type SourceTester
- type SourceTimeoutSetter
- type TypeSex
- type URLGenerator
- type User
- func (u User) AvgAge() byte
- func (u *User) BirthdayTime() time.Time
- func (u *User) GetDataItem(name string) (v string, ok bool)
- func (u *User) GetDataItemOrDefault(name, def string) string
- func (u User) RTBObject() *openrtb.User
- func (u *User) SetDataItem(name, value string)
- func (u *User) SetSexByString(sex string)
- func (u User) Sex() TypeSex
- type WinEvent
Constants ¶
const ( NativeAssetUndefined = iota // Undefined asset NativeAssetTitle // Title asset NativeAssetLegend // Legend asset NativeAssetMainImage // Main image asset NativeAssetIcon // Icon asset NativeAssetRating // Rating asset NativeAssetSponsored // Sponsored asset )
Native asset IDs enumeration for different native ad components
const ( ContentItemLink = "link" // URL to which the ad redirects ContentItemContent = "content" // Main content of the ad ContentItemIFrameURL = "iframe_url" // URL for embedding the ad in an iframe ContentItemNotifyWinURL = "notify_win_url" // URL to notify when the ad wins an auction ContentItemNotifyDisplayURL = "notify_display_url" // URL to notify when the ad is displayed )
Content item names represent various components of an advertisement. These constants are used as keys to retrieve specific content items from an ad response.
Variables ¶
var ( // For bidding validation ErrInvalidCur = errors.New("bid currency is not valid") ErrInvalidCreativeSize = errors.New("creative size is invalid") ErrInvalidViewType = errors.New("view type is invalid") ErrLowPrice = errors.New("bid Price is lower than floor price") ErrResponseEmpty = errors.New("response is empty") ErrResponseInvalidType = errors.New("invalid response type") ErrResponseInvalidGroup = errors.New("system not support group winners") ErrInvalidItemInitialisation = errors.New("invalid item initialisation") )
Set of errors
var (
ErrInvalidURL = errors.New("invalid URL value")
)
Errors
var ( // ErrNewAuctionBidIsHigherThenMaxBid is returned when a new auction bid exceeds the maximum allowed bid. ErrNewAuctionBidIsHigherThenMaxBid = errors.New("new auction bid is higher than max bid") )
Predefined errors used within the adtype package.
Functions ¶
func PrepareURL ¶
func PrepareURL(url string, response Responser, it ResponserItem) string
PrepareURL by event
func PriceRevenueShareReduceFactors ¶
func PriceRevenueShareReduceFactors(price billing.Money, rs revenueShareReducerFactorer, remove bool) billing.Money
PriceRevenueShareReduceFactors correction to reduce descreancy
func PriceSourceFactors ¶
PriceSourceFactors currection to reduce descreancy
Types ¶
type AccessPoint ¶
type AccessPoint interface { // ID of source ID() uint64 }
AccessPoint is the DSP source
type BaseFilter ¶
type BaseFilter struct { Secure int8 // 0 - any, 1 - only secure, 2 - no secure Adblock int8 // 0 - any, 1 - only adblock, 2 - no adblock PrivateBrowsing int8 // 0 - any, 1 - only private, 2 - no private IP int8 // 0 - any, 1 - IPv4, 2 - IPv6 Devices []uint64 // Devices type OS []uint64 OSExclude []uint64 Browsers []uint64 BrowsersExclude []uint64 Categories []uint64 Countries []string Applications []uint64 ApplicationsExclude []uint64 Domains []string DomainsExclude []string Zones []uint64 ZonesExclude []uint64 ExternalZones []string ExternalZonesExclude []string }
BaseFilter object
func (*BaseFilter) Test ¶
func (f *BaseFilter) Test(request *BidRequest) bool
Test base from search request
type BidRequest ¶
type BidRequest struct { Ctx context.Context `json:"-"` // Context for request handling ID string `json:"id,omitempty"` // Auction ID ExtID string `json:"bidid,omitempty"` // External Auction ID AccessPoint AccessPoint `json:"-"` // Access point information Debug bool `json:"debug,omitempty"` // Debug mode flag AuctionType types.AuctionType `json:"auction_type,omitempty"` // Type of auction RequestCtx *fasthttp.RequestCtx `json:"-"` // HTTP request context Request any `json:"-"` // Original request from RTB or another protocol Person personification.Person `json:"-"` // Personification data Imps []Impression `json:"imps,omitempty"` // List of impressions AppTarget *admodels.Application `json:"app_target,omitempty"` // Target application Device *udetect.Device `json:"device,omitempty"` // Device information App *udetect.App `json:"app,omitempty"` // App information Site *udetect.Site `json:"site,omitempty"` // Site information User *User `json:"user,omitempty"` // User information Secure int `json:"secure,omitempty"` // Security flag (1 if secure) Adblock int `json:"adb,omitempty"` // Adblock flag (1 if adblock enabled) PrivateBrowsing int `json:"pb,omitempty"` // Private browsing flag (1 if enabled) Ext map[string]any `json:"ext,omitempty"` // Additional extensions Timemark time.Time `json:"timemark,omitempty"` // Timestamp of the request Tracer any `json:"-"` // Tracing information // contains filtered or unexported fields }
BidRequest represents a bid request in the ad system. It contains all necessary information for processing an ad bid.
func (*BidRequest) Age ¶
func (r *BidRequest) Age() uint
Age returns the most relevant age of the user. Returns the starting age if AgeStart <= AgeEnd, otherwise returns AgeStart.
func (*BidRequest) Ages ¶
func (r *BidRequest) Ages() [2]uint
Ages returns a range of ages [AgeStart, AgeEnd]. If AgeStart > AgeEnd, it still returns [AgeStart, AgeEnd].
func (*BidRequest) AppID ¶
func (r *BidRequest) AppID() uint64
AppID returns the ID of the target application. Returns 0 if the app target is unavailable.
func (*BidRequest) AppInfo ¶
func (r *BidRequest) AppInfo() *udetect.App
AppInfo returns the application information associated with the BidRequest.
func (*BidRequest) BrowserID ¶
func (r *BidRequest) BrowserID() uint64
BrowserID returns the ID of the user's browser. Returns 0 if device or browser information is unavailable.
func (*BidRequest) BrowserInfo ¶
func (r *BidRequest) BrowserInfo() *udetect.Browser
BrowserInfo returns the browser information associated with the BidRequest.
func (*BidRequest) CarrierInfo ¶
func (r *BidRequest) CarrierInfo() *udetect.Carrier
CarrierInfo returns the carrier information associated with the user's geography.
func (*BidRequest) Categories ¶
func (r *BidRequest) Categories() []uint64
Categories returns a slice of category IDs associated with the BidRequest. Currently, it returns the cached categoryArray. (Note: The implementation is incomplete and commented out for future development.)
func (*BidRequest) City ¶
func (r *BidRequest) City() string
City returns the city associated with the user's geography. Returns an empty string if geographical information is unavailable.
func (*BidRequest) DeviceID ¶
func (r *BidRequest) DeviceID() uint64
DeviceID returns the ID of the device associated with the BidRequest. Returns 0 if device information is unavailable.
func (*BidRequest) DeviceInfo ¶
func (r *BidRequest) DeviceInfo() *udetect.Device
DeviceInfo returns the device information associated with the BidRequest. It initializes default values if device, browser, or OS information is missing.
func (*BidRequest) DeviceType ¶
func (r *BidRequest) DeviceType() uint64
DeviceType returns the type of the device as an unsigned integer. Returns 0 if device information is unavailable.
func (*BidRequest) Domain ¶
func (r *BidRequest) Domain() []string
Domain returns a list of domains associated with the site or app. It prepares the domain list by aggregating from Site and App information.
func (*BidRequest) DomainName ¶
func (r *BidRequest) DomainName() string
DomainName returns the primary domain name of the site or the bundle name of the app.
func (*BidRequest) ExtTargetIDs ¶
func (r *BidRequest) ExtTargetIDs() []string
ExtTargetIDs returns a slice of external target IDs associated with the BidRequest.
func (*BidRequest) FormatBitset ¶
func (r *BidRequest) FormatBitset() *searchtypes.NumberBitset[uint]
FormatBitset returns a bitset representing the format IDs in the BidRequest. It populates the bitset if it's currently empty.
func (*BidRequest) FormatTypeMask ¶
func (r *BidRequest) FormatTypeMask() types.FormatTypeBitset
FormatTypeMask returns a bitmask representing the types of formats in the BidRequest. It populates the mask if it's currently empty.
func (*BidRequest) Formats ¶
func (r *BidRequest) Formats() []*types.Format
Formats returns the list of formats associated with the BidRequest. If the formats slice is empty, it aggregates formats from all impressions.
func (*BidRequest) Gender ¶
func (r *BidRequest) Gender() byte
Gender returns the most relevant gender as a byte. Returns '?' if gender information is unavailable or invalid.
func (*BidRequest) GeoCode ¶
func (r *BidRequest) GeoCode() string
GeoCode returns the country code associated with the user's geography. Returns "**" if geographical information is unavailable.
func (*BidRequest) GeoID ¶
func (r *BidRequest) GeoID() uint64
GeoID returns the geographical ID associated with the user. Returns 0 if geographical information is unavailable.
func (*BidRequest) GeoInfo ¶
func (r *BidRequest) GeoInfo() *udetect.Geo
GeoInfo returns the geographical information associated with the BidRequest.
func (*BidRequest) Get ¶
func (r *BidRequest) Get(key string) any
Get retrieves a value from the BidRequest's extension map by key. Returns nil if the key does not exist.
func (*BidRequest) HTTPRequest ¶
func (r *BidRequest) HTTPRequest() *fasthttp.RequestCtx
HTTPRequest returns the underlying HTTP request context.
func (*BidRequest) Height ¶
func (r *BidRequest) Height() int
Height returns the height of the device's browser. Returns 0 if device or browser information is unavailable.
func (*BidRequest) ImpressionByID ¶
func (r *BidRequest) ImpressionByID(id string) *Impression
ImpressionByID returns a pointer to the Impression with the specified ID. Returns nil if no matching impression is found.
func (*BidRequest) ImpressionByIDvariation ¶
func (r *BidRequest) ImpressionByIDvariation(id string) *Impression
ImpressionByIDvariation returns a pointer to the first Impression whose ID is a prefix of the provided ID. This allows matching impressions even if the ID contains additional postfixes. Returns nil if no matching impression is found.
func (*BidRequest) ImpressionUpdate ¶
func (r *BidRequest) ImpressionUpdate(fn func(imp *Impression) bool)
ImpressionUpdate applies a provided function to each impression in the BidRequest. If the function returns true, the impression is updated.
func (*BidRequest) Init ¶
func (r *BidRequest) Init(formats types.FormatsAccessor)
Init initializes the BidRequest with basic information. It resets the formats slice and format bitset, and initializes each impression using the provided formats accessor.
func (*BidRequest) IsAdblock ¶
func (r *BidRequest) IsAdblock() bool
IsAdblock checks if the user has an ad blocker enabled.
func (*BidRequest) IsIPv6 ¶
func (r *BidRequest) IsIPv6() bool
IsIPv6 checks if the user's IP address is IPv6.
func (*BidRequest) IsPrivateBrowsing ¶
func (r *BidRequest) IsPrivateBrowsing() bool
IsPrivateBrowsing checks if the user is in private browsing mode.
func (*BidRequest) IsProxy ¶
func (r *BidRequest) IsProxy() bool
IsProxy checks if the user is using a proxy.
func (*BidRequest) IsRobot ¶
func (r *BidRequest) IsRobot() bool
IsRobot checks if the user is a robot.
func (*BidRequest) IsSecure ¶
func (r *BidRequest) IsSecure() bool
IsSecure checks if the request is made over a secure connection.
func (*BidRequest) Keywords ¶
func (r *BidRequest) Keywords() []string
Keywords returns a slice of keywords associated with the user. Returns nil if user information is unavailable.
func (*BidRequest) LanguageID ¶
func (r *BidRequest) LanguageID() uint64
LanguageID returns the language ID based on the primary language of the browser.
func (*BidRequest) MinECPM ¶
func (r *BidRequest) MinECPM() (minBid billing.Money)
MinECPM calculates and returns the minimum ECPM (Effective Cost Per Mille) acceptable for the BidRequest. It iterates through all impressions and selects the highest bid floor.
func (*BidRequest) OSID ¶
func (r *BidRequest) OSID() uint64
OSID returns the ID of the user's operating system. Returns 0 if device or OS information is unavailable.
func (*BidRequest) OSInfo ¶
func (r *BidRequest) OSInfo() *udetect.OS
OSInfo returns the operating system information associated with the BidRequest.
func (*BidRequest) ProjectID ¶
func (r *BidRequest) ProjectID() uint64
ProjectID returns the Project ID associated with the BidRequest. Currently returns 0 as a placeholder.
func (*BidRequest) Release ¶
func (r *BidRequest) Release()
Release releases any resources associated with the BidRequest. If the original request implements the releaser interface, it calls the Release method.
func (*BidRequest) ServiceDomain ¶
func (r *BidRequest) ServiceDomain() string
ServiceDomain returns the domain of the service handling the request.
func (*BidRequest) Set ¶
func (r *BidRequest) Set(key string, val any)
Set sets a key-value pair in the BidRequest's extension map.
func (*BidRequest) SetSourceFilter ¶
func (r *BidRequest) SetSourceFilter(ids ...uint64)
SetSourceFilter sets the source filter IDs for the BidRequest. It replaces any existing source IDs with the provided ones.
func (*BidRequest) Sex ¶
func (r *BidRequest) Sex() uint
Sex returns the user's sex as an unsigned integer. Returns 0 if user information is unavailable.
func (*BidRequest) SiteInfo ¶
func (r *BidRequest) SiteInfo() *udetect.Site
SiteInfo returns the site information associated with the BidRequest. If the site is unavailable, it returns the default site information. Returns nil if neither site nor app information is available.
func (*BidRequest) Size ¶
func (r *BidRequest) Size() (w, h int)
Size returns the width and height of the area of visibility for the ad.
func (*BidRequest) SourceFilterCheck ¶
func (r *BidRequest) SourceFilterCheck(id uint64) bool
SourceFilterCheck checks if a given source ID is allowed by the current filter. Returns true if no filter is set or if the ID is present in the filter.
func (*BidRequest) String ¶
func (r *BidRequest) String() (res string)
String implements the fmt.Stringer interface for BidRequest. It returns a pretty-printed JSON representation of the BidRequest. If marshalling fails, it returns an error message in JSON format.
func (*BidRequest) Tags ¶
func (r *BidRequest) Tags() []string
Tags returns a list of tags associated with the BidRequest. It aggregates keywords from the user and site information.
func (*BidRequest) TargetID ¶
func (r *BidRequest) TargetID() uint64
TargetID returns the target ID if there is exactly one impression with a target. Otherwise, returns 0.
func (*BidRequest) TargetIDs ¶
func (r *BidRequest) TargetIDs() []uint64
TargetIDs returns a slice of target IDs associated with the BidRequest.
func (*BidRequest) Time ¶
func (r *BidRequest) Time() time.Time
Time returns the timestamp of the BidRequest.
func (*BidRequest) Unset ¶
func (r *BidRequest) Unset(keys ...string)
Unset removes one or more keys from the BidRequest's extension map.
func (*BidRequest) UserInfo ¶
func (r *BidRequest) UserInfo() *User
UserInfo returns the user information associated with the BidRequest. It initializes default values if user or geographical information is missing.
func (*BidRequest) Validate ¶
func (r *BidRequest) Validate() error
Validate performs validation on the BidRequest. Currently, it always returns nil, but can be extended to include validation logic.
func (*BidRequest) Width ¶
func (r *BidRequest) Width() int
Width returns the width of the device's browser. Returns 0 if device or browser information is unavailable.
type Data ¶
type Data struct { Name string `json:"name,omitempty"` Segment []Segment `json:"segment,omitempty"` }
Data item segment
type Impression ¶
type Impression struct { ID string `json:"id,omitempty"` // Internal impression ID ExternalID string `json:"extid,omitempty"` // External impression ID (ImpID) ExternalTargetID string `json:"exttrgid"` // External zone ID (tagid) Request any `json:"request,omitempty"` // Contains subrequest from RTB or another protocol Target admodels.Target `json:"target,omitempty"` // BidFloorCPM billing.Money `json:"bid_floor,omitempty"` // PurchaseViewPrice billing.Money `json:"purchase_view_price,omitempty"` // Pos int `json:"pos,omitempty"` // 5.4 Ad Position Count int `json:"cnt,omitempty"` // Count of places for multiple banners // Sizes and position on the screen X int `json:"x,omitempty"` Y int `json:"y,omitempty"` Width int `json:"w,omitempty"` Height int `json:"h,omitempty"` WidthMax int `json:"wm,omitempty"` HeightMax int `json:"hm,omitempty"` // Additional identifiers SubID1 string `json:"subid1,omitempty"` SubID2 string `json:"subid2,omitempty"` SubID3 string `json:"subid3,omitempty"` SubID4 string `json:"subid4,omitempty"` SubID5 string `json:"subid5,omitempty"` // Format types for impression FormatTypes types.FormatTypeBitset `json:"-"` Ext map[string]any `json:"ext,omitempty"` // contains filtered or unexported fields }
Impression target
func (*Impression) CommissionShareFactor ¶
func (i *Impression) CommissionShareFactor() float64
CommissionShareFactor which system get from publisher from 0 to 1
func (*Impression) ContextSubType ¶
func (i *Impression) ContextSubType() openrtbnreq.ContextSubTypeID
ContextSubType IDs 7.4 @link https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-Native-Ads-Specification-1-1_2016.pdf
func (*Impression) ContextType ¶
func (i *Impression) ContextType() openrtbnreq.ContextTypeID
ContextType IDs 7.3 @link https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-Native-Ads-Specification-1-1_2016.pdf
func (*Impression) FormatBitset ¶
func (i *Impression) FormatBitset() *searchtypes.NumberBitset[uint]
FormatBitset of IDs
func (*Impression) FormatByType ¶
func (i *Impression) FormatByType(tp types.FormatType) *types.Format
FormatByType of formats
func (*Impression) IDByFormat ¶
func (i *Impression) IDByFormat(format *types.Format) string
IDByFormat return specific ID to link format
func (*Impression) Init ¶
func (i *Impression) Init(formats types.FormatsAccessor)
Init internal information
func (*Impression) PlacementType ¶
func (i *Impression) PlacementType() openrtbnreq.PlacementTypeID
PlacementType IDs 7.5 @link https://www.iab.com/wp-content/uploads/2016/03/OpenRTB-Native-Ads-Specification-1-1_2016.pdf
func (*Impression) PurchasePrice ¶
func (i *Impression) PurchasePrice(action admodels.Action) billing.Money
PurchasePrice return the price of need to pay for the action to the connected network or application if price is fixed
func (*Impression) RTBNativeRequest ¶
func (i *Impression) RTBNativeRequest() *openrtbnreq.Request
RTBNativeRequest object
func (*Impression) RTBNativeRequestV3 ¶
func (i *Impression) RTBNativeRequestV3() *openrtbnreq3.Request
RTBNativeRequestV3 object
type PriceFactor ¶
type PriceFactor uint32
PriceFactor defines action to calculate the factor
const ( NonePriceFactor PriceFactor = 0x0000 AllPriceFactors PriceFactor = 0xffffffff SourcePriceFactor PriceFactor = 0x0001 SystemComissionPriceFactor PriceFactor = 0x0002 TargetReducePriceFactor PriceFactor = 0x0004 )
func PriceFactorFromList ¶
func PriceFactorFromList(factors ...PriceFactor) (f PriceFactor)
PriceFactorFromList create factor from list
func (PriceFactor) AddComission ¶
func (f PriceFactor) AddComission(price billing.Money, it ResponserItem) (comissions billing.Money)
AddComission to price and rеturns comissions with positive sign `+`
func (PriceFactor) RemoveComission ¶
func (f PriceFactor) RemoveComission(price billing.Money, it ResponserItem) (comissions billing.Money)
RemoveComission from price and rеturns comissions with negative sign `-`
type RequestStrategy ¶
type RequestStrategy int
RequestStrategy defines politics of request sending
const ( // AsynchronousRequestStrategy is default strategy implies // requesting all auction participants and choising the most // profitable variant of all AsynchronousRequestStrategy RequestStrategy = iota // SingleRequestStrategy tells that if response was // received it should be performed SingleRequestStrategy )
func (RequestStrategy) IsAsynchronous ¶
func (rs RequestStrategy) IsAsynchronous() bool
func (RequestStrategy) IsSingle ¶
func (rs RequestStrategy) IsSingle() bool
type Response ¶
type Response struct {
// contains filtered or unexported fields
}
Response from different sources
func BorrowResponse ¶
func BorrowResponse(request *BidRequest, source Source, items []ResponserItemCommon, err error) *Response
BorrowResponse object
func NewErrorResponse ¶
func NewErrorResponse(request *BidRequest, err error) *Response
NewErrorResponse object
func NewResponse ¶
func NewResponse(request *BidRequest, source Source, items []ResponserItemCommon, err error) *Response
NewResponse common object
func (*Response) AuctionType ¶
func (r *Response) AuctionType() types.AuctionType
AuctionType of request
func (*Response) Item ¶
func (r *Response) Item(impid string) ResponserItemCommon
Item by impression code
type ResponseEmpty ¶
type ResponseEmpty struct { ItemID string Req *BidRequest Src Source Imp *Impression Bid *openrtb.Bid Err error // contains filtered or unexported fields }
ResponseEmpty object represents empty response and response item
func NewEmptyResponse ¶
func NewEmptyResponse(request *BidRequest, src Source, err error) *ResponseEmpty
NewEmptyResponse by bid request
func (ResponseEmpty) AuctionID ¶
func (r ResponseEmpty) AuctionID() string
AuctionID returns ID of the current auction
func (ResponseEmpty) AuctionType ¶
func (r ResponseEmpty) AuctionType() types.AuctionType
AuctionType returns type of the auction (first price, second price, etc)
func (*ResponseEmpty) Context ¶
func (r *ResponseEmpty) Context(ctx ...context.Context) context.Context
Context value
func (ResponseEmpty) ExtImpressionID ¶
func (r ResponseEmpty) ExtImpressionID() string
ExtImpressionID it's unique code of the auction bid impression
func (ResponseEmpty) ExtTargetID ¶
func (r ResponseEmpty) ExtTargetID() string
ExtTargetID of the external network
func (ResponseEmpty) ID ¶
func (r ResponseEmpty) ID() string
ID of current response item (unique code of current response)
func (ResponseEmpty) Impression ¶
func (r ResponseEmpty) Impression() *Impression
Impression place object
func (ResponseEmpty) ImpressionID ¶
func (r ResponseEmpty) ImpressionID() string
ImpressionID unique code string
func (ResponseEmpty) InternalAuctionCPMBid ¶
func (r ResponseEmpty) InternalAuctionCPMBid() billing.Money
InternalAuctionCPMBid value provides maximal possible price without any comission According to this value the system can choice the best item for the auction
func (ResponseEmpty) Item ¶
func (r ResponseEmpty) Item(impid string) ResponserItemCommon
Item by impression code
func (ResponseEmpty) PriorityFormatType ¶
func (r ResponseEmpty) PriorityFormatType() types.FormatType
PriorityFormatType from current Ad
func (*ResponseEmpty) Release ¶
func (r *ResponseEmpty) Release()
Release response and all linked objects
func (ResponseEmpty) Request ¶
func (r ResponseEmpty) Request() *BidRequest
Request returns the original request object
func (ResponseEmpty) Source ¶
func (r ResponseEmpty) Source() Source
Source returns source of the response
type ResponseItemBlank ¶
type ResponseItemBlank struct { ItemID string Imp *Impression Src Source FormatVal *types.Format PricingModelVal types.PricingModel PriceScope price.PriceScope }
ResponseItemBlank value
func (*ResponseItemBlank) ActionURL ¶
func (*ResponseItemBlank) ActionURL() string
ActionURL returns target resource link for direct and banner click as well
func (*ResponseItemBlank) Asset ¶
func (*ResponseItemBlank) Asset(name string) *admodels.AdAsset
Asset by name
func (*ResponseItemBlank) BidPrice ¶
func (it *ResponseItemBlank) BidPrice() billing.Money
BidPrice returns bid price for the external auction source. The current bid price will be adjusted according to the source correction factor and the commission share factor
func (*ResponseItemBlank) CampaignID ¶
func (*ResponseItemBlank) CampaignID() uint64
CampaignID number
func (*ResponseItemBlank) ClickTrackerLinks ¶
func (*ResponseItemBlank) ClickTrackerLinks() []string
ClickTrackerLinks returns traking links for click action
func (*ResponseItemBlank) CommissionShareFactor ¶
func (it *ResponseItemBlank) CommissionShareFactor() float64
CommissionShareFactor returns the commission share percentage which system gets from publisher.
func (*ResponseItemBlank) ContentFields ¶
func (*ResponseItemBlank) ContentFields() map[string]any
ContentFields from advertisement object
func (*ResponseItemBlank) ContentItem ¶
func (*ResponseItemBlank) ContentItem(name string) any
ContentItem returns the ad response data
func (*ResponseItemBlank) ContentItemString ¶
func (*ResponseItemBlank) ContentItemString(name string) string
ContentItemString from the ad
func (*ResponseItemBlank) Context ¶
func (*ResponseItemBlank) Context(ctx ...context.Context) context.Context
Context value
func (*ResponseItemBlank) ECPM ¶
func (it *ResponseItemBlank) ECPM() billing.Money
ECPM returns the effective cost per mille of the item.
func (*ResponseItemBlank) ExtImpressionID ¶
func (it *ResponseItemBlank) ExtImpressionID() string
ExtImpressionID it's unique code of the auction bid impression
func (*ResponseItemBlank) ExtTargetID ¶
func (it *ResponseItemBlank) ExtTargetID() string
ExtTargetID of the external network
func (*ResponseItemBlank) FinalPrice ¶
func (it *ResponseItemBlank) FinalPrice(action admodels.Action) billing.Money
FinalPrice returns final price for the item which is including all possible commissions with all corrections
func (*ResponseItemBlank) FixedPurchasePrice ¶
func (it *ResponseItemBlank) FixedPurchasePrice(action admodels.Action) billing.Money
FixedPurchasePrice returns the fixed price of the action
func (*ResponseItemBlank) Format ¶
func (it *ResponseItemBlank) Format() *types.Format
Format object
func (*ResponseItemBlank) ID ¶
func (it *ResponseItemBlank) ID() string
ID of current response item (unique code of current response)
func (*ResponseItemBlank) Impression ¶
func (it *ResponseItemBlank) Impression() *Impression
Impression place object
func (*ResponseItemBlank) ImpressionID ¶
func (it *ResponseItemBlank) ImpressionID() string
ImpressionID unique code string
func (*ResponseItemBlank) ImpressionTrackerLinks ¶
func (*ResponseItemBlank) ImpressionTrackerLinks() []string
ImpressionTrackerLinks returns traking links for impression action
func (*ResponseItemBlank) InternalAuctionCPMBid ¶
func (it *ResponseItemBlank) InternalAuctionCPMBid() billing.Money
InternalAuctionCPMBid value provides maximal possible price without any comission According to this value the system can choice the best item for the auction
func (*ResponseItemBlank) IsBackup ¶
func (*ResponseItemBlank) IsBackup() bool
IsBackup indicates whether the advertisement is a backup ad type.
func (*ResponseItemBlank) MainAsset ¶
func (*ResponseItemBlank) MainAsset() *admodels.AdAsset
MainAsset from response
func (*ResponseItemBlank) NetworkName ¶
func (*ResponseItemBlank) NetworkName() string
NetworkName by source
func (*ResponseItemBlank) PotentialPrice ¶
func (it *ResponseItemBlank) PotentialPrice(action admodels.Action) billing.Money
PotentialPrice wich can be received from source but was marked as descrepancy
func (*ResponseItemBlank) Price ¶
func (it *ResponseItemBlank) Price(action admodels.Action) billing.Money
Price per specific action type (view, click, lead, etc)
func (*ResponseItemBlank) PriceTestMode ¶
func (it *ResponseItemBlank) PriceTestMode() bool
PriceTestMode returns true if the price is in test mode
func (*ResponseItemBlank) PricingModel ¶
func (it *ResponseItemBlank) PricingModel() types.PricingModel
PricingModel of advertisement
func (*ResponseItemBlank) PriorityFormatType ¶
func (it *ResponseItemBlank) PriorityFormatType() types.FormatType
PriorityFormatType from current Ad
func (*ResponseItemBlank) PurchasePrice ¶
func (it *ResponseItemBlank) PurchasePrice(action admodels.Action) billing.Money
PurchasePrice gives the price of view from external resource. The cost of this request.
func (*ResponseItemBlank) SetAuctionCPMBid ¶
func (it *ResponseItemBlank) SetAuctionCPMBid(price billing.Money, includeFactors ...PriceFactor) error
SetAuctionCPMBid value for external sources auction the system will pay
func (*ResponseItemBlank) SetBidPrice ¶
func (it *ResponseItemBlank) SetBidPrice(bid billing.Money) error
SetBidPrice value for external sources auction the system will pay
func (*ResponseItemBlank) SourceCorrectionFactor ¶
func (it *ResponseItemBlank) SourceCorrectionFactor() float64
SourceCorrectionFactor value for the source
func (*ResponseItemBlank) TargetCorrectionFactor ¶
func (it *ResponseItemBlank) TargetCorrectionFactor() float64
TargetCorrectionFactor value for the target
func (*ResponseItemBlank) ViewTrackerLinks ¶
func (*ResponseItemBlank) ViewTrackerLinks() []string
ViewTrackerLinks returns traking links for view action
type ResponseItemBlock ¶
type ResponseItemBlock struct { Items []ResponserItem // contains filtered or unexported fields }
ResponseItemBlock group of simple items
func (*ResponseItemBlock) Context ¶
func (i *ResponseItemBlock) Context(ctx ...context.Context) context.Context
Context value
func (*ResponseItemBlock) ExtImpressionID ¶
func (i *ResponseItemBlock) ExtImpressionID() string
ExtImpressionID it's unique code of the auction bid impression
func (*ResponseItemBlock) ExtTargetID ¶
func (i *ResponseItemBlock) ExtTargetID() string
ExtTargetID of the external network
func (*ResponseItemBlock) ID ¶
func (i *ResponseItemBlock) ID() string
ID of current response item (unique code of current response)
func (*ResponseItemBlock) Impression ¶
func (i *ResponseItemBlock) Impression() *Impression
Impression place object
func (*ResponseItemBlock) ImpressionID ¶
func (i *ResponseItemBlock) ImpressionID() string
ImpressionID code
func (*ResponseItemBlock) InternalAuctionCPMBid ¶
func (i *ResponseItemBlock) InternalAuctionCPMBid() (bid billing.Money)
InternalAuctionCPMBid value provides maximal possible price without any comission According to this value the system can choice the best item for the auction
func (*ResponseItemBlock) Price ¶
func (i *ResponseItemBlock) Price(action admodels.Action) (price billing.Money)
Price of whole response
func (*ResponseItemBlock) PriorityFormatType ¶
func (i *ResponseItemBlock) PriorityFormatType() types.FormatType
PriorityFormatType from current Ad
func (*ResponseItemBlock) Validate ¶
func (i *ResponseItemBlock) Validate() (err error)
Validate response
type ResponseItemEmpty ¶
type ResponseItemEmpty struct{}
ResponseItemEmpty value
func (*ResponseItemEmpty) ActionURL ¶
func (*ResponseItemEmpty) ActionURL() string
ActionURL returns target resource link for direct and banner click as well
func (*ResponseItemEmpty) Asset ¶
func (*ResponseItemEmpty) Asset(name string) *admodels.AdAsset
Asset by name
func (*ResponseItemEmpty) BidPrice ¶
func (*ResponseItemEmpty) BidPrice() billing.Money
BidPrice returns bid price for the external auction source. The current bid price will be adjusted according to the source correction factor and the commission share factor
func (*ResponseItemEmpty) CampaignID ¶
func (*ResponseItemEmpty) CampaignID() uint64
CampaignID number
func (*ResponseItemEmpty) ClickTrackerLinks ¶
func (*ResponseItemEmpty) ClickTrackerLinks() []string
ClickTrackerLinks returns traking links for click action
func (*ResponseItemEmpty) CommissionShareFactor ¶
func (*ResponseItemEmpty) CommissionShareFactor() float64
CommissionShareFactor returns the multipler for commission calculation which system get from user revenue from 0 to 1
func (*ResponseItemEmpty) ContentFields ¶
func (*ResponseItemEmpty) ContentFields() map[string]any
ContentFields from advertisement object
func (*ResponseItemEmpty) ContentItem ¶
func (*ResponseItemEmpty) ContentItem(name string) any
ContentItem returns the ad response data
func (*ResponseItemEmpty) ContentItemString ¶
func (*ResponseItemEmpty) ContentItemString(name string) string
ContentItemString from the ad
func (*ResponseItemEmpty) Context ¶
func (*ResponseItemEmpty) Context(ctx ...context.Context) context.Context
Context value
func (*ResponseItemEmpty) ExtImpressionID ¶
func (*ResponseItemEmpty) ExtImpressionID() string
ExtImpressionID it's unique code of the auction bid impression
func (*ResponseItemEmpty) ExtTargetID ¶
func (*ResponseItemEmpty) ExtTargetID() string
ExtTargetID of the external network
func (*ResponseItemEmpty) FinalPrice ¶
func (*ResponseItemEmpty) FinalPrice(action admodels.Action) billing.Money
FinalPrice returns final price for the item which is including all possible commissions with all corrections
func (*ResponseItemEmpty) ID ¶
func (*ResponseItemEmpty) ID() string
ID of current response item (unique code of current response)
func (*ResponseItemEmpty) Impression ¶
func (*ResponseItemEmpty) Impression() *Impression
Impression place object
func (*ResponseItemEmpty) ImpressionID ¶
func (*ResponseItemEmpty) ImpressionID() string
ImpressionID unique code string
func (*ResponseItemEmpty) ImpressionTrackerLinks ¶
func (*ResponseItemEmpty) ImpressionTrackerLinks() []string
ImpressionTrackerLinks returns traking links for impression action
func (*ResponseItemEmpty) InternalAuctionCPMBid ¶
func (*ResponseItemEmpty) InternalAuctionCPMBid() billing.Money
InternalAuctionCPMBid value provides maximal possible price without any comission According to this value the system can choice the best item for the auction
func (*ResponseItemEmpty) IsBackup ¶
func (*ResponseItemEmpty) IsBackup() bool
IsBackup indicates whether the advertisement is a backup ad type.
func (*ResponseItemEmpty) MainAsset ¶
func (*ResponseItemEmpty) MainAsset() *admodels.AdAsset
MainAsset from response
func (*ResponseItemEmpty) NetworkName ¶
func (*ResponseItemEmpty) NetworkName() string
NetworkName by source
func (*ResponseItemEmpty) PotentialPercent ¶
func (*ResponseItemEmpty) PotentialPercent() float64
PotentialPercent money
func (*ResponseItemEmpty) PotentialPrice ¶
func (*ResponseItemEmpty) PotentialPrice(action admodels.Action) billing.Money
PotentialPrice wich can be received from source but was marked as descrepancy
func (*ResponseItemEmpty) Price ¶
func (*ResponseItemEmpty) Price(action admodels.Action) billing.Money
Price per specific action type (view, click, lead, etc)
func (*ResponseItemEmpty) PriceTestMode ¶
func (*ResponseItemEmpty) PriceTestMode() bool
PriceTestMode returns true if the price is in test mode
func (*ResponseItemEmpty) PricingModel ¶
func (*ResponseItemEmpty) PricingModel() types.PricingModel
PricingModel of advertisement
func (*ResponseItemEmpty) PriorityFormatType ¶
func (*ResponseItemEmpty) PriorityFormatType() types.FormatType
PriorityFormatType from current Ad
func (*ResponseItemEmpty) PurchasePrice ¶
func (*ResponseItemEmpty) PurchasePrice(action admodels.Action) billing.Money
PurchasePrice gives the price of view from external resource. The cost of this request.
func (*ResponseItemEmpty) SetAuctionCPMBid ¶
func (*ResponseItemEmpty) SetAuctionCPMBid(price billing.Money, includeFactors ...PriceFactor) error
SetAuctionCPMBid value for external sources auction the system will pay
func (*ResponseItemEmpty) SetBidPrice ¶
func (*ResponseItemEmpty) SetBidPrice(price billing.Money) error
SetBidPrice value for external sources auction the system will pay
func (*ResponseItemEmpty) SourceCorrectionFactor ¶
func (it *ResponseItemEmpty) SourceCorrectionFactor() float64
SourceCorrectionFactor value for the source
func (*ResponseItemEmpty) TargetCorrectionFactor ¶
func (it *ResponseItemEmpty) TargetCorrectionFactor() float64
TargetCorrectionFactor value for the target
func (*ResponseItemEmpty) ViewTrackerLinks ¶
func (*ResponseItemEmpty) ViewTrackerLinks() []string
ViewTrackerLinks returns traking links for view action
type Responser ¶
type Responser interface { // AuctionID response AuctionID() string // AuctionType of request AuctionType() types.AuctionType // Source of response Source() Source // Request information Request() *BidRequest // Ads list Ads() []ResponserItemCommon // Item by impression code Item(impid string) ResponserItemCommon // Count of response items Count() int // Validate response Validate() error // Error of the response Error() error // Context value Context(ctx ...context.Context) context.Context // Get context item by key Get(key string) any // Release response and all linked objects Release() }
Responser type
type ResponserItem ¶
type ResponserItem interface { ResponserItemCommon // NetworkName returns the name of the ad network that provided the response. NetworkName() string // AdID returns the unique identifier of the advertisement. AdID() uint64 // AccountID returns the unique identifier of the advertiser's account. AccountID() uint64 // CampaignID returns the unique identifier of the advertising campaign. CampaignID() uint64 // Format returns the format information of the advertisement. Format() *types.Format // PricingModel returns the pricing model used for the advertisement (e.g., CPC, CPM). PricingModel() types.PricingModel // ContentItem retrieves the ad response data for a given content item name. // It returns the content in its original type. ContentItem(name string) any // ContentItemString retrieves the ad response data for a given content item name as a string. ContentItemString(name string) string // ContentFields returns a map of all content fields associated with the advertisement. ContentFields() map[string]any // MainAsset returns the primary asset of the advertisement (e.g., image, video). MainAsset() *admodels.AdAsset // Assets returns a list of all assets associated with the advertisement. Assets() admodels.AdAssets // Source returns the source information of the advertisement response. Source() Source // ImpressionTrackerLinks returns traking links for impression action ImpressionTrackerLinks() []string // ViewTrackerLinks returns a slice of tracking URLs for view actions. ViewTrackerLinks() []string // ClickTrackerLinks returns a slice of tracking URLs for click actions. ClickTrackerLinks() []string // IsDirect indicates whether the advertisement is a direct ad type. IsDirect() bool // IsBackup indicates whether the advertisement is a backup ad type. IsBackup() bool // ActionURL returns the target URL for direct and banner click actions. ActionURL() string // Width returns the width of the advertisement in pixels. Width() int // Height returns the height of the advertisement in pixels. Height() int // ECPM returns the Effective Cost Per Mille (thousand impressions) value of the advertisement. ECPM() billing.Money // PriceTestMode indicates whether the price is in test mode. PriceTestMode() bool // Price returns the total price for a specific action (e.g., click, lead, view). Price(action admodels.Action) billing.Money // BidPrice returns the bid price for the external auction source. // The bid price is adjusted according to the source correction factor and the commission share factor. BidPrice() billing.Money // SetBidPrice sets the bid price value for external sources in an auction. // The system will pay this bid price. SetBidPrice(price billing.Money) error // PurchasePrice returns the price of a specific action from an external resource (e.g., site, app, RTB). // This represents the cost of the request for the network. PurchasePrice(action admodels.Action) billing.Money // PotentialPrice returns the potential price that could be received from the source but was marked as a discrepancy. PotentialPrice(action admodels.Action) billing.Money // FinalPrice returns the final price for the advertisement item, including all possible commissions and corrections. // This is the price that will be charged to the advertiser. FinalPrice(action admodels.Action) billing.Money // Second returns a pointer to the SecondAd, representing secondary campaigns. Second() *SecondAd // It represents the portion of user revenue the system receives, ranging from 0 to 1. CommissionShareFactor() float64 // SourceCorrectionFactor returns the correction factor applied to the source. SourceCorrectionFactor() float64 // TargetCorrectionFactor returns the correction factor applied to the target. TargetCorrectionFactor() float64 }
ResponserItem defines the interface for a single advertisement response item. It extends ResponserItemCommon by adding methods specific to individual ads.
type ResponserItemCommon ¶
type ResponserItemCommon interface { // ID returns the unique identifier of the current response item. ID() string // Impression returns the Impression object associated with this response item. Impression() *Impression // ImpressionID returns the unique identifier string of the Impression. ImpressionID() string // ExtImpressionID returns the external unique identifier of the auction bid impression. ExtImpressionID() string // ExtTargetID returns the external target identifier from the external network. ExtTargetID() string // InternalAuctionCPMBid provides the maximum possible CPM (Cost Per Mille) bid without any commission. // This value is used by the system to select the best item for the auction. InternalAuctionCPMBid() billing.Money // PriorityFormatType returns the format type that has priority in the current ad. PriorityFormatType() types.FormatType // Validate checks the validity of the response item. // It returns an error if the item is invalid. Validate() error // Context returns the contextual information associated with the response item. // It can accept additional contexts to merge with the existing one. Context(ctx ...context.Context) context.Context // Get retrieves a value from the response item's extension map by the provided key. // It returns nil if the key does not exist. Get(key string) any }
ResponserItemCommon defines the common interface for response items in an ad auction. It includes methods to access identification, pricing, validation, and contextual data.
type ResponserMultipleItem ¶
type ResponserMultipleItem interface { ResponserItemCommon // Ads returns a slice of ResponserItem interfaces representing individual ads within the response. Ads() []ResponserItem // Count returns the total number of response items (ads) in the response. Count() int }
ResponserMultipleItem defines the interface for handling multiple advertisement response items. It is typically used for complex banners that contain multiple ads.
type SecondAd ¶
type SecondAd struct { ID string `json:"id,omitempty"` Network string `json:"network,omitempty"` SourceID uint64 `json:"source_id,omitempty"` CampaignID uint64 `json:"campaign_id,omitempty"` Price billing.Money `json:"price,omitempty"` }
SecondAd description
type Source ¶
type Source interface { SourceMinimal // ID of the source driver ID() uint64 // ObjectKey of the source driver ObjectKey() uint64 // Protocol of the source driver Protocol() string // Test request before processing Test(request *BidRequest) bool // PriceCorrectionReduceFactor which is a potential // Returns percent from 0 to 1 for reducing of the value // If there is 10% of price correction, it means that 10% of the final price must be ignored PriceCorrectionReduceFactor() float64 // RequestStrategy description RequestStrategy() RequestStrategy }
Source of advertisement and where will be selled the traffic
func ToSource ¶
func ToSource(val SourceMinimal) Source
ToSource interface from different types of interfaces with the implementation of unsupported methods
type SourceAccessor ¶
type SourceAccessor interface { // Iterator returns the configured queue accessor Iterator(request *BidRequest) SourceIterator // SourceByID returns source instance SourceByID(id uint64) (Source, error) // SetTimeout for sourcer SetTimeout(timeout time.Duration) }
SourceAccessor preoritise the source access
type SourceEmpty ¶
type SourceEmpty struct {
PriceCorrectionReduce float64 // from 0 to 1
}
SourceEmpty abstraction
func (*SourceEmpty) Bid ¶
func (*SourceEmpty) Bid(request *BidRequest) Responser
Bid request for standart system filter
func (*SourceEmpty) ObjectKey ¶
func (*SourceEmpty) ObjectKey() uint64
ObjectKey of the source driver
func (*SourceEmpty) PriceCorrectionReduceFactor ¶
func (s *SourceEmpty) PriceCorrectionReduceFactor() float64
PriceCorrectionReduceFactor which is a potential Returns percent from 0 to 1 for reducing of the value If there is 10% of price correction, it means that 10% of the final price must be ignored
func (*SourceEmpty) ProcessResponseItem ¶
func (*SourceEmpty) ProcessResponseItem(Responser, ResponserItem)
ProcessResponseItem result or error
func (*SourceEmpty) RequestStrategy ¶
func (*SourceEmpty) RequestStrategy() RequestStrategy
RequestStrategy description
func (*SourceEmpty) Test ¶
func (*SourceEmpty) Test(request *BidRequest) bool
Test request before processing
type SourceIterator ¶
type SourceIterator interface { // Next returns source interface according to strategy Next() Source }
SourceIterator returns next source from the scope
type SourceMinimal ¶
type SourceMinimal interface { // Bid request for standart system filter Bid(request *BidRequest) Responser // ProcessResponseItem result or error ProcessResponseItem(Responser, ResponserItem) }
SourceMinimal contains only minimal set of methods
type SourceTesteChecker ¶
type SourceTesteChecker interface { // Test current request for compatibility Test(request *BidRequest) bool }
SourceTesteChecker checker
type SourceTester ¶
type SourceTester interface { Source SourceTesteChecker }
SourceTester interface
type SourceTimeoutSetter ¶
SourceTimeoutSetter interface
type URLGenerator ¶
type URLGenerator interface { // CDNURL returns full URL to path CDNURL(path string) string // LibURL returns full URL to lib file path LibURL(path string) string // PixelURL generator from response of item // @param js generates the JavaScript pixel type PixelURL(event events.Type, status uint8, item ResponserItem, response Responser, js bool) (string, error) // PixelDirectURL generator from response of item PixelDirectURL(event events.Type, status uint8, item ResponserItem, response Responser, direct string) (string, error) // PixelLead URL PixelLead(item ResponserItem, response Responser, js bool) (string, error) // MustClickURL generator from response of item MustClickURL(item ResponserItem, response Responser) string // ClickURL generator from response of item ClickURL(item ResponserItem, response Responser) (string, error) // ClickRouterURL returns router pattern ClickRouterURL() string // DirectURL generator from response of item DirectURL(event events.Type, item ResponserItem, response Responser) (string, error) // DirectRouterURL returns router pattern DirectRouterURL() string // WinURL generator from response of item WinURL(event events.Type, status uint8, item ResponserItem, response Responser) (string, error) // BillingNoticeURL generator from response of item BillingNoticeURL(event events.Type, status uint8, item ResponserItem, response Responser) (string, error) // WinRouterURL returns router pattern WinRouterURL() string }
URLGenerator of advertisement
type User ¶
type User struct { ID string `json:"id,omitempty"` // Unique User ID Email string `json:"email,omitempty"` // In some cases it's able the use email, and we are gonna use it Username string `json:"username,omitempty"` // User profile name from the external service or potentional username SessionID string `json:"sessid,omitempty"` // Unique session ID FingerPrintID string `json:"fpid,omitempty"` // ETag string `json:"etag,omitempty"` // Birthday string `json:"birthday,omitempty"` // * Prefer do not use such personal information in alghoritm AgeStart int `json:"age_start,omitempty"` // Year of birth from AgeEnd int `json:"age_end,omitempty"` // Year of birth from Gender string `json:"gender,omitempty"` // Gender ("M": male, "F" female, "O" Other) Keywords string `json:"keywords,omitempty"` // Comma separated list of keywords, interests, or intent Geo *udetect.Geo `json:"geo,omitempty"` Data []Data `json:"data,omitempty"` // contains filtered or unexported fields }
User information
func (*User) BirthdayTime ¶
BirthdayTime parsed by Birthday string
func (*User) GetDataItem ¶
GetDataItem simple value by key
func (*User) GetDataItemOrDefault ¶
GetDataItemOrDefault item
func (*User) SetDataItem ¶
SetDataItem with simple *key*, *value*
Source Files ¶
- access_point.go
- base_filter.go
- bidrequest.go
- bidrequest_imp.go
- bidrequest_user.go
- errors.go
- pools.go
- prepare_url.go
- price.go
- request_strategy.go
- response.go
- response_empty.go
- response_item_blank.go
- response_item_block.go
- response_item_empty.go
- responser.go
- responser_item.go
- second_ad.go
- source.go
- source_empty.go
- source_iterator.go
- source_wrapper.go
- url_generator.go
- win_event.go