> For the complete documentation index, see [llms.txt](https://doc.batch.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://doc.batch.com/guides-and-best-practices/message/email/link-and-tracking-settings/how-to-add-an-unsubscribe-link-to-your-email-template-1.md).

# How to add an unsubscribe link to your email template?

### Why add an unsubscribe link to your email?

Adding an unsubscribe link to your e-mail marketing campaigns allows Batch to get **instant opt-out feedback** and to not retarget recipients who have chosen to unsubscribe.

Thus, it allows:

* Not to generate dissatisfaction with the recipient who has chosen not to receive e-mail marketing anymore.
* Not to damage the sending reputation.

{% hint style="danger" %}
Unsubscribe links are mandatory in marketing campaigns, but **must not be included in transactional messages.**
{% endhint %}

{% hint style="info" %}
Unsubscribe from an email is recorded when the end user **clicks the unsubscribe link**. The end user then lands on an unsubscribe confirmation page.
{% endhint %}

Two approaches are available depending on your setup and preference management requirements:

* **Option 1** — Native Batch unsubscribe link: Batch handles the full opt-out flow automatically.
* **Option 2** — Custom preference management page: you redirect users to your own page and update Batch programmatically.

### Choosing between the two options

<table><thead><tr><th width="262.38671875"></th><th width="215.671875">Option 1: Native Batch link</th><th width="268.74609375">Option 2: Custom preference page</th></tr></thead><tbody><tr><td>Implementation effort</td><td>Low</td><td>High</td></tr><tr><td>Opt-out granularity</td><td>Global marketing opt-out</td><td>Per newsletter or per category</td></tr><tr><td>Dashboard statistics</td><td>Full</td><td>Partial</td></tr><tr><td>Data sync to your infrastructure</td><td>Via <a href="https://doc.batch.com/developer/api/cep/profiles/export#profile-events">Profiles API – Export</a></td><td>Built into your page</td></tr><tr><td>Batch opt-out statuts update</td><td>Automatic on click</td><td>Via <a href="https://doc.batch.com/developer/api/cep/profiles/update">Profiles API – Update</a></td></tr><tr><td>Confirmation page</td><td>Batch default or custom</td><td>Fully custom</td></tr></tbody></table>

### Option 1: Native Batch unsubscribe link (recommended)

#### Adding an unsubscribe link to a template via HTML

Here is how you can simply add an unsubscribe link for an email template in a single language:

```html
<a data-msys-unsubscribe="1" data-msys-linkname="batch::unsub" href="[LANDING PAGE LINK]">Unsubscribe</a>
```

| Attribute                           | Description                                                                   |
| ----------------------------------- | ----------------------------------------------------------------------------- |
| `data-msys-unsubscribe="1"`         | Triggers the opt-out of the profile in Batch on click.                        |
| `data-msys-linkname="batch::unsub"` | Tags the click for campaign and automation statistics in the Batch dashboard. |

If the email template already contains personalization conditions to change the language of certain text blocks, the same should be done for the unsubscribe link:

```html
<a data-msys-unsubscribe="1" data-msys-linkname="batch::unsub" {% if b.language == 'fr' %} href="https://static.batch.com/list-management/landing.fr.html"> Se désinscrire {% else %} href="https://static.batch.com/list-management/landing.html"> Unsubscribe {% end %}</a>
```

#### Adding an unsubscribe link to a template using the Email Composer

You can also insert an unsubscribe link easily when using the Email Composer to create your email templates.

To do so:

1. Select the text
2. Add a hyperlink to the text area
3. Select the **Unsubscribe** option listed in the Link field on the left side panel.

{% hint style="warning" %}
`{{emailComposerUnsubscribeLink()}}` is **only compatible with the drag-and-drop Email Composer**, and should not be used for HTML email creation.
{% endhint %}

#### Choosing a confirmation landing page

Once recipients click the unsubscribe link:

* Batch **removes the recipients** from the marketing mailing list
* Recipients are redirected to a **confirmation landing page**

The purpose of the confirmation landing page is to confirm to recipients that they have been unsubscribed. When using the Email Composer unsubscribe variable, the page is automatically displayed in the end user's browser language if available, with English as a fallback. If you hardcode the URL directly in HTML, you must specify the language URL manually; there is no automatic language detection in that case.

{% hint style="info" %}
If you want to offer recipients the option to manage their preferences or stay subscribed, host a custom landing page instead (see [Option 2](#option-2-custom-preference-management-page)).
{% endhint %}

You can host your own custom landing page for full control over design and user experience, or rely on our default landing pages:

* 🇫🇷 French: <https://static.batch.com/list-management/landing.fr.html>
* 🇩🇪 German: <https://static.batch.com/list-management/landing.de.html>
* 🇬🇧 English: <https://static.batch.com/list-management/landing.html>
* 🇪🇸 Spanish: <https://static.batch.com/list-management/landing.es.html>
* 🇮🇹 Italian: <https://static.batch.com/list-management/landing.it.html>

#### Benefits and limitations

**Benefits**

* Immediate opt-out: the profile is marked as unsubscribed in Batch following the link click, preventing any further marketing sends.
* Unsubscribe clicks are categorized as `batch::unsub` and visible in campaign and automation statistics.

**Limitations**

* The opt-out is global for marketing emails, not per newsletter or communication type.
* You must synchronize unsubscriptions back to your data infrastructure using the [Profiles API – Export](https://doc.batch.com/developer/api/cep/profiles/export#profile-events) if downstream systems need to reflect opt-out status.
* If your setup uses custom attributes to manage opt-in, those are not automatically updated: you need to handle that separately via the [Profiles API – Update](https://doc.batch.com/developer/api/cep/profiles/update).

### Option 2: Custom preference management page

Instead of using Batch's native, you redirect recipients to a page on your own website that handles unsubscription. Batch is updated programmatically once users confirm their choice.

#### Requirements

* Build and host a preference management page that handles the unsubscribe logic.
* Call the [Profiles API – Update](https://doc.batch.com/developer/api/cep/profiles/update) from your backend once users unsubscribe. To mark a profile as opted out of marketing emails, set `$email_marketing` to `"unsubscribed"` in the `attributes` object:

```json
{
  "identifiers": { "custom_id": "user-123" },
  "attributes": {
    "$email_marketing": "unsubscribed"
  }
}
```

If your setup relies on custom opt-in attributes rather than the native `$email_marketing` field, update those attributes accordingly.

#### Benefits and limitations

**Benefits**

* Fine-grained preference management: users can unsubscribe from specific newsletters or communication types rather than all marketing emails at once.
* Full control over the design, copy, and user journey of the unsubscribe experience.

**Limitations**

* You are responsible for building and maintaining the page and its integration with the Profiles API.
* Unsubscribes are not categorized as `batch::unsub` clicks in Batch analytics, reporting is less detailed compared to Option 1.

{% hint style="info" %}
**Read more**

* [Profiles API – Update](https://doc.batch.com/developer/api/cep/profiles/update)
* [Profiles API – Export](https://doc.batch.com/developer/api/cep/profiles/export#profile-events)
* [Legal Requirements & Batch Email Senders Guidelines](https://doc.batch.com/guides-and-best-practices/email-deliverability/legal-requirements-and-batch-email-senders-guidelines)
* [Understanding the Email Subscribers Lifecycle](https://doc.batch.com/guides-and-best-practices/email-deliverability/list-hygiene-and-recipients-management/understanding-the-email-subscribers-lifecycle)
  {% endhint %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://doc.batch.com/guides-and-best-practices/message/email/link-and-tracking-settings/how-to-add-an-unsubscribe-link-to-your-email-template-1.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
