linkrule

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: AGPL-3.0 Imports: 5 Imported by: 0

Documentation

Overview

Package linkrule is the one rule for which of an email's links are tracked (review AN-5). The sending engine numbers and redirects the links it picks; the report's click map draws its bubbles on the links Mark picks with the same rule and numbers the same way, so a bubble is always on the link its clicks came from.

Index

Constants

View Source
const Attr = "data-rc-link"

Attr is the attribute Mark adds to each tracked link: its position.

Variables

This section is empty.

Functions

func Label

func Label(inner string) string

Label is a link's text: its inner HTML without tags, on one line, at most 120 characters.

func Mark

func Mark(src string) string

Mark adds Attr with its position to each tracked link of src, numbered as the engine numbers the links of the same email: the links that blocks rendering per reader add (a referral block's) are counted where the block is, though the block stays as written.

func Rows

func Rows(src string) [][]int

Rows finds the tracked links of src that sit on one line with nothing but separators between them (a navigation bar: "Blog · Docs · Changelog"), as runs of at least two positions, numbered as Rewrite and Mark number them. The click map shows such a row as one entry.

func Trackable

func Trackable(href string) bool

Trackable says whether a link goes through the click redirect. Anchors, mailto:, tel:, sms:, javascript: and data: links, the unsubscribe, preference and view-online links, poll and survey answers, Earn's personal links and the Recommendations block's buttons aren't tracked; absolute web links (possibly personalized) are.

Types

type Link struct {
	Position int
	URL      string
	Label    string
}

Link is a tracked link: its position among the email's tracked links, its address as written (it may be personalized with Liquid) and its text.

func Rewrite

func Rewrite(src string, to func(Link) string) (string, []Link)

Rewrite replaces the address of each tracked link of src with what to returns for it (the engine's per-recipient variable), numbering the links from 0 in document order, and returns the links. src is the email as the engine numbers it: blocks already expanded (liquid.ExpandBlocks).

Jump to

Keyboard shortcuts

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