Open and click tracking
Tracking is configured per domain and is off by default.
| Setting | What it does | Webhook event |
|---|---|---|
open_tracking |
Inserts a 1x1 tracking pixel into the HTML body. | email.opened |
click_tracking |
Rewrites links in the HTML body so clicks are recorded before redirecting. | email.clicked |
import { SpacePost } from "@spacepost/node";
const spacepost = new SpacePost(process.env.SPACEPOST_API_KEY);
const { error } = await spacepost.domains.update({ id: "0192e1c4-0000-7000-8000-000000000001", openTracking: true, clickTracking: true,});if (error) console.error(error);curl -X PATCH https://api.spacepost.dev/domains/$DOMAIN_ID \ -H "Authorization: Bearer $SPACEPOST_API_KEY" -H "Content-Type: application/json" \ -d '{ "open_tracking": true, "click_tracking": true }'The change applies to emails sent afterwards. Both fields are optional; send only the one you want to change.
Considerations
Section titled “Considerations”- Opens are approximate. Apple Mail Privacy Protection and some security scanners load images automatically, inflating opens. Gmail caches images. Treat opens as a rough signal, never as proof a person read the email.
- Clicks are more reliable but security scanners can also pre-click links.
- Privacy. Tracking records IP address and user agent in the event payload. Disclose it in your privacy policy, and consider leaving open tracking off for sensitive transactional mail (password resets, receipts).
- Plain-text parts are never tracked. Tracking only affects HTML.
- Deliverability. Link rewriting changes the URLs recipients see. Some spam filters dislike this on transactional mail; if you see a deliverability dip, turn click tracking off for that domain and use a separate subdomain for marketing mail.
An email.opened or email.clicked event sets the email’s last_event, but never moves it backwards from a more severe state such as bounced.