github.com/prebid/prebid-server/v2@v2.18.0/analytics/core.go (about)

     1  package analytics
     2  
     3  import (
     4  	"time"
     5  
     6  	"github.com/prebid/openrtb/v20/openrtb2"
     7  	"github.com/prebid/prebid-server/v2/config"
     8  	"github.com/prebid/prebid-server/v2/hooks/hookexecution"
     9  	"github.com/prebid/prebid-server/v2/openrtb_ext"
    10  )
    11  
    12  // Module must be implemented by analytics modules to extract the required information and logging
    13  // activities. Do not use marshal the parameter objects directly as they can change over time. Use a separate
    14  // model for each analytics module and transform as appropriate.
    15  type Module interface {
    16  	LogAuctionObject(*AuctionObject)
    17  	LogVideoObject(*VideoObject)
    18  	LogCookieSyncObject(*CookieSyncObject)
    19  	LogSetUIDObject(*SetUIDObject)
    20  	LogAmpObject(*AmpObject)
    21  	LogNotificationEventObject(*NotificationEvent)
    22  }
    23  
    24  // Loggable object of a transaction at /openrtb2/auction endpoint
    25  type AuctionObject struct {
    26  	Status               int
    27  	Errors               []error
    28  	Response             *openrtb2.BidResponse
    29  	Account              *config.Account
    30  	StartTime            time.Time
    31  	HookExecutionOutcome []hookexecution.StageOutcome
    32  	SeatNonBid           []openrtb_ext.SeatNonBid
    33  	RequestWrapper       *openrtb_ext.RequestWrapper
    34  }
    35  
    36  // Loggable object of a transaction at /openrtb2/amp endpoint
    37  type AmpObject struct {
    38  	Status               int
    39  	Errors               []error
    40  	AuctionResponse      *openrtb2.BidResponse
    41  	AmpTargetingValues   map[string]string
    42  	Origin               string
    43  	StartTime            time.Time
    44  	HookExecutionOutcome []hookexecution.StageOutcome
    45  	SeatNonBid           []openrtb_ext.SeatNonBid
    46  	RequestWrapper       *openrtb_ext.RequestWrapper
    47  }
    48  
    49  // Loggable object of a transaction at /openrtb2/video endpoint
    50  type VideoObject struct {
    51  	Status         int
    52  	Errors         []error
    53  	Response       *openrtb2.BidResponse
    54  	VideoRequest   *openrtb_ext.BidRequestVideo
    55  	VideoResponse  *openrtb_ext.BidResponseVideo
    56  	StartTime      time.Time
    57  	SeatNonBid     []openrtb_ext.SeatNonBid
    58  	RequestWrapper *openrtb_ext.RequestWrapper
    59  }
    60  
    61  // Loggable object of a transaction at /setuid
    62  type SetUIDObject struct {
    63  	Status  int
    64  	Bidder  string
    65  	UID     string
    66  	Errors  []error
    67  	Success bool
    68  }
    69  
    70  // Loggable object of a transaction at /cookie_sync
    71  type CookieSyncObject struct {
    72  	Status       int
    73  	Errors       []error
    74  	BidderStatus []*CookieSyncBidder
    75  }
    76  
    77  type CookieSyncBidder struct {
    78  	BidderCode   string        `json:"bidder"`
    79  	NoCookie     bool          `json:"no_cookie,omitempty"`
    80  	UsersyncInfo *UsersyncInfo `json:"usersync,omitempty"`
    81  }
    82  
    83  type UsersyncInfo struct {
    84  	URL         string `json:"url,omitempty"`
    85  	Type        string `json:"type,omitempty"`
    86  	SupportCORS bool   `json:"supportCORS,omitempty"`
    87  }
    88  
    89  // NotificationEvent object of a transaction at /event
    90  type NotificationEvent struct {
    91  	Request *EventRequest   `json:"request"`
    92  	Account *config.Account `json:"account"`
    93  }