clicktoken

package
v1.1.0 Latest Latest
Warning

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

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

Documentation

Overview

Package clicktoken is the click token: an opaque, signed token the click redirect adds to links to a publisher's own sites (stores, as `rc`; and the domains phase 6's conversion API lists, as `rc_click`), so an order or a conversion arriving later can be credited to the email that brought the click. It names the message (so the contact and the campaign or the automation step) and when the click happened; it carries nothing in clear and can't be forged (internal/linktoken's HMAC).

Index

Constants

View Source
const ConversionParam = "rc_click"

ConversionParam carries it on links to the conversion API's domains (phase 6).

View Source
const Kind linktoken.Kind = 200

Kind is the token's linktoken kind (X20's range, 200–209).

View Source
const Param = "rc"

Param is the query parameter that carries the token on links to a store (phase 7).

Variables

View Source
var ErrInvalid = errors.New("clicktoken: invalid token")

ErrInvalid is a token that wasn't signed by this instance.

Functions

func Sign

func Sign(s *linktoken.Signer, c Click) string

Sign returns the token for a click.

func Slug

func Slug(name string) string

Slug turns a campaign's or an automation's name into a utm_campaign value ("October Product Update" → "october-product-update").

func Tag

func Tag(link string, utm UTM, token string) string

Tag adds the UTM parameters (where the link doesn't set them already: the author's choice wins) and the click token to a link.

Types

type Click

type Click struct {
	WorkspaceID uuid.UUID
	MessageID   uuid.UUID
	ContactID   uuid.UUID
	// At is the click's time, to the minute.
	At time.Time
}

Click is what a token says.

func Verify

func Verify(s *linktoken.Signer, token string) (Click, error)

Verify reads a token.

type UTM

type UTM struct {
	Source, Medium, Campaign string
}

UTM are the parameters a tagged link gets.

Jump to

Keyboard shortcuts

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