events

package
v0.0.0-...-a08dd98 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2024 License: Apache-2.0 Imports: 14 Imported by: 4

Documentation

Index

Constants

View Source
const (
	StatusUndefined   = 0
	StatusSuccess     = 1
	StatusFailed      = 2
	StatusCompromised = 3
	StatusCustom      = 4 // User code
)

Event status

View Source
const LZ4BlockMaxSize = 64 << 10

LZ4BlockMaxSize constant

Variables

View Source
var ErrEmptyData = errors.New(`data is empty`)

ErrEmptyData error

Functions

This section is empty.

Types

type AdInfo

type AdInfo struct {
	Time     int64  `thrift:",1" json:"tm,omitempty"`   // Timestamp
	Type     string `thrift:",2" json:"type,omitempty"` // Type of message info
	Duration uint64 `thrift:",3" json:"d,omitempty"`    // Duration in Nanoseconds
	Service  string `thrift:",4" json:"srv,omitempty"`  // Service sender
	Cluster  string `thrift:",5" json:"cl,omitempty"`   // Cluster code (eu, us, as)
	Param1   int    `thrift:",6" json:"p1,omitempty"`   // Reserved
	Param2   int    `thrift:",7" json:"p2,omitempty"`   // Reserved
	// Accounts link information
	Project           uint64 `thrift:",8"  json:"pr,omitempty"`  // Project network ID
	PublisherCompany  uint64 `thrift:",9"  json:"pcb,omitempty"` // -- // --
	AdvertiserCompany uint64 `thrift:",10" json:"acv,omitempty"` // -- // --
	// Source
	AuctionID    string `thrift:",11" json:"auc,omitempty"`     // Internal Auction ID
	AuctionType  uint8  `thrift:",12" json:"auctype,omitempty"` // Aution type 1 - First price, 2 - Second price
	ImpID        string `thrift:",13" json:"imp,omitempty"`     // Sub ID of request for paticular impression spot
	ImpAdID      string `thrift:",14" json:"impad,omitempty"`   // Specific ID for paticular ad impression
	ExtAuctionID string `thrift:",15" json:"eauc,omitempty"`    // RTB Request/Response ID
	ExtImpID     string `thrift:",16" json:"eimp,omitempty"`    // RTB Imp ID
	ExtTargetID  string `thrift:",17" json:"extz,omitempty"`    // RTB Zone ID (tagid)
	Source       uint64 `thrift:",18" json:"src,omitempty"`     // Advertisement Source ID
	Network      string `thrift:",19" json:"net,omitempty"`     // Source Network Name or Domain (Cross sails)
	AccessPoint  uint64 `thrift:",20" json:"acp,omitempty"`     // Access Point ID to own Advertisement
}

AdInfo represents some additional information which aggregated during advertisement and ad-request processing

type Code

type Code struct {
	// contains filtered or unexported fields
}

Code structure can contains and conver data for URL

func CodeObj

func CodeObj(data []byte, err error) Code

CodeObj by values

func ObjectCode

func ObjectCode(obj any, gen ...types.EncodeGenerator) Code

ObjectCode converts object to code object with defined encoder/decoder

func (Code) Compress

func (c Code) Compress() Code

Compress code.data

func (Code) Data

func (c Code) Data() []byte

Data value

func (Code) DecodeObject

func (c Code) DecodeObject(target any, gen ...types.DecodeGenerator) error

DecodeObject converts current object data to target

func (Code) Decompress

func (c Code) Decompress() Code

Decompress current code.data

func (Code) Error

func (c Code) Error() string

func (Code) ErrorObj

func (c Code) ErrorObj() error

ErrorObj response

func (*Code) ResetData

func (c *Code) ResetData()

ResetData object

func (Code) String

func (c Code) String() string

func (Code) URLDecode

func (c Code) URLDecode() Code

URLDecode value

func (Code) URLEncode

func (c Code) URLEncode() Code

URLEncode data for URL using

func (*Code) Write

func (c *Code) Write(p []byte) (n int, err error)

Write method is implementation of io.Writer any

type Event

