A simple Node.js + Express + EJS + SQLite application that generates and serves 1×1 tracking pixels for email opens. This project lets you:
- Create unique tracking pixel URLs.
- Embed them in emails (or web pages) to record open events.
- View open logs with timestamps, IPs, and user agents.
-
Pixel Generation
- Generates a unique ID (UUID) for each pixel.
- Stores pixel data (name, creation time) in a local SQLite database.
-
Open Tracking
- Serves a 1×1 transparent PNG at
/tracker/:id.png. - Logs each open event (time, IP, user-agent) to SQLite.
- Serves a 1×1 transparent PNG at
-
Web Dashboard
- Displays all created pixels.
- Provides a “View Logs” page to see open events for each pixel.
- Includes instructions on how to embed pixels in Gmail emails.
- Clone the repository (or download the ZIP):
git clone https://github.com/DevSpeaks/mail-tracker.git cd mail-tracker - Install dependencies:
npm install
- Run the app:
By default, it listens on port
npm start
3300. You can visit http://localhost:3300 in your browser.
-
Open the dashboard
Go to http://localhost:3300 in your browser. -
Create a pixel
- Enter a pixel name (optional) and click Create Pixel.
- A new pixel entry appears with a unique Tracker URL (e.g.,
http://localhost:3300/tracker/<UUID>.png).
-
Embed the pixel
- Copy the Tracker URL.
- Insert it into an email as an
<img>tag or using Gmail’s “Insert photo from web” option. - Once the recipient opens the email (and images load), your server records an open event.
-
View logs
- Click the View Logs link next to a pixel on the dashboard.
- You’ll see each open event with date/time, IP address, and user-agent.
-
Localhost vs. Public Domain
- If you’re running this on your local machine (
http://localhost:3000), external email clients won’t be able to load the pixel. - You need a publicly accessible domain or IP address (e.g., on a VPS, Heroku, Render, etc.) for real-world tracking.
- If you’re running this on your local machine (
-
Image Blocking
- Many email clients (including Gmail) block or proxy images by default.
- Not all opens will be recorded if the recipient doesn’t enable images.
-
Privacy & Legal
- Depending on your region, you may be required to disclose to recipients that you’re tracking email opens.
- Use responsibly and comply with privacy regulations (e.g., GDPR).
- Copy the Tracker URL from your dashboard (e.g.,
http://yourdomain.com/tracker/<UUID>.png). - Compose a new email in Gmail.
- Click the “Insert photo” icon in the formatting toolbar.
- Select “Web Address (URL)” and paste your pixel URL.
- Insert the image. It might look like a tiny/broken icon—this is normal for a 1×1 transparent pixel.
- Send the email. Once opened (with images enabled), the pixel is requested, and your open log updates.
mail-tracker/
├── app.js # Main server code
├── package.json
├── package-lock.json
├── mail-tracker.db # SQLite database (created at runtime)
└── views/
├── index.ejs # Dashboard for creating and listing pixels
└── logs.ejs # Displays open logs for a specific pixel
public/
└── images/
└── pixel.png # 1×1 transparent PNG used as the tracking pixel
- Fork the repo
- Create a feature branch (
git checkout -b feature/my-new-feature) - Commit your changes (
git commit -am 'Add new feature') - Push to the branch (
git push origin feature/my-new-feature) - Create a new Pull Request
Email open tracking is based on image load events. Modern email clients such as Gmail, Apple Mail, and Outlook often proxy, cache, or prefetch images for privacy and security reasons. Because of this behavior, open tracking should be treated as an estimated metric rather than a guaranteed indication that a human viewed the email.
Improves the quality of open tracking data by:
- Comparing email sent timestamps with first image request timestamps
- Deduplicating multiple image requests for the same tracking pixel
- Using historical traffic patterns to classify proxy and automated image loads
These techniques help reduce noise and improve the directional accuracy of open rate metrics. However, they cannot reliably distinguish between automated image loads and real human opens in all cases, especially when image proxying is involved.
For more reliable engagement measurement, click tracking and other user initiated actions should be used alongside open tracking.
MIT © 2024
Feel free to modify this project.
Happy tracking! If you have questions or issues, open an issue on GitHub.