Pure HTML transform: open-pixel injection + click link rewriting (TRACK-03).
Called by Mailglass.Tracking.rewrite_if_enabled/1 AFTER Mailglass.Renderer.render/1.
Operates on the CSS-inlined HTML string; returns a rewritten HTML string.
Plaintext body is NEVER modified (D-36 — plaintext readers often go
through text-only proxies; leaving original URLs serves user trust).
Skip list (D-36)
mailto:,tel:,sms:,data:,javascript:schemes#fragmenthrefs (same-page anchors)- scheme-less relative URLs (e.g.
/signup) <a data-mg-notrack>(attribute stripped from final HTML)- Any
<a>inside<head>(prefetch, canonical) - Any href equal to the List-Unsubscribe URL (v0.5 hook reserved)
Pixel injection (D-37)
Markup: <img src="..." width="1" height="1" alt="" style="display:block;width:1px;height:1px;border:0;" />
Position: LAST child of <body>. Missing <body> → appended at root.
alt="" prevents screen-reader announcement.
Summary
Functions
Rewrites an HTML string applying open-pixel injection and/or click link rewriting based on the provided flags.
Functions
Rewrites an HTML string applying open-pixel injection and/or click link rewriting based on the provided flags.
Options
:flags—%{opens: boolean, clicks: boolean}(required):delivery_id— delivery UUID for token encoding (required):tenant_id— tenant scope for token encoding (required):endpoint— Phoenix.Token endpoint or secret binary (optional, falls back to config)