Email Event Tracking with Sendlix
Sendlix offers a robust yet straightforward tracking system designed to monitor your email campaign performance. With built-in support for key events such as opens and clicks, Sendlix integrates seamlessly into your existing email workflows, ensuring accurate engagement tracking with minimal setup.
How It Works
Sendlix automates tracking using a placeholder system that replaces tokens in your email templates with dynamic values:
{{id}}
: Inserts the unique Message ID, which serves as the primary identifier for each email.{{signature}}
: Inserts the cryptographic signature corresponding to the Message ID, ensuring the authenticity of the tracking request.
To validate a signature, use the public key retrieved from the DNS entry sdx1._domainkey.{domain}
. This validation step prevents unauthorized tracking requests and ensures data integrity.
Example Implementation in Node.js
Below is a Node.js implementation that retrieves the public key from DNS and verifies the cryptographic signature:
const crypto = require("crypto");
const dns = require("dns").promises;
const domain = "example.com";
const messageId = "1234567890";
const signature = "your_signature_here";
async function verifySignature() {
let publicKey;
try {
// Retrieve the public key from DNS
const records = await dns.resolveTxt(`sdx1._domainkey.${domain}`);
publicKey = records[0].join("");
} catch (e) {
console.error("Failed to retrieve DNS records:", e);
return;
}
// Format the public key for verification
publicKey = publicKey.replace("v=DKIM1;k=rsa;p=", "");
publicKey =
"-----BEGIN PUBLIC KEY-----\n" + publicKey + "\n-----END PUBLIC KEY-----";
// Verify the signature
const verifier = crypto.createVerify("sha256");
verifier.update(messageId);
const verified = verifier.verify(publicKey, signature, "base64");
if (verified) {
console.log("Signature is valid!");
} else {
console.log("Signature is invalid!");
}
}
verifySignature();
This code snippet demonstrates how to fetch the DNS public key, extract and format it correctly, and use it to verify the integrity of an email's tracking data using Node.js's crypto
module.
Custom Signatures
You can enhance your tracking system by adding custom values to signatures. For example:
{{signature="my-custom-value"}}
When using a custom signature, Sendlix combines the Message ID and your custom value with a period (.
) separator. For instance:
- Message ID:
1234567890
- Custom Value:
my-custom-value
- Combined String:
1234567890.my-custom-value
This concatenated string is then cryptographically signed to ensure data integrity. The ability to add custom values allows for greater flexibility in tracking.
Tracking Opens
To track email opens, embed the following invisible tracking pixel in your email template:
<img
src="https://email.sendlix.com/image.png?id={{id}}&sig={{signature}}"
width="1"
height="1"
alt=""
style="display:none;"
/>
Note: Our system requires both
{{id}}
and{{signature}}
as URL parameters for tracking opens. This ensures that each open event is verified and authenticated.
Tracking Clicks
For click tracking, use Sendlix's secure redirect service by embedding the tracking link in your email content:
<a href="https://email.sendlix.com/t/{url}?id={{id}}&sig={{signature='{url}'}}">
Your link text
</a>
Replace {url}
with your actual destination URL (excluding the https://
prefix). Sendlix will only redirect to secure https://
destinations to maintain security and prevent malicious redirects.
Note: Our system requires both
{{id}}
and{{signature='{url}'}}
as URL parameters for tracking clicks. This ensures that each click event is uniquely identified and verified.
For testing you can can click on the links with the placeholders. It will not track but it will redirect you to the page.
Complete Email Template Example
Below is a fully functional email template that includes both open and click tracking:
<html>
<body>
<!-- Open Tracking Pixel -->
<img
src="https://email.sendlix.com/image.png?id={{id}}&sig={{signature}}"
width="1"
height="1"
alt=""
style="display:none;"
/>
<!-- Tracked Link -->
<a
href="https://email.sendlix.com/t/example.com/page?id={{id}}&sig={{signature='example.com/page'}}"
>
Visit our website
</a>
</body>
</html>
This template ensures accurate tracking of both email opens and link clicks, allowing you to measure engagement effectively.
Key Benefits
- Security: Cryptographic signatures ensure the integrity and authenticity of tracked data, preventing tampering or fraudulent events.
- Easy Integration: The system requires minimal modifications to existing email templates, making it easy to implement.
- Reliability: A robust and scalable tracking mechanism provides precise engagement metrics, helping optimize marketing strategies.
- Flexibility: The ability to include custom signature values allows advanced use cases, such as user-specific tracking or multi-stage verification.
Summary
Sendlix simplifies email tracking by using a placeholder system that automatically injects unique identifiers and cryptographic signatures into email templates. This enables secure and reliable monitoring of key email events, including opens and clicks. By leveraging Sendlix’s tracking features, businesses can gain deep insights into email campaign performance, detect engagement patterns, and refine their marketing strategies accordingly.
By implementing the provided examples, you can ensure accurate and secure event tracking for your email campaigns, enhancing visibility into user interactions while maintaining data integrity and security.