type Event struct {
	Time     int64  `thrift:",1" json:"tm,omitempty"`  // Timestamp
	Delay    uint64 `thrift:",2" json:"dl,omitempty"`  // Delay of preparation of Ads in Nanosecinds
	Duration uint64 `thrift:",3" json:"d,omitempty"`   // Duration in Nanoseconds
	Service  string `thrift:",4" json:"srv,omitempty"` // Service sender
	Cluster  string `thrift:",5" json:"cl,omitempty"`  // Cluster code (eu, us, as)
	Event    Type   `thrift:",6" json:"e,omitempty"`   // Event code string
	Status   uint8  `thrift:",7" json:"st,omitempty"`  // Status: 0 - undefined, 1 - success, 2 - failed, 3 - compromised

	// Accounts link information
	ProjectID           uint64 `thrift:",8"  json:"pr,omitempty"`  // Project network ID
	PublisherAccountID  uint64 `thrift:",9"  json:"pcb,omitempty"` // -- // --
	AdvertiserAccountID uint64 `thrift:",10" json:"acv,omitempty"` // -- // --

	// Source
	AuctionID     string `thrift:",11" json:"auc,omitempty"`     // Internal Auction ID
	AuctionType   uint8  `thrift:",12" json:"auctype,omitempty"` // Aution type 1 - First price, 2 - Second price
	ImpID         string `thrift:",13" json:"imp,omitempty"`     // Sub ID of request for paticular impression spot
	ImpAdID       string `thrift:",14" json:"impad,omitempty"`   // Specific ID for paticular ad impression
	ExtAuctionID  string `thrift:",15" json:"eauc,omitempty"`    // RTB Request/Response ID
	ExtImpID      string `thrift:",16" json:"eimp,omitempty"`    // RTB Imp ID
	ExtTargetID   string `thrift:",17" json:"extz,omitempty"`    // RTB Zone ID (tagid)
	SourceID      uint64 `thrift:",18" json:"sid,omitempty"`     // Advertisement Source ID
	Network       string `thrift:",19" json:"net,omitempty"`     // Source Network Name or Domain (Cross sails)
	AccessPointID uint64 `thrift:",20" json:"acp,omitempty"`     // Access Point ID to own Advertisement

	// State Location
	Platform      int    `thrift:",21" json:"pl,omitempty"`  // Where displaid? 0 – undefined, 1 – web site, 2 – native app, 3 – game
	Domain        string `thrift:",22" json:"dm,omitempty"`  // If not web site then "bundle"
	ApplicationID uint64 `thrift:",23" json:"app,omitempty"` // application ID (registered in the system)
	ZoneID        uint64 `thrift:",24" json:"z,omitempty"`   // -- // --
	PixelID       uint64 `thrift:",25" json:"pxl,omitempty"` // -- // --
	CampaignID    uint64 `thrift:",26" json:"cmp,omitempty"` // Campaign info
	FormatID      uint64 `thrift:",27" json:"fmt,omitempty"` // Format ID
	AdID          uint64 `thrift:",28" json:"ad,omitempty"`  // -- // --
	AdWidth       int    `thrift:",29" json:"aw,omitempty"`  // -- // --
	AdHeight      int    `thrift:",30" json:"ah,omitempty"`  // -- // --
	SourceURL     string `thrift:",31" json:"su,omitempty"`  // Advertisement source URL (iframe, image, video, direct)
	WinURL        string `thrift:",32" json:"wu,omitempty"`  // Win URL used for RTB confirmation
	URL           string `thrift:",33" json:"u,omitempty"`   // Non modified target URL
	JumperID      uint64 `thrift:",34" json:"j,omitempty"`   // Jumper Page ID

	// Money section
	// We have a different situations how we are pay for the traffic
	// For example
	// 	1) If we have external traffic resource:
	//		ViewPrice = 0.01 CPV - Have to pay advertiser
	//		LeadPrice = 40$ - How much will we pay for the lead
	//		PurchaseViewPrice = 0.001 CPV - how much we will pay for this traffic
	//	2) If external second price auction type
	//		ViewPrice = 0.02 CPV - Have to pay advertiser
	//		PurchaseViewPrice = 0.01 CPV - how much we will pay for this traffic
	//  3) If we are buying the traffic for CPA
	//		LeadPrice = 20$ - Have to pay advertiser
	//		PurchaseViewPrice = 10$ - Have to pay to the source
	PricingModel  uint    `thrift:",36" json:"pm,omitempty"`   // Display As CPM/CPC/CPA/CPI
	TestPriceMode bool    `thrift:",37" json:"tpm,omitempty"`  // Test price mode
	ECPM          float64 `thrift:",38" json:"ecpm,omitempty"` // Effective Cost per Mille
	// Prurchase price from SSP or other TRAFFIC sources (menetisation of income requests)
	// We are buying the place of advertisement display
	PurchaseViewPrice    int64   `thrift:",39" json:"pvpr,omitempty"`   // Price of the view of source traffic cost
	PurchaseClickPrice   int64   `thrift:",40" json:"pcpr,omitempty"`   // Price of the click of source traffic cost
	PurchaseLeadPrice    int64   `thrift:",41" json:"plpr,omitempty"`   // Price of the lead of source traffic cost
	PotentialViewPrice   int64   `thrift:",42" json:"ptvpr,omitempty"`  // Price of the view of source of ads oitential
	PotentialClickPrice  int64   `thrift:",43" json:"ptcpr,omitempty"`  // Price of the click of source of ads oitential
	PotentialLeadPrice   int64   `thrift:",44" json:"ptlpr,omitempty"`  // Price of the lead of source of ads oitential
	ViewPrice            int64   `thrift:",45" json:"vpr,omitempty"`    // Price per view
	ClickPrice           int64   `thrift:",46" json:"cpr,omitempty"`    // Price per click
	LeadPrice            int64   `thrift:",47" json:"lpr,omitempty"`    // Price per lead
	CompetitorCampaignID uint64  `thrift:",48" json:"cmid,omitempty"`   // Competitor compaign ID
	CompetitorSourceID   uint64  `thrift:",49" json:"cmsrc,omitempty"`  // Competitor source ID
	CompetitorECPM       float64 `thrift:",50" json:"cmecpm,omitempty"` // Competitor ECPM or auction

	// User IDENTITY
	UDID        string `thrift:",51" json:"udi,omitempty"` // Unique Device ID (IDFA)
	UUID        string `thrift:",52" json:"uui,omitempty"` // User
	SessionID   string `thrift:",53" json:"ses,omitempty"` // -- // --
	Fingerprint string `thrift:",54" json:"fpr,omitempty"` // -- // --
	ETag        string `thrift:",55" json:"etg,omitempty"` // -- // --

	// Targeting
	CarrierID       uint   `thrift:",56" json:"car,omitempty"`  // -- // --
	Country         string `thrift:",57" json:"cc,omitempty"`   // Country Code ISO-2
	City            string `thrift:",58" json:"ct,omitempty"`   // City Code
	Latitude        string `thrift:",59" json:"lt,omitempty"`   // -- // --
	Longitude       string `thrift:",60" json:"lg,omitempty"`   // -- // --
	Language        string `thrift:",61" json:"lng,omitempty"`  // en-US
	IPString        string `thrift:",62" json:"ip,omitempty"`   // -- // --
	Referer         string `thrift:",63" json:"ref,omitempty"`  // Referal link
	Page            string `thrift:",64" json:"page,omitempty"` // Page link
	UserAgent       string `thrift:",65" json:"ua,omitempty"`   // -- // --
	DeviceType      uint   `thrift:",66" json:"dvt,omitempty"`  // Device type 0 - Undefined, 1 - Desktop, etc.
	DeviceID        uint   `thrift:",67" json:"dv,omitempty"`   // Device ID
	OSID            uint   `thrift:",68" json:"os,omitempty"`   // OS ID
	BrowserID       uint   `thrift:",69" json:"br,omitempty"`   // Browser ID
	Categories      string `thrift:",70" json:"c,omitempty"`    // -- // --
	Adblock         uint   `thrift:",71" json:"ab,omitempty"`   // Ext params
	PrivateBrowsing uint   `thrift:",72" json:"prv,omitempty"`  // Private Mode
	Robot           uint   `thrift:",73" json:"rt,omitempty"`   // Robot traffic
	Proxy           uint   `thrift:",74" json:"pt,omitempty"`   // Proxy traffic
	Backup          uint   `thrift:",75" json:"bt,omitempty"`   // Backup Display Type
	X               int    `thrift:",76" json:"x,omitempty"`    // X - coord of addisplay or click position
	Y               int    `thrift:",77" json:"y,omitempty"`    // Y - coord of addisplay or click position
	Width           int    `thrift:",78" json:"w,omitempty"`    // Width - available space
	Height          int    `thrift:",79" json:"h,omitempty"`    // Height - available space

	SubID1 string `thrift:",80" json:"sd1,omitempty"`
	SubID2 string `thrift:",81" json:"sd2,omitempty"`
	SubID3 string `thrift:",82" json:"sd3,omitempty"`
	SubID4 string `thrift:",83" json:"sd4,omitempty"`
	SubID5 string `thrift:",84" json:"sd5,omitempty"`
}

