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 ¶
const ConversionParam = "rc_click"
ConversionParam carries it on links to the conversion API's domains (phase 6).
const Kind linktoken.Kind = 201
Kind is the token's linktoken kind (X20's range, 200–209).
const Param = "rc"
Param is the query parameter that carries the token on links to a store (phase 7).
Variables ¶
var ErrInvalid = errors.New("clicktoken: invalid token")
ErrInvalid is a token that wasn't signed by this instance.
Functions ¶
func AddUTM ¶
AddUTM adds to a link the UTM parameters it doesn't set (the author's choice wins), in the order utm_source, utm_medium, utm_campaign, after its query and before its fragment. Unlike Tag it never re-encodes or reorders what the link already has, so a tagged link still reads as written. Links that aren't Taggable come back unchanged.
func Slug ¶
Slug turns a campaign's or an automation's name into a utm_campaign value ("October Product Update" → "october-product-update"). Letters lose their marks ("Bản tin tháng 10" → "ban-tin-thang-10"); letters outside ASCII once their marks are gone (中, ж) are dropped.
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.
type UTM ¶
type UTM struct {
Source string `json:"source"`
Medium string `json:"medium"`
Campaign string `json:"campaign"`
}
UTM are the parameters a tagged link gets.