productanalytics

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Oct 27, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	OrganizationGroup = "organization"
)

Variables

This section is empty.

Functions

func Capture

func Capture(event Event)

func CloseCurrent

func CloseCurrent() error

func Enabled

func Enabled() bool

func IdentifyOrganizationGroup

func IdentifyOrganizationGroup(identity OrganizationGroupIdentity)

func StableEventID

func StableEventID(name EventName, parts ...string) uuid.UUID

func SyntheticDistinctID

func SyntheticDistinctID(organizationID string, actorType ActorType, identity string) string

func WithSource

func WithSource(ctx context.Context, source Source) context.Context

Types

type ActorType

type ActorType string
const (
	ActorUser     ActorType = "user"
	ActorSystem   ActorType = "system"
	ActorExternal ActorType = "external"
)

type Client

type Client interface {
	Capture(Event)
	IdentifyOrganizationGroup(OrganizationGroupIdentity)
	Close() error
	Enabled() bool
}

func Current

func Current() Client

func New

func New(projectKey string) (Client, error)

func SetCurrent

func SetCurrent(next Client) Client

type Event

type Event struct {
	Name           EventName
	EventID        uuid.UUID
	DistinctID     string
	OrganizationID string
	FactoryID      string
	TaskID         string
	ActorType      ActorType
	Source         Source
	Properties     Properties
}

type EventName

type EventName string
const (
	EventOrganizationCreated        EventName = "organization_created"
	EventFactoryOnboardingCompleted EventName = "factory_onboarding_completed"
	EventFactoryTaskCreated         EventName = "factory_task_created"
	EventFactoryTaskRefined         EventName = "factory_task_refined"
	EventFactoryTaskStarted         EventName = "factory_task_started"
	EventFactoryTaskApproved        EventName = "factory_task_approved"
	EventFactoryTaskRejected        EventName = "factory_task_rejected"
	EventFactoryTaskArchived        EventName = "factory_task_archived"
	EventFactoryTaskMerged          EventName = "factory_task_merged"
)

type OrganizationGroupIdentity

type OrganizationGroupIdentity struct {
	ID        string
	Name      string
	Slug      string
	CreatedAt *time.Time
	AccountID string
}

type Properties

type Properties map[string]any

type Source

type Source string
const (
	SourceUI            Source = "ui"
	SourceAPI           Source = "api"
	SourceCLI           Source = "cli"
	SourceMCP           Source = "mcp"
	SourceAutomation    Source = "automation"
	SourceGitHubWebhook Source = "github_webhook"
)

func SourceFromContext

func SourceFromContext(ctx context.Context, fallback Source) Source

Jump to

Keyboard shortcuts

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