Knowledge Base/Getting Started/Getting Started Basics

How do I use tags in Mandrill?

Kaitlin
posted this on November 10, 2013 07:56 PM

Tagging your Mandrill emails lets you easily search activity, compare stats, and more. You can add tags to emails using sending API calls, custom SMTP headers, or manage tags manually.

Add tags in your Mandrill account

  1. Go to Outbound > Tags.
  2. Enter the name of your tag then click + Add Tag.

Delete tags

  1. Go to Outbound > Tags.
  2. Find the tag you want to remove and click Delete.
  3. In the window that appears, confirm removal by clicking Yes, delete the tag.

Deleting a tag also deletes all aggregate stats collected for the tag. Deleting a tag cannot be undone. If new emails are sent with the same tag, that tag will be recreated—you'll need to ensure you've stopped sending with the tag before deleting.

Use the Tags calls to manage tags via the Mandrill API.

Add tags in your API request

Mandrill creates tags for you automatically when you've included them in your sending API call. In this example, Mandrill will add "order-confirmation" and "order-shipped" to your list of tags if they don't exist already:

"tags": [
            "order-confirmation",
            "order-shipped"
        ],

Add tags using custom SMTP headers

We'll create tags for you automatically when you include them in your email using the custom SMTP header, X-MC-Tags.

System-generated tags

We'll also tag emails for you based on sender, template used (if any), and API key. Filter your Outbound Activity by these system tags using the Tagged drop-down menu.

Search activity by tags

Use the search query, tags:tagname, to filter activity based on tags included for your emails, or select a single tag using the Tagged drop-down menu on the Outbound Activity page.

When to use tags or custom message metadata

Tags are great for broad categories of messages like welcome or forgot-password emails. The content for these emails may vary, but the tag can help track data like opens and clicks for that type of email over time.

Metadata is generally better for managing more user-specific information like a 'user id' from your system, for example. Metadata information is returned in webhooks and searchable in Outbound Activity for your Mandrill account, so you can tie certain information back to data in your own system.

Tag-based stats are kept indefinitely, while metadata stats are not. Use the View Stats By drop-down menu to filter overall stats on the Dashboard in your Mandrill account, or by using the tags API calls.

Notes

Stats are accumulated using tags, but Mandrill stores only 100 tags per account (not including system-generated tags), so this should not be unique for every message or change frequently.

Tags should be 50 characters or less. Any tags starting with an underscore are reserved for internal use and cannot be used.

 
Topic is closed for comments