Event struct

func (*Event) DateTime

func (e *Event) DateTime() time.Time

DateTime object

func (*Event) DecodeCodeOld

func (e *Event) DecodeCodeOld(data string) error

DecodeCodeOld URL object

func (*Event) EncodeCodeOld

func (e *Event) EncodeCodeOld() (string, error)

EncodeCodeOld URL object

func (*Event) Normalize

func (e *Event) Normalize() *Event

Normalize some params

func (*Event) Pack

func (e *Event) Pack() Code

Pack object to event Code

func (*Event) PreparedURL

func (e *Event) PreparedURL(https bool, args ...string) string

PreparedURL string

func (*Event) SetDateTime

func (e *Event) SetDateTime(tmNano int64)

SetDateTime timestamp

func (*Event) String

func (e *Event) String() string

String imprlementation of Stringer interface

func (*Event) TimeFormat

func (e *Event) TimeFormat(format string) string

TimeFormat to string

func (*Event) Unpack

func (e *Event) Unpack(data []byte, unpuckFnc ...func(code Code) Code) error

Unpack event object

func (*Event) UpdateDateTime

func (e *Event) UpdateDateTime()

UpdateDateTime of event

func (*Event) Validate

func (e *Event) Validate() error

Validate event object

type LeadCode

type LeadCode struct {
	AuctionID         string `thrift:",1" json:"id"`  // Internal Auction ID
	ImpAdID           string `thrift:",2" json:"iid"` // Specific ID for paticular AD impression
	SourceID          uint64 `thrift:",3" json:"sid,omitempty"`
	ProjectID         uint64 `thrift:",4" json:"pid,omitempty"`
	PublisherCompany  uint64 `thrift:",5" json:"pub,omitempty"`
	AdvertiserCompany uint64 `thrift:",6" json:"adv,omitempty"`
	CampaignID        uint64 `thrift:",7" json:"cid,omitempty"`
	AdID              uint64 `thrift:",8" json:"aid,omitempty"`
	Price             int64  `thrift:",9" json:"p,omitempty"`
	Timestamp         int64  `thrift:",10" json:"ts"` // In seconds
}

