Help us shape the future of Go! Take the 2026 Go Developer Survey

visitors

package
v0.3.3 Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2026 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Overview

Package visitors resolves the anonymous visitors of a customer site to Contacts: it tells which Contact a tracked visitor id is, once an identify call has linked them.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Collect

func Collect(ctx context.Context, bus *events.Bus, s *ent.Scoped, evts []CollectEventInput) error

Collect refuses the whole batch with an *events.RejectionError when an event claims a reserved action: delivery, consent and Contact lifecycle facts are the system's alone.

func Identify

func Identify(ctx context.Context, bus *events.Bus, s *ent.Scoped, input IdentifyInput) error

Identify binds a Visitor to a Contact and asserts that Contact's alias keys (subject_id / email / phone). It upserts the Contact by any present alias key, auto-creates typed Custom fields from the traits, binds the device, and stitches the device's earlier anonymous Events onto the Contact so pre-identify behavior becomes visible to segmentation. A newly created Contact emits contact.created.

Types

type CollectEventInput

type CollectEventInput struct {
	VisitorID  string
	Action     string
	Properties map[string]any
	OccurredAt *time.Time
	// ClientEventID is the client's own id for the event ("" = none). A repeat of an id
	// in a Workspace is a no-op, so a client can retry a batch it never saw answered.
	ClientEventID string
}

type IdentifyInput

type IdentifyInput struct {
	VisitorID string
	Email     *string
	Phone     *string
	SubjectID *string
	Traits    map[string]any
}

Jump to

Keyboard shortcuts

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