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

linkclicks

package
v0.3.5 Latest Latest
Warning

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

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

Documentation

Overview

Package linkclicks counts the clicks of the emails of one Broadcast or Automation, or of the whole Workspace, by link. It is a leaf the per-owner reports and the Clicks by link report share: the count reads the `email.clicked` Events, machine clicks left out (ADR 0053), and takes a scoped client like every Workspace read.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Total

func Total(links []Clicks) int

Total is the clicks over all the links.

Types

type Between

type Between struct {
	Since, Until time.Time
}

Between is the half-open span [Since, Until) the clicks happened in; the zero value is all the retained history. An Event happened at its `occurred_at`, falling back to its creation time (ADR 0044).

type Clicks

type Clicks struct {
	URL    string `json:"url"`
	Clicks int    `json:"clicks"`
}

Clicks is how often one link was clicked.

func ByLink(ctx context.Context, s *ent.Scoped, in Between, owner func(*sql.Selector)) ([]Clicks, error)

ByLink counts the `email.clicked` Events that owner narrows to (the Events that carry one Broadcast or Automation) within the span, by link, most clicked first. Every click is an Event, so these are repeat counts that cover the Event retention window.

type OwnerClicks

type OwnerClicks struct {
	URL    string
	Kind   OwnerKind
	ID     int64
	Clicks int
}

OwnerClicks is how often one link was clicked in the emails of one Broadcast or Automation.

func ByOwner

func ByOwner(ctx context.Context, s *ent.Scoped, in Between) ([]OwnerClicks, error)

ByOwner counts the human `email.clicked` Events of the whole Workspace within the span, by link and by the Broadcast or Automation that carried it, most clicked first. A click that carries neither (a Transactional send) belongs to no report and is left out.

type OwnerKind

type OwnerKind string

OwnerKind is what carried a clicked link.

const (
	OwnerBroadcast  OwnerKind = "broadcast"
	OwnerAutomation OwnerKind = "automation"
)

Jump to

Keyboard shortcuts

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