Documentation ¶
Index ¶
- Constants
- Variables
- type Config
- type FreezeTracker
- type HubSpotConfig
- type HubSpotEvent
- type HubSpotEvents
- func (q *HubSpotEvents) EnqueueCreateUserMinimal(fields TrackCreateUserFields)
- func (q *HubSpotEvents) EnqueueUserChangeEmail(oldEmail, newEmail string)
- func (q *HubSpotEvents) EnqueueUserOnboardingInfo(fields TrackOnboardingInfoFields)
- func (q *HubSpotEvents) Handle(ctx context.Context, events []HubSpotEvent) (err error)
- func (q *HubSpotEvents) Run(ctx context.Context) error
- type LimitRequestInfo
- type PageViewBody
- type PlausibleConfig
- type PlausibleService
- type Service
- func (service *Service) ChangeContactEmail(userID uuid.UUID, oldEmail, newEmail string)
- func (service *Service) Close() error
- func (service *Service) CreateContact(fields TrackCreateUserFields)
- func (service *Service) PageViewEvent(ctx context.Context, pv PageViewBody) error
- func (service *Service) PageVisitEvent(pageName string, userID uuid.UUID, email string)
- func (service *Service) Run(ctx context.Context) error
- func (service *Service) TrackAccessGrantCreated(userID uuid.UUID, email string)
- func (service *Service) TrackAccountFreezeWarning(userID uuid.UUID, email string)
- func (service *Service) TrackAccountFrozen(userID uuid.UUID, email string)
- func (service *Service) TrackAccountUnfrozen(userID uuid.UUID, email string)
- func (service *Service) TrackAccountUnwarned(userID uuid.UUID, email string)
- func (service *Service) TrackAccountVerified(userID uuid.UUID, email string)
- func (service *Service) TrackCreateUser(fields TrackCreateUserFields)
- func (service *Service) TrackCreditCardAdded(userID uuid.UUID, email string)
- func (service *Service) TrackErrorEvent(userID uuid.UUID, email, source string)
- func (service *Service) TrackEvent(eventName string, userID uuid.UUID, email string, ...)
- func (service *Service) TrackExpiredCreditNeedsRemoval(userID uuid.UUID, customerID, packagePlan string)
- func (service *Service) TrackExpiredCreditRemoved(userID uuid.UUID, customerID, packagePlan string)
- func (service *Service) TrackInviteLinkClicked(inviter, invitee string)
- func (service *Service) TrackInviteLinkSignup(inviter, invitee string)
- func (service *Service) TrackLargeUnpaidInvoice(invID string, userID uuid.UUID, email string)
- func (service *Service) TrackLegalHoldUnpaidInvoice(invID string, userID uuid.UUID, email string)
- func (service *Service) TrackLinkEvent(eventName string, userID uuid.UUID, email, link string)
- func (service *Service) TrackProjectCreated(userID uuid.UUID, email string, projectID uuid.UUID, currentProjectCount int)
- func (service *Service) TrackProjectLimitError(userID uuid.UUID, email string)
- func (service *Service) TrackProjectMemberAddition(userID uuid.UUID, email string)
- func (service *Service) TrackProjectMemberDeletion(userID uuid.UUID, email string)
- func (service *Service) TrackRequestLimitIncrease(userID uuid.UUID, email string, info LimitRequestInfo)
- func (service *Service) TrackSignedIn(userID uuid.UUID, email string)
- func (service *Service) TrackStorjTokenAdded(userID uuid.UUID, email string)
- func (service *Service) TrackStorjscanUnpaidInvoice(invID string, userID uuid.UUID, email string)
- func (service *Service) TrackUserOnboardingInfo(fields TrackOnboardingInfoFields)
- func (service *Service) TrackUserUpgraded(userID uuid.UUID, email string, expiration *time.Time)
- func (service *Service) TrackViolationFrozenUnpaidInvoice(invID string, userID uuid.UUID, email string)
- type TokenData
- type TrackCreateUserFields
- type TrackOnboardingInfoFields
- type UserType
Constants ¶
const ( // SourceTrialExpiringNotice is the trial expiring notice source. SourceTrialExpiringNotice = "trial_expiring_notice" // SourceTrialExpiredNotice is the trial expired notice source. SourceTrialExpiredNotice = "trial_expired_notice" )
Variables ¶
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 Plausible PlausibleConfig }
Config is a configuration struct for analytics Service.
type FreezeTracker ¶ added in v1.78.1
type FreezeTracker interface { // TrackAccountFrozen sends an account frozen event to Segment. TrackAccountFrozen(userID uuid.UUID, email string) // TrackAccountUnfrozen sends an account unfrozen event to Segment. TrackAccountUnfrozen(userID uuid.UUID, email string) // TrackAccountUnwarned sends an account unwarned event to Segment. TrackAccountUnwarned(userID uuid.UUID, email string) // TrackAccountFreezeWarning sends an account freeze warning event to Segment. TrackAccountFreezeWarning(userID uuid.UUID, email string) // TrackLargeUnpaidInvoice sends an event to Segment indicating that a user has not paid a large invoice. TrackLargeUnpaidInvoice(invID string, userID uuid.UUID, email string) // TrackViolationFrozenUnpaidInvoice sends an event to Segment indicating that a user has not paid an invoice // and has been frozen due to violating ToS. TrackViolationFrozenUnpaidInvoice(invID string, userID uuid.UUID, email string) // TrackStorjscanUnpaidInvoice sends an event to Segment indicating that a user has not paid an invoice, but has storjscan transaction history. TrackStorjscanUnpaidInvoice(invID string, userID uuid.UUID, email string) }
FreezeTracker is an interface for account freeze event tracking methods.
type HubSpotConfig ¶ added in v1.45.2
type HubSpotConfig struct { RefreshToken string `help:"hubspot refresh token" default:""` TokenAPI string `help:"hubspot token refresh API" default:"https://api.hubapi.com/oauth/v1/token"` ClientID string `help:"hubspot client ID" default:""` ClientSecret string `help:"hubspot client secret" 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"` EventPrefix string `help:"the prefix for the event name" default:""` SignupFormId string `help:"the hubspot form ID for signup" default:""` LifeCycleStage string `help:"the hubspot lifecycle stage for new accounts" default:""` }
HubSpotConfig is a configuration struct for Concurrent Sending of Events.
type HubSpotEvent ¶ added in v1.45.2
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) EnqueueCreateUserMinimal ¶ added in v1.96.2
func (q *HubSpotEvents) EnqueueCreateUserMinimal(fields TrackCreateUserFields)
EnqueueCreateUserMinimal is for creating user in HubSpot using the minimal form.
func (*HubSpotEvents) EnqueueUserChangeEmail ¶ added in v1.107.1
func (q *HubSpotEvents) EnqueueUserChangeEmail(oldEmail, newEmail string)
EnqueueUserChangeEmail is for sending post-creation information to Hubspot, that the user changed their email.
func (*HubSpotEvents) EnqueueUserOnboardingInfo ¶ added in v1.96.2
func (q *HubSpotEvents) EnqueueUserOnboardingInfo(fields TrackOnboardingInfoFields)
EnqueueUserOnboardingInfo is for sending post-creation information to Hubspot, that the user enters after login during onboarding.
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.
type LimitRequestInfo ¶ added in v1.88.2
type LimitRequestInfo struct { ProjectName string LimitType string CurrentLimit string DesiredLimit string }
LimitRequestInfo holds data needed to request limit increase.
type PageViewBody ¶ added in v1.103.2
type PageViewBody struct { Name string `json:"name"` Url string `json:"url"` Props map[string]string `json:"props"` Domain string `json:"domain"` Referrer string `json:"referrer"` IP string `json:"-"` UserAgent string `json:"-"` }
PageViewBody is a struct for page view event.
type PlausibleConfig ¶ added in v1.100.2
type PlausibleConfig struct { Domain string `help:"the domain set up on plausible for the satellite" default:""` ApiUrl string `help:"the url of the plausible API" releaseDefault:"https://plausible.io/api/event" devDefault:""` DefaultTimeout time.Duration `help:"the default timeout for the plausible http client" default:"10s"` }
PlausibleConfig is a configuration struct for plausible analytics.
type PlausibleService ¶ added in v1.103.2
type PlausibleService struct {
// contains filtered or unexported fields
}
PlausibleService is a configuration struct for sending data to Plausible.
func NewPlausibleService ¶ added in v1.103.2
func NewPlausibleService(log *zap.Logger, config PlausibleConfig) *PlausibleService
NewPlausibleService for sending events to Plausible.
func (*PlausibleService) PageViewEvent ¶ added in v1.103.2
func (pS *PlausibleService) PageViewEvent(ctx context.Context, pv PageViewBody) error
PageViewEvent sends a page view event to plausible.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service for sending analytics.
architecture: Service
func NewService ¶
NewService creates new service for creating sending analytics.
func (*Service) ChangeContactEmail ¶ added in v1.107.1
ChangeContactEmail changes contact's email address.
func (*Service) CreateContact ¶ added in v1.105.2
func (service *Service) CreateContact(fields TrackCreateUserFields)
CreateContact creates a contact in hubspot for a user.
func (*Service) PageViewEvent ¶ added in v1.103.2
func (service *Service) PageViewEvent(ctx context.Context, pv PageViewBody) error
PageViewEvent sends a page view event to plausible.
func (*Service) PageVisitEvent ¶ added in v1.58.1
PageVisitEvent sends a page visit event associated with user ID to Segment. It is used for tracking occurrences of client-side events.
func (*Service) TrackAccessGrantCreated ¶ added in v1.27.0
TrackAccessGrantCreated sends an "Access Grant Created" event to Segment.
func (*Service) TrackAccountFreezeWarning ¶ added in v1.74.1
TrackAccountFreezeWarning sends an account freeze warning event to Segment.
func (*Service) TrackAccountFrozen ¶ added in v1.74.1
TrackAccountFrozen sends an account frozen event to Segment.
func (*Service) TrackAccountUnfrozen ¶ added in v1.75.2
TrackAccountUnfrozen sends an account unfrozen event to Segment.
func (*Service) TrackAccountUnwarned ¶ added in v1.76.1
TrackAccountUnwarned sends an account unwarned event to Segment.
func (*Service) TrackAccountVerified ¶ added in v1.27.2
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
TrackCreditCardAdded sends an "Credit Card Added" event to Segment.
func (*Service) TrackErrorEvent ¶ added in v1.70.1
TrackErrorEvent sends an arbitrary error event associated with user ID to Segment. It is used for tracking occurrences of client-side errors.
func (*Service) TrackEvent ¶ added in v1.27.0
func (service *Service) TrackEvent(eventName string, userID uuid.UUID, email string, customProps map[string]string)
TrackEvent sends an arbitrary event associated with user ID to Segment. It is used for tracking occurrences of client-side events.
func (*Service) TrackExpiredCreditNeedsRemoval ¶ added in v1.80.3
func (service *Service) TrackExpiredCreditNeedsRemoval(userID uuid.UUID, customerID, packagePlan string)
TrackExpiredCreditNeedsRemoval sends an "Expired Credit Needs Removal" event to Segment.
func (*Service) TrackExpiredCreditRemoved ¶ added in v1.80.3
TrackExpiredCreditRemoved sends an "Expired Credit Removed" event to Segment.
func (*Service) TrackInviteLinkClicked ¶ added in v1.89.2
TrackInviteLinkClicked sends an "Invite Link Clicked" event to Segment.
func (*Service) TrackInviteLinkSignup ¶ added in v1.89.2
TrackInviteLinkSignup sends an "Invite Link Signup" event to Segment.
func (*Service) TrackLargeUnpaidInvoice ¶ added in v1.74.1
TrackLargeUnpaidInvoice sends an event to Segment indicating that a user has not paid a large invoice.
func (*Service) TrackLegalHoldUnpaidInvoice ¶ added in v1.93.1
TrackLegalHoldUnpaidInvoice sends an event to Segment indicating that a user has not paid an invoice but is in legal hold.
func (*Service) TrackLinkEvent ¶ added in v1.27.2
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
TrackProjectLimitError sends an "Project Limit Error" event to Segment.
func (*Service) TrackProjectMemberAddition ¶ added in v1.69.1
TrackProjectMemberAddition sends an "Project Member Added" event to Segment.
func (*Service) TrackProjectMemberDeletion ¶ added in v1.69.1
TrackProjectMemberDeletion sends an "Project Member Deleted" event to Segment.
func (*Service) TrackRequestLimitIncrease ¶ added in v1.88.2
func (service *Service) TrackRequestLimitIncrease(userID uuid.UUID, email string, info LimitRequestInfo)
TrackRequestLimitIncrease sends a limit increase request to Segment.
func (*Service) TrackSignedIn ¶ added in v1.27.0
TrackSignedIn sends an "Signed In" event to Segment.
func (*Service) TrackStorjTokenAdded ¶ added in v1.62.1
TrackStorjTokenAdded sends an "Storj Token Added" event to Segment.
func (*Service) TrackStorjscanUnpaidInvoice ¶ added in v1.83.2
TrackStorjscanUnpaidInvoice sends an event to Segment indicating that a user has not paid an invoice, but has storjscan transaction history.
func (*Service) TrackUserOnboardingInfo ¶ added in v1.96.2
func (service *Service) TrackUserOnboardingInfo(fields TrackOnboardingInfoFields)
TrackUserOnboardingInfo sends onboarding info to Hubspot.
func (*Service) TrackUserUpgraded ¶ added in v1.101.1
TrackUserUpgraded sends a "User Upgraded" event to Segment.
type TrackCreateUserFields ¶
type TrackCreateUserFields struct { ID uuid.UUID AnonymousID string FullName string Email string Type UserType EmployeeCount string CompanyName string StorageNeeds string JobTitle string HaveSalesContact bool OriginHeader string Referrer string HubspotUTK string UserAgent string SignupCaptcha *float64 }
TrackCreateUserFields contains input data for tracking a create user event.
type TrackOnboardingInfoFields ¶ added in v1.96.2
type TrackOnboardingInfoFields struct { ID uuid.UUID FullName string Email string Type UserType EmployeeCount string CompanyName string StorageNeeds string JobTitle string StorageUseCase string OtherUseCase string FunctionalArea string HaveSalesContact bool InterestedInPartnering bool }
TrackOnboardingInfoFields contains input data entered after first login.