analytics

package
v0.0.0-...-bfbcaf2 Latest Latest
Warning

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

Go to latest
Published: Apr 25, 2024 License: MIT Imports: 11 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AnalyticsService

type AnalyticsService struct {
	Posthog  posthog.Client
	Mixpanel mixpanel.Mixpanel
}

func NewAnalyticsService

func NewAnalyticsService() *AnalyticsService

func (*AnalyticsService) AutoBannedByAbuseProtector

func (a *AnalyticsService) AutoBannedByAbuseProtector(
	userID string,
	email string,
	activeProductID string,
	ip string,
	reasons []string,
) error

func (*AnalyticsService) AutoBannedForBannedPromptEmbeddingViolation

func (a *AnalyticsService) AutoBannedForBannedPromptEmbeddingViolation(
	user *ent.User,
	cogReq requests.BaseCogRequest,
	source enttypes.SourceType,
	translatedPrompt string,
	similarToBannedPromptId string,
	similarityScore float64,
	violationCount int,
	ip string,
) error

func (*AnalyticsService) AutoBannedForSpecialBannedPromptEmbedding

func (a *AnalyticsService) AutoBannedForSpecialBannedPromptEmbedding(
	user *ent.User,
	cogReq requests.BaseCogRequest,
	source enttypes.SourceType,
	translatedPrompt string,
	similarToBannedPromptId string,
	similarityScore float64,
	violationCount int,
	ip string,
) error

func (*AnalyticsService) Close

func (a *AnalyticsService) Close()

func (*AnalyticsService) CreditPurchase

func (a *AnalyticsService) CreditPurchase(user *ent.User, productId string, amount int) error

Credit purchase

func (*AnalyticsService) Dispatch

func (a *AnalyticsService) Dispatch(e Event) error

Dispatch to all available analytics services

func (*AnalyticsService) FreeCreditsReplenished

func (a *AnalyticsService) FreeCreditsReplenished(userId uuid.UUID, email string, amount int) error

Free credits replenished

func (*AnalyticsService) GenerationFailed

func (a *AnalyticsService) GenerationFailed(user *ent.User, cogReq requests.BaseCogRequest, duration float64, failureReason string, source enttypes.SourceType, ip string) error

Generation | Failed

func (*AnalyticsService) GenerationFailedNSFW

func (a *AnalyticsService) GenerationFailedNSFW(user *ent.User, cogReq requests.BaseCogRequest, duration float64, source enttypes.SourceType, ip string) error

Generation | Failed-NSFW

func (*AnalyticsService) GenerationFailedNSFWPrompt

func (a *AnalyticsService) GenerationFailedNSFWPrompt(
	user *ent.User,
	cogReq requests.BaseCogRequest,
	failureSource string,
	source enttypes.SourceType,
	translatedPrompt string,
	similarToBannedPromptId string,
	similarityScore float64,
	moderationAPIReason string,
	moderationAPIScore float32,
	ip string,
) error

func (*AnalyticsService) GenerationStarted

func (a *AnalyticsService) GenerationStarted(user *ent.User, cogReq requests.BaseCogRequest, source enttypes.SourceType, ip string) error

Generation | Started

func (*AnalyticsService) GenerationSucceeded

func (a *AnalyticsService) GenerationSucceeded(user *ent.User, cogReq requests.BaseCogRequest, duration float64, qDuration float64, source enttypes.SourceType, ip string) error

Generation | Succeeded

func (*AnalyticsService) SignUp

func (a *AnalyticsService) SignUp(userId uuid.UUID, email, ipAddress string, deviceInfo utils.ClientDeviceInfo) error

Sign Up

func (*AnalyticsService) Subscription

func (a *AnalyticsService) Subscription(user *ent.User, productId string) error

New Subscription

func (*AnalyticsService) SubscriptionCancelled

func (a *AnalyticsService) SubscriptionCancelled(user *ent.User, productId string) error

Cancelled Subscription

func (*AnalyticsService) SubscriptionRenewal

func (a *AnalyticsService) SubscriptionRenewal(user *ent.User, productId string) error

Renewed Subscription

func (*AnalyticsService) SubscriptionUpgraded

func (a *AnalyticsService) SubscriptionUpgraded(user *ent.User, oldProductId string, productId string) error

Upgraded subscription

func (*AnalyticsService) UpscaleFailed

func (a *AnalyticsService) UpscaleFailed(user *ent.User, cogReq requests.BaseCogRequest, duration float64, failureReason string, source enttypes.SourceType, ip string) error

Upscale | Failed

func (*AnalyticsService) UpscaleStarted

func (a *AnalyticsService) UpscaleStarted(user *ent.User, cogReq requests.BaseCogRequest, source enttypes.SourceType, ip string) error

Upscale | Started

func (*AnalyticsService) UpscaleSucceeded

func (a *AnalyticsService) UpscaleSucceeded(user *ent.User, cogReq requests.BaseCogRequest, duration float64, qDuration float64, source enttypes.SourceType, ip string) error

Upscale | Succeeded

func (*AnalyticsService) VoiceoverFailed

func (a *AnalyticsService) VoiceoverFailed(user *ent.User, cogReq requests.BaseCogRequest, duration float64, failureReason string, source enttypes.SourceType, ip string) error

Voiceover | Failed

func (*AnalyticsService) VoiceoverStarted

func (a *AnalyticsService) VoiceoverStarted(user *ent.User, cogReq requests.BaseCogRequest, source enttypes.SourceType, ip string) error

Voiceover | Started

func (*AnalyticsService) VoiceoverSucceeded

func (a *AnalyticsService) VoiceoverSucceeded(user *ent.User, cogReq requests.BaseCogRequest, duration float64, qDuration float64, source enttypes.SourceType, ip string) error

Voiceover | Succeeded

type Event

type Event struct {
	DistinctId string
	EventName  string
	Properties map[string]interface{}
	Identify   bool
}

func (*Event) MixpanelEvent

func (e *Event) MixpanelEvent() (distinctId, eventName string, event *mixpanel.Event, identify *mixpanel.Update)

func (*Event) PosthogEvent

func (e *Event) PosthogEvent() (posthog.Capture, *posthog.Identify)

Jump to

Keyboard shortcuts

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