Skip to content

Email links and unsubscribe

Emails sent by amabledata (broadcasts, automations and other sends from the email module) contain three kinds of public links that are handled by the edge worker:

Link URL What it does
Click redirect https://<tracking host>/r/<token> Records the click and sends the reader to the real destination
Open pixel https://<tracking host>/o/<token> An invisible 1×1 image that records the open
Unsubscribe https://<tracking host>/unsub/<token> A page to stop marketing emails, plus the one-click endpoint mail apps use

The tracking host is the workspace’s verified tracking domain from Settings › Domains (see Domains), for example https://links.example.com. Without one, the edge worker’s default address is used. A branded tracking domain makes links look trustworthy and improves deliverability.

How you write emails and configure sending is covered in Email templates, Email sending settings and Suppressions.

Every link carries a signed token that ties it to one workspace, one message and one contact.

  • Tokens never expire: an unsubscribe link in an old email must keep working.
  • Tokens cannot be forged or edited: a changed token is rejected.
  • The click token contains the destination URL itself, so the redirect can only lead where the email pointed. It can never be abused as an open redirect.

When an email is sent, every http and https link in its HTML is rewritten to a /r/<token> link. Links that already point to the tracking host (such as the unsubscribe link) are left as they are.

When the reader clicks:

  1. The edge worker verifies the token and redirects (HTTP 302) to the original destination.
  2. A parameter _amb_c is added to the destination URL. It is a signed contact identity: if the destination site runs the amabledata tracker, the first pageview sends it to amabledata, which links the browser to the contact, and the tracker removes it from the address bar. It is accepted for 90 days after the click.
  3. The click is recorded on the message: click count, first click time and which link was clicked. The email.link_clicked event fires (marked as unique on the first click).
  4. If no open was recorded yet, the click also records the open (email.opened), because a click proves the email was opened even when images were blocked.

If the token is invalid (cut, altered, or not leading to an http or https address), the reader sees a small page titled Link unavailable with the text This link is not valid or has expired. and a 404 status. Like the unsubscribe page, it is in English or Italian depending on the reader’s browser language (Link non disponibile / Questo link non è valido o è scaduto.), uses no scripts, is never cached and is marked noindex.

A 1×1 transparent GIF pointing to /o/<token> is added at the end of the HTML body. When the reader’s mail app loads images, the open is recorded (open count, first open time) and the email.opened event fires (unique on the first open). The image is always returned, never cached, and recording happens in the background so it never slows the email down.

Opens are an estimate: mail apps that block images record no open (until a click), and some privacy features load images automatically.

Marketing emails get an unsubscribe link in two places:

  • in the content, wherever your template uses the unsubscribe_url variable (Unsubscribe link in the Liquid helper);
  • in the email headers List-Unsubscribe and List-Unsubscribe-Post: List-Unsubscribe=One-Click, so mail apps can show their own Unsubscribe button and unsubscribe with one click (RFC 8058).

Transactional emails do not get the unsubscribe headers.

Opening /unsub/<token> shows a minimal page titled Unsubscribe, in English or Italian depending on the reader’s browser language. It uses no scripts or external resources, cannot be framed by other sites and is marked noindex.

Situation Text
Valid link Do you want to stop receiving marketing emails at followed by the masked address (for example ma••••@example.com) and a Unsubscribe button
After confirming You have been unsubscribed. You will not receive marketing emails at this address anymore.
Already unsubscribed This address is already unsubscribed.
Invalid link This unsubscribe link is not valid or has expired.
Test email This is a test email: the unsubscribe link does nothing.
Temporary error Something went wrong. Please try again in a few minutes.

The address is masked (first two characters, then dots) so that a forwarded email does not reveal it in full. Opening the page does not unsubscribe: only the button (a form post) or the one-click request does, which protects readers from link scanners that open every URL.

amabledata offers a single choice, unsubscribing from marketing emails; there is no preference center with topics.

Unsubscribing is idempotent. The first time it:

  1. adds the address to the workspace suppression list with reason unsubscribe and source link (page) or one_click (mail app button);
  2. marks the message as unsubscribed in its statistics;
  3. fires the email.unsubscribed event (usable in automations and webhooks);
  4. sets the contact’s marketing status to unsubscribed.

Later marketing sends to that address are skipped as suppressed.

  1. Open Settings › Domains and add a tracking domain (for example links.example.com).
  2. Create the DNS records shown and wait until the domain is verified.
  3. New emails use it automatically for click, open and unsubscribe links.

Emails already sent keep their original links, which keep working.

  1. Open the template in Marketing › Email templates.
  2. Insert a link whose URL is the unsubscribe_url variable, for example in the footer: <a href="{{ unsubscribe_url }}">Unsubscribe</a>.
  3. Send a test: in test emails the link opens the test notice and does nothing.
  1. Click the unsubscribe link in the email, or the Unsubscribe button of your mail app.
  2. On the page, click Unsubscribe. (With the mail app button, it happens immediately.)
  3. The confirmation appears.
Endpoint Method Answer
/r/<token> GET 302 to the destination with _amb_c; 404 Link unavailable page if invalid
/o/<token> GET 200, 1×1 GIF, no-store
/unsub/<token> GET Unsubscribe page
/unsub/<token> POST (form) Confirmation page
/unsub/<token> POST body List-Unsubscribe=One-Click Plain-text confirmation (200), or error / invalid (400)
Event Fired when
email.link_clicked Every click (flag unique on the first)
email.opened Every open, or the first click without a prior open (flag unique on the first)
email.unsubscribed The first unsubscribe of the address
  • Recipients need nothing: the token is the only proof.
  • Unsubscribe links work forever, even after a message is deleted; if the message no longer exists the address is still suppressed.
  • Managing suppressions in the app requires the email permissions of your role.
Symptom Cause Fix
Links point to a generic address instead of your domain No verified tracking domain at send time. Verify a tracking domain; future sends use it.
A content link opens Link unavailable (This link is not valid or has expired.) The /r/ URL was cut or altered (for example by line wrapping in a forward). Click the link in the original email.
An unsubscribe link shows This unsubscribe link is not valid or has expired. The /unsub/ URL was cut or altered. Click the link in the original email, or use the mail app’s Unsubscribe button.
Opens are much lower than clicks Images blocked by the reader’s mail app. Rely on clicks; every click also counts as an open.
A contact unsubscribed but you never saw them click They used the mail app’s one-click button. Expected: the suppression source is one_click.
_amb_c stays in the destination URL The destination site has no amabledata tracker. Install the tracker (see Install the tracker); the parameter is otherwise harmless.