Skip to content

Feature Request: Support dont-track attribute to exclude specific links from tracking #268

@honzavalusek

Description

@honzavalusek

Hi,

Thanks for this package — it's been very helpful.

I’d like to request a feature that allows users to exclude specific links from being tracked.


🧩 Proposed Feature

Add support for a custom HTML attribute like data-dont-track (or similar), which users can apply to <a> tags to indicate that those links should not be rewritten or tracked by the package even if the track-links config option is set to true.

Example Usage:

<a href="https://example.com" data-dont-track>Untracked Link</a>

In this example, the link to https://example.com would be rendered in the email without any tracking applied, even if other links in the same message are being tracked.


💡 Use Case

There are scenarios where tracking all links isn't desirable — for example:

  • Links to unsubscribe pages
  • Privacy-sensitive external links
  • Internal links used purely for accessibility or compliance

Having this option would give users finer control over what gets tracked.


⚙️ Implementation Idea

During the HTML parsing phase, the logic could skip adding tracking parameters to links that have the data-dont-track attribute (or similar).
The attribute could then be removed from the final rendered HTML to keep things clean.


🤝 Contribution

I'd be happy to implement this feature and open a PR if you're open to the idea.

Thanks for considering!

Let me know if you want to change the attribute name (data-dont-track), or if you’d like a draft implementation outline to help get started.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions