Skip to contentSkip to navigationSkip to topbar
On this page
Looking for more inspiration?Visit the
(information)
You're in the right place! Segment documentation is now part of Twilio Docs. The content you are used to is still here—just in a new home with a refreshed look.

Spec: Email Events


This guide explains what data should be sent to Segment from Email tools and hence is targeted to partners who send Email data back into Segment rather than targeted to customers themselves. The semantic events detailed below represent the ideal for Email events; not every Email tool supports all of these events or all of their properties.


Overview

overview page anchor

Every Email tool is built around the idea of delivering emails to recipients. A user sends one or many emails through an email tool, and the email is either delivered to a recipient or bounces if the email is undeliverable.

When an email is delivered, a recipient can take one or many actions on it: They might open the email, click on a link in the email's body, mark the email as spam, or unsubscribe


The email category has the following semantic events:

Email Bounced

email-bounced page anchor

This event should be sent when an email tool receives notice from an email server that an email is undeliverable.

Properties

properties page anchor

This event supports the following semantic properties:

PropertyTypeDescription
email_idStringAn ID used to identify the email.
email_subjectStringThe email's subject line.
campaign_idStringAn id used to identify a campaign
campaign_nameStringA name used to identify a campaign

This event supports the following semantic context properties:

PropertyTypeDescription
context.traitsObjectAn associative array about the email's intended recipient.
context.traits.emailStringThe intended recipient's email address.
Example
example page anchor
1
{
2
"user_id": "019mr8mf4r",
3
"action": "track",
4
"event": "Email Bounced",
5
"context": {
6
"ip": "67.207.109.102",
7
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",
8
"traits": {
9
"email": "pgibbons@example.com"
10
}
11
},
12
"properties": {
13
"email_id": "18vzF7u3z",
14
"email_subject": "First shirt on us!",
15
"campaign_id": "123",
16
"campaign_name": "New Customer Discount"
17
}
18
}

This event should be fired when the receiving mail server confirms receipt of an email.

This event supports the following semantic properties:

PropertyTypeDescription
email_idStringAn ID used to identify the email.
email_subjectStringThe email's subject line.
campaign_idStringAn id used to identify a campaign
campaign_nameStringA name used to identify a campaign

This event supports the following semantic context properties:

PropertyTypeDescription
context.traitsObjectAn associative array about the email's intended recipient.
context.traits.emailStringThe intended recipient's email address.
1
{
2
"user_id": "019mr8mf4r",
3
"action": "track",
4
"event": "Email Delivered",
5
"context": {
6
"ip": "67.207.109.102",
7
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",
8
"traits": {
9
"email": "pgibbons@example.com"
10
}
11
},
12
"properties": {
13
"email_id": "18vzF7u3z",
14
"email_subject": "First shirt on us!",
15
"campaign_id": "123",
16
"campaign_name": "New Customer Discount"
17
}
18
}

This event supports the following semantic properties:

PropertyTypeDescription
email_idStringAn ID used to identify the email.
email_subjectStringThe email's subject line.
campaign_idStringAn id used to identify a campaign
campaign_nameStringA name used to identify a campaign
link_idStringAn id used to identify a link
link_urlStringThe URL the link points to.

This event supports the following semantic context properties:

PropertyTypeDescription
context.ipObjectThe opening computer's public IP address.
context.traitsObjectAn associative array describing the email's intended recipient.
context.traits.emailStringThe intended recipient's email address.
context.user_agentStringThe opening browser's user agent.
1
{
2
"user_id": "019mr8mf4r",
3
"action": "track",
4
"event": "Email Link Clicked",
5
"context": {
6
"ip": "67.207.109.102",
7
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",
8
"traits": {
9
"email": "joanna@chotchkies.com"
10
}
11
},
12
"properties": {
13
"email_id": "18vzF7u3z",
14
"email_subject": "First shirt on us!",
15
"campaign_id": "123",
16
"campaign_name": "New Customer Discount",
17
"link_id": "101",
18
"link_url": "https://www.buymyshirts.com?promo=NEWCUSTOMER"
19
}
20
}

This event should be fired when a recipient marks an email as spam.

This event supports the following semantic properties:

PropertyTypeDescription
email_idStringAn ID used to identify the email.
email_subjectStringThe email's subject line.
campaign_idStringAn id used to identify a campaign
campaign_nameStringA name used to identify a campaign

This event supports the following semantic context properties:

PropertyTypeDescription
context.ipObjectThe opening computer's public IP address.
context.traitsObjectAn associative array describing the email's intended recipient.
context.traits.emailStringThe intended recipient's email address.
context.user_agentStringThe opening browser's user agent.
1
{
2
"user_id": "019mr8mf4r",
3
"action": "track",
4
"event": "Email Marked as Spam",
5
"context": {
6
"ip": "67.207.109.102",
7
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",
8
"traits": {
9
"email": "mwaddams@example.com"
10
}
11
},
12
"properties": {
13
"email_id": "18vzF7u3z",
14
"email_subject": "First shirt on us!",
15
"campaign_id": "123",
16
"campaign_name": "New Customer Discount"
17
}
18
}

This event should be fired when the recipient opens the email.

This event supports the following semantic properties:

PropertyTypeDescription
email_idStringAn ID used to identify the email.
email_subjectStringThe email's subject line.
campaign_idStringAn id used to identify a campaign
campaign_nameStringA name used to identify a campaign

This event supports the following semantic context properties:

PropertyTypeDescription
context.ipStringThe opening computer's public IP address.
context.traitsObjectAn associative array describing the email's intended recipient.
context.traits.emailStringThe intended recipient's email address.
context.user_agentStringThe opening browser's user agent.
1
{
2
"user_id": "019mr8mf4r",
3
"action": "track",
4
"event": "Email Opened",
5
"context": {
6
"ip": "67.207.109.102",
7
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",
8
"traits": {
9
"email": "pgibbons@example.com"
10
}
11
},
12
"properties": {
13
"email_id": "18vzF7u3z",
14
"email_subject": "First shirt on us!",
15
"campaign_id": "123",
16
"campaign_name": "New Customer Discount"
17
}
18
}

This event should be fired when the recipient unsubscribes from the email. The unsubscription can either happen for a particular list, or globally from all marketing emails, depending on the tool. Typically you cannot unsubscribe from a transactional email such as a password reset.

This event supports the following semantic properties:

PropertyTypeDescription
email_idStringAn ID used to identify the email.
email_subjectStringThe email's subject line.
campaign_idStringAn id used to identify a campaign
campaign_nameStringA name used to identify a campaign
list_idStringAn optional id used to identify a list
list_nameStringAn optional name used to identify a list

This event supports the following semantic context properties:

PropertyTypeDescription
context.ipStringThe opening computer's public IP address.
context.traitsObjectAn associative array describing the email's intended recipient.
context.traits.emailStringThe intended recipient's email address.
context.user_agentStringThe opening browser's user agent.
1
{
2
"user_id": "019mr8mf4r",
3
"action": "track",
4
"event": "Unsubscribed",
5
"context": {
6
"ip": "67.207.109.102",
7
"user_agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_2) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/41.0.2272.118 Safari/537.36",
8
"traits": {
9
"email": "pgibbons@example.com"
10
}
11
},
12
"properties": {
13
"email_id": "18vzF7u3z",
14
"email_subject": "First shirt on us!",
15
"campaign_id": "123",
16
"campaign_name": "New Customer Discount",
17
"list_id": "1425",
18
"list_name": "New customers"
19
}
20
}