Tracking domains are used in engagement tracking to report email opens and link clicks.
They wrap the open pixel and all links in your emails.
When clicked, these links report the event to SparkPost, then quickly forward to the intended destination.
By default, the tracking domain on your account is spgo.io
(eu.spgo.io
for EU accounts). This API allows you to set up and manage custom tracking domains.
You can also set one up from your account (EU).
As an example, say your email contains this link:
<a href="https://www.heml.io">Build responsive emails</a>
In order to track clicks on that link, we wrap it. The resulting HTML would look something like this:
<a href="http://spgo.io/e/nInKCLCf9wnO2brop7RTsg...">Build responsive emails</a>
With a custom tracking domain you can replace the domain part of the link. So if your tracking domain was click.heml.io
, your HTML would look like this:
<a href="http://click.heml.io/e/nInKCLCf9wnO2brop7RTsg...">Build responsive emails</a>
In order for a tracking domain to be used, it must be associated to a sending domain or set as a default. Once that is done, templates and transmissions that have open or click tracking on will automatically use the domain to wrap links. If a tracking domain is set as default, it will automatically be used with sending domains that aren't associated with a different tracking domain. Default tracking domains do not override associated tracking domains. You can set a default for each subaccount as well. SparkPost picks the first tracking domain it can find to use in this order: 1. Associated tracking domain. 2. Subaccount default. 3. Account default.
Tracking domains need to be verified via DNS. You'll need to add a CNAME record with the value of spgo.io
(eu.spgo.io
for EU accounts) to the domain's DNS settings before it can be used or set as the default.
For more information and Enterprise settings go here.
Tracking domains use HTTP by default. Using HTTPS requires the set up and management of SSL Certificates, for more information see this guide.
Tracking domains can only be assigned to subaccounts on creation. They cannot be re-assigned at a later point. If assigned and verified, a tracking domain can also be set as the default for that subaccount. In order to be associated to a subaccount's sending domain, a tracking domain has to be assigned to the same subaccount.
{
"domain": "example.domain.com",
"port": 443,
"secure": true,
"default": false,
"status": {
"verified": false,
"cname_status": "pending",
"compliance_status": "pending"
}
}
Name of the tracking domain.
The port used when constructing the tracking URL. 80
if secure is false
, 443
if secure is true
.
false
Whether the tracking URL should use HTTPS. HTTP will be used if false
.
false
Whether the tracking domain should be used when not explicitly associated with a sending domain. Only one default domain per account and subaccount can be set. The domain has to be verified to be set as the default.
Contains status details like verification and DNS.
ID of the subaccount the tracking domain is assigned to. Not returned unless set and can only be set on creation.
POST /api/v1/tracking-domains
{
"domain": "example.domain.com",
"secure": true
}
{
"results": {
"domain": "example.domain.com"
}
}
Name of the tracking domain.
false
Whether the tracking URL should use HTTPS. HTTP will be used if false
.
POST /api/v1/tracking-domains//verify
{
"results": {
"verified": true,
"cname_status": "",
"compliance_status": "valid"
}
}
Initiate a check against the configured redirect for the specified tracking domain. The domain's status
object is returned on success.
GET /api/v1/tracking-domains/
{
"results": {
"port": 443,
"domain": "example.domain.com",
"secure": true,
"default": true,
"status": {
"verified": false,
"cname_status": "pending",
"compliance_status": "pending"
}
}
}
Retrieve an existing tracking domain.
PUT /api/v1/tracking-domains/
{
"secure": true,
"default": true
}
{
"results": {
"domain": "example.domain.com"
}
}
Update the attributes of an existing tracking domain. The primary account and each subaccount can only have one default tracking domain. Setting a new default automatically unsets the current relevant default, if it exists.
Whether the tracking URL should use HTTPS. HTTP will be used if false
.
Whether the tracking domain should be used when not explicitly associated with a sending domain. The domain has to be verified to be set as the default.
DELETE /api/v1/tracking-domains/
// Empty response body
Delete an existing tracking domain.
GET /api/v1/tracking-domains
{
"results": [
{
"port": 443,
"domain": "example.domain.com",
"secure": true,
"default": true,
"status": {
"verified": false,
"cname_status": "pending",
"compliance_status": "pending"
}
},
{
"port": 80,
"domain": "example2.domain.com",
"secure": false,
"default": false,
"status": {
"verified": true,
"cname_status": "valid",
"compliance_status": "valid"
},
"subaccount_id": 215
}
]
}
Restrict results to default domains when true and non-default domains when false.
Comma delimited list of subaccounts to include in results.
Returns an array with all tracking domains. Each item in the array is a full tracking domain object.