LeadCode object

func (*LeadCode) Pack

func (lc *LeadCode) Pack() Code

Pack structure to bytes

func (LeadCode) Sign

func (lc LeadCode) Sign() (sign []byte)

Sign of object (length 10bytes)

func (LeadCode) String

func (lc LeadCode) String() string

String implementation of fmt.Stringer interface

func (*LeadCode) Unpack

func (lc *LeadCode) Unpack(code []byte) (err error)

Unpack data

type Type

type Type string

Type of event

const (
	Undefined  Type = ""
	Request    Type = "request"
	Impression Type = "impression"
	View       Type = "view"
	Direct     Type = "direct"
	Click      Type = "click"
	Lead       Type = "lead"
	// Source types
	SourceNoBid Type = "src.nobid"
	SourceBid   Type = "src.bid"
	SourceWin   Type = "src.win"
	SourceFail  Type = "src.fail"
	SourceSkip  Type = "src.skip"
	// Access Point types
	AccessPointNoBid         Type = "ap.nobid"
	AccessPointBid           Type = "ap.bid"
	AccessPointWin           Type = "ap.win"
	AccessPointBillingNotice Type = "ap.bin"
	AccessPointFail          Type = "ap.fail"
	AccessPointSkip          Type = "ap.skip"
)

Event types

func (Type) String

func (t Type) String() string

type UserInfo

type UserInfo struct {
	Time      int64  `json:"tm,omitempty"`  // Timestamp
	AuctionID string `json:"auc,omitempty"` // Internal Auction ID

	// User IDENTITY
	UDID      string `json:"udi,omitempty"` // Unique Device ID (IDFA)
	UUID      string `json:"uui,omitempty"` // User
	SessionID string `json:"ses,omitempty"` // -- // --

	// Personal information
	Age           byte   `age:"age,omitempty"`
	Gender        byte   `json:"gender,omitempty"`
	SearchGender  byte   `json:"search_gender,omitempty"`
	Email         string `json:"email,omitempty"`
	Phone         string `json:"phone,omitempty"`
	MessangerType string `json:"messanger_type,omitempty"`
	Messanger     string `json:"messanger,omitempty"`
	Postcode      string `json:"zip,omitempty"`
	Facebook      string `json:"facebook,omitempty"`
	Twitter       string `json:"twitter,omitempty"`
	Linkedin      string `json:"linkedin,omitempty"`

	// Location info
	Country   string `json:"cc,omitempty"`  // Country Code ISO-2
	City      string `json:"ct,omitempty"`  // City Code
	Latitude  string `json:"lt,omitempty"`  // -- // --
	Longitude string `json:"lg,omitempty"`  // -- // --
	Language  string `json:"lng,omitempty"` // en-US
}

UserInfo collects the general information about users

func (*UserInfo) String

func (info *UserInfo) String() string

String imprlementation of Stringer interface

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL