model

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: May 17, 2021 License: Apache-2.0 Imports: 4 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIClientRequest

type APIClientRequest struct {
	VisitorID   string                 `json:"visitor_id"`
	AnonymousID *string                `json:"anonymous_id"`
	Context     map[string]interface{} `json:"context"`
	TriggerHit  bool                   `json:"trigger_hit"`
}

APIClientRequest represents the API client informations

type APIClientResponse

type APIClientResponse struct {
	VisitorID string     `json:"visitorId"`
	Panic     bool       `json:"panic"`
	Campaigns []Campaign `json:"campaigns"`
}

APIClientResponse represents a decision response

type APIOptions

type APIOptions struct {
	APIUrl  string
	APIKey  string
	Timeout time.Duration
	Retries int
}

APIOptions represents the options for the Decision API Client

type ActivationHit

type ActivationHit struct {
	VisitorID        string    `json:"vid"`
	AnonymousID      *string   `json:"aid,omitempty"`
	EnvironmentID    string    `json:"cid"`
	VariationGroupID string    `json:"caid"`
	VariationID      string    `json:"vaid"`
	CreatedAt        time.Time `json:"-"`
	QueueTime        int64     `json:"-"`
}

ActivationHit represents an item hit for the datacollect

func (*ActivationHit) ComputeQueueTime

func (b *ActivationHit) ComputeQueueTime()

ComputeQueueTime computes hit queue time

func (*ActivationHit) SetBaseInfos

func (b *ActivationHit) SetBaseInfos(envID string, visitorID string)

SetBaseInfos sets the mandatory information for the hit

func (*ActivationHit) Validate

func (b *ActivationHit) Validate() []error

Validate checks that the hit is well formed

type BaseHit

type BaseHit struct {
	VisitorID               string    `json:"vid,omitempty"`
	EnvironmentID           string    `json:"cid,omitempty"`
	Type                    HitType   `json:"t,omitempty"`
	DataSource              string    `json:"ds,omitempty"`
	ProtocolVersion         string    `json:"v,omitempty"`
	UserIP                  string    `json:"uip,omitempty"`
	DocumentReferrer        string    `json:"dr,omitempty"`
	ViewportSize            string    `json:"vp,omitempty"`
	ScreenResolution        string    `json:"sr,omitempty"`
	PageTitle               string    `json:"pt,omitempty"`
	DocumentEncoding        string    `json:"de,omitempty"`
	ScreenColorDepth        string    `json:"sd,omitempty"`
	UserLanguage            string    `json:"ul,omitempty"`
	JavaEnabled             *bool     `json:"je,omitempty"`
	FlashVersion            string    `json:"fl,omitempty"`
	QueueTime               int64     `json:"qt,omitempty"`
	DocumentLocation        string    `json:"dl,omitempty"`
	CurrentSessionTimestamp int64     `json:"cst,omitempty"`
	SessionNumber           int64     `json:"sn,omitempty"`
	CreatedAt               time.Time `json:"-"`
}

BaseHit represents the API client informations

func (*BaseHit) ComputeQueueTime

func (b *BaseHit) ComputeQueueTime()

ComputeQueueTime computes hit queue time

func (*BaseHit) SetBaseInfos

func (b *BaseHit) SetBaseInfos(envID string, visitorID string)

SetBaseInfos sets the mandatory information for the hit

type BatchHit

type BatchHit struct {
	BaseHit
	Hits []HitInterface `json:"h"`
}

BatchHit represents a batch of hits for the datacollect

func (*BatchHit) AddHit

func (b *BatchHit) AddHit(hit HitInterface)

AddHit adds a hit to the batch

func (*BatchHit) SetBaseInfos

func (b *BatchHit) SetBaseInfos(envID string, visitorID string)

SetBaseInfos sets the mandatory information for the hit

func (*BatchHit) Validate

func (b *BatchHit) Validate() []error

Validate checks that the hit is well formed

type Campaign

type Campaign struct {
	ID               string          `json:"id"`
	CustomID         string          `json:"-"`
	VariationGroupID string          `json:"variationGroupId"`
	Variation        ClientVariation `json:"variation"`
}

Campaign represents a decision campaign

type ClientVariation

type ClientVariation struct {
	ID            string       `json:"id"`
	Modifications Modification `json:"modifications"`
	Reference     bool         `json:"reference"`
}

ClientVariation represents a decision campaign variation

type Context

type Context map[string]interface{}

Context represents a visitor context object

func (Context) Validate

func (c Context) Validate() []error

Validate checks that the visitor context object is valid

type Event

type Event struct {
	VisitorID string    `json:"visitorId"`
	Type      EventType `json:"type"`
	Data      Context   `json:"data"`
	CreatedAt time.Time `json:"-"`
	QueueTime int64     `json:"-"`
}

