analytics

package
v1.61.0-rc Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: AGPL-3.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// Error is the default error class the analytics package.
	Error = errs.Class("analytics service")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	SegmentWriteKey string `help:"segment write key" default:""`
	Enabled         bool   `help:"enable analytics reporting" default:"false"`
	HubSpot         HubSpotConfig
}

Config is a configuration struct for analytics Service.

type HubSpotConfig added in v1.45.2

type HubSpotConfig struct {
	APIKey          string        `help:"hubspot api key" default:""`
	ChannelSize     int           `help:"the number of events that can be in the queue before dropping" default:"1000"`
	ConcurrentSends int           `help:"the number of concurrent api requests that can be made" default:"4"`
	DefaultTimeout  time.Duration `help:"the default timeout for the hubspot http client" default:"10s"`
}

HubSpotConfig is a configuration struct for Concurrent Sending of Events.

type HubSpotEvent added in v1.45.2

type HubSpotEvent struct {
	Data     map[string]interface{}
	Endpoint string
}

HubSpotEvent is a configuration struct for sending API request to HubSpot.

type HubSpotEvents added in v1.45.2

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

HubSpotEvents is a configuration struct for sending Events data to HubSpot.

func NewHubSpotEvents added in v1.45.2

func NewHubSpotEvents(log *zap.Logger, config HubSpotConfig, satelliteName string) *HubSpotEvents

NewHubSpotEvents for sending user events to HubSpot.

func (*HubSpotEvents) EnqueueCreateUser added in v1.45.2

func (q *HubSpotEvents) EnqueueCreateUser(fields TrackCreateUserFields)

EnqueueCreateUser for creating user in HubSpot.

func (*HubSpotEvents) EnqueueEvent added in v1.45.2

func (q *HubSpotEvents) EnqueueEvent(email, eventName string, properties map[string]interface{})

EnqueueEvent for sending user behavioral event to HubSpot.

func (*HubSpotEvents) Handle added in v1.45.2

func (q *HubSpotEvents) Handle(ctx context.Context, events []HubSpotEvent) (err error)

Handle for handle the HubSpot API requests.

func (*HubSpotEvents) Run added in v1.45.2

func (q *HubSpotEvents) Run(ctx context.Context) error

Run for concurrent API requests.

type Service

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

Service for sending analytics.

architecture: Service

func NewService

func NewService(log *zap.Logger, config Config, satelliteName string) *Service

NewService creates new service for creating sending analytics.

func (*Service) Close

func (service *Service) Close() error

Close closes the Segment client.

func (*Service) PageVisitEvent added in v1.58.1

func (service *Service) PageVisitEvent(pageName string, userID uuid.UUID, email string)

PageVisitEvent sends a page visit event associated with user ID to Segment. It is used for tracking occurrences of client-side events.

func (*Service) Run added in v1.45.2

func (service *Service) Run(ctx context.Context) error

Run runs the service and use the context in new requests.

func (*Service) TrackAccessGrantCreated added in v1.27.0

func (service *Service) TrackAccessGrantCreated(userID uuid.UUID, email string)

TrackAccessGrantCreated sends an "Access Grant Created" event to Segment.

func (*Service) TrackAccountVerified added in v1.27.2

func (service *Service) TrackAccountVerified(userID uuid.UUID, email string)

TrackAccountVerified sends an "Account Verified" event to Segment.

func (*Service) TrackCreateUser

func (service *Service) TrackCreateUser(fields TrackCreateUserFields)

TrackCreateUser sends an "Account Created" event to Segment.

func (*Service) TrackCreditCardAdded added in v1.55.1

func (service *Service) TrackCreditCardAdded(userID uuid.UUID, email string)

TrackCreditCardAdded sends an "Credit Card Added" event to Segment.

func (*Service) TrackEvent added in v1.27.0

func (service *Service) TrackEvent(eventName string, userID uuid.UUID, email string)

TrackEvent sends an arbitrary event associated with user ID to Segment. It is used for tracking occurrences of client-side events.

func (*Service) TrackLinkEvent added in v1.27.2

func (service *Service) TrackLinkEvent(eventName string, userID uuid.UUID, email, link string)

TrackLinkEvent sends an arbitrary event and link associated with user ID to Segment. It is used for tracking occurrences of client-side events.

func (*Service) TrackProjectCreated added in v1.27.0

func (service *Service) TrackProjectCreated(userID uuid.UUID, email string, projectID uuid.UUID, currentProjectCount int)

TrackProjectCreated sends an "Project Created" event to Segment.

func (*Service) TrackProjectLimitError added in v1.58.1

func (service *Service) TrackProjectLimitError(userID uuid.UUID, email string)

TrackProjectLimitError sends an "Project Limit Error" event to Segment.

func (*Service) TrackSignedIn added in v1.27.0

func (service *Service) TrackSignedIn(userID uuid.UUID, email string)

TrackSignedIn sends an "Signed In" event to Segment.

type TrackCreateUserFields

type TrackCreateUserFields struct {
	ID               uuid.UUID
	AnonymousID      string
	FullName         string
	Email            string
	Type             UserType
	EmployeeCount    string
	CompanyName      string
	JobTitle         string
	HaveSalesContact bool
	OriginHeader     string
	Referrer         string
	HubspotUTK       string
	UserAgent        string
}

TrackCreateUserFields contains input data for tracking a create user event.

type UserType

type UserType string

UserType is a type for distinguishing personal vs. professional users.

const (
	// Professional defines a "professional" user type.
	Professional UserType = "Professional"
	// Personal defines a "personal" user type.
	Personal UserType = "Personal"
)

Jump to

Keyboard shortcuts

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