Event represents a context event hit for Flagship

func (*Event) ComputeQueueTime

func (b *Event) ComputeQueueTime()

ComputeQueueTime computes hit queue time

func (*Event) SetBaseInfos

func (b *Event) SetBaseInfos(envID string, visitorID string)

SetBaseInfos sets the mandatory information for the hit

func (*Event) Validate

func (b *Event) Validate() []error

Validate checks that the hit is well formed

type EventHit

type EventHit struct {
	BaseHit
	Action   string `json:"ea"`
	Category string `json:"ec,omitempty"`
	Label    string `json:"el,omitempty"`
	Value    int64  `json:"ev,omitempty"`
}

EventHit represents an event hit for the datacollect

func (*EventHit) SetBaseInfos

func (b *EventHit) SetBaseInfos(envID string, visitorID string)

SetBaseInfos sets the mandatory information for the hit

func (*EventHit) Validate

func (b *EventHit) Validate() []error

Validate checks that the hit is well formed

type EventType

type EventType string

EventType express the type of the event

const (
	CONTEXT EventType = "CONTEXT"
)

The different event types

type FlagInfos

type FlagInfos struct {
	Value    interface{}
	Campaign Campaign
}

FlagInfos represents a decision campaign variation modification

type HitInterface

type HitInterface interface {
	Validate() []error
	SetBaseInfos(envID string, visitorID string)
	ComputeQueueTime()
}

HitInterface express the interface for the hits

type HitType

type HitType string

HitType express the type of the event

const (
	ACTIVATION  HitType = "ACTIVATION"
	CAMPAIGN    HitType = "CAMPAIGN"
	SCREEN      HitType = "SCREENVIEW"
	PAGE        HitType = "PAGEVIEW"
	EVENT       HitType = "EVENT"
	ITEM        HitType = "ITEM"
	TRANSACTION HitType = "TRANSACTION"
	BATCH       HitType = "BATCH"
)

The different event types

type ItemHit

type ItemHit struct {
	BaseHit
	TransactionID string  `json:"tid"`
	Name          string  `json:"in"`
	Price         float64 `json:"ip,omitempty"`
	Quantity      int     `json:"iq,omitempty"`
	Code          string  `json:"ic,omitempty"`
	Category      string  `json:"iv,omitempty"`
}

ItemHit represents an item hit for the datacollect

func (*ItemHit) SetBaseInfos

func (b *ItemHit) SetBaseInfos(envID string, visitorID string)

SetBaseInfos sets the mandatory information for the hit

func (*ItemHit) Validate

func (b *ItemHit) Validate() []error

Validate checks that the hit is well formed

type Modification

type Modification struct {
	Type  string                 `json:"type"`
	Value map[string]interface{} `json:"value"`
}

Modification represents a decision campaign variation modification

type PageHit

type PageHit struct {
	BaseHit
}

PageHit represents a pageview hit for the datacollect

func (*PageHit) SetBaseInfos

func (b *PageHit) SetBaseInfos(envID string, visitorID string)

SetBaseInfos sets the mandatory information for the hit

func (*PageHit) Validate

func (b *PageHit) Validate() []error

Validate checks that the hit is well formed

type ScreenHit added in v2.0.6

type ScreenHit struct {
	BaseHit
}

ScreenHit represents a screenview hit for the datacollect

func (*ScreenHit) SetBaseInfos added in v2.0.6

func (b *ScreenHit) SetBaseInfos(envID string, visitorID string)

SetBaseInfos sets the mandatory information for the hit

func (*ScreenHit) Validate added in v2.0.6

func (b *ScreenHit) Validate() []error

Validate checks that the hit is well formed

type TransactionHit

type TransactionHit struct {
	BaseHit
	TransactionID  string  `json:"tid"`
	Affiliation    string  `json:"ta"`
	Revenue        float64 `json:"tr,omitempty"`
	Shipping       float64 `json:"ts,omitempty"`
	Tax            float64 `json:"tt,omitempty"`
	Currency       string  `json:"tc,omitempty"`
	CouponCode     string  `json:"tcc,omitempty"`
	PaymentMethod  string  `json:"pm,omitempty"`
	ShippingMethod string  `json:"sm,omitempty"`
	ItemCount      int     `json:"icn,omitempty"`
}

TransactionHit represents a transaction hit for the datacollect

func (*TransactionHit) SetBaseInfos

func (b *TransactionHit) SetBaseInfos(envID string, visitorID string)

SetBaseInfos sets the mandatory information for the hit

func (*TransactionHit) Validate

func (b *TransactionHit) Validate() []error

Validate checks that the hit is well formed

Jump to

Keyboard shortcuts

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