A lightweight, serverless, real-time email open tracking system combining Vercel Serverless Functions, Google Apps Script Webhooks, and Google Sheets. The system captures when an email recipient opens a tracked email by loading a 1ร1 tracking pixel.
It logs metadata (IP, user agent, timestamp) and sends instant Gmail notifications every time the email is opened.
- Track every email open event in real time.
- Log each event into Google Sheets for audit and analytics.
- Forward metadata to Google Apps Script for processing.
- Send Gmail notifications automatically.
- Deploy a minimal, scalable, costโfree solution leveraging serverless infrastructure.
- Pixel endpoint must respond with a valid 1ร1 GIF.
- Logs must appear in Google Sheets with correct schema.
- Gmail notifications must trigger on every open.
- System must operate without a backend server or database.
- Endpoint must handle repeated opens.
- Deployed on Vercel with environment variable support.
- Git & GitHub account
- Vercel account
- Google Account (for Sheets & Apps Script)
- Node.js 18+ (optional for local testing)
- Basic understanding of serverless functions
git clone https://github.com/<your-username>/email-open-tracker.git
cd email-open-trackeremail-open-tracker/
โโโ api/
โ โโโ open.js
โโโ package.json
โโโ .gitignore
โโโ README.md
npm installAPPSCRIPT_WEBHOOK=<Your Google Apps Script URL>
vercel --prodGET /api/open?mid=<mail_id>&v=<nonce>
| Param | Type | Required | Description |
|---|---|---|---|
| mid | string | yes | Unique email/message ID |
| v | string | no | Random value to avoid caching |
Content-Type: image/gif- 1ร1 transparent tracking pixel
This project does not include a UI. It is a pure backend pixel-tracking architecture.
If UI is added later, include:
- Dashboard for logs
- Table component for events
- Real-time updates via WebSockets or Polling
| Code | Meaning |
|---|---|
| 200 | Pixel delivered successfully |
| 500 | Internal serverless function error |
| 400 | Missing or invalid query parameters |
- Unlimited email open tracking
- Serverless, scalable, zero-cost model
- Instant Gmail notifications
- Logs maintained in Google Sheets
- Fully stateless API
- Vercel Serverless Functions โ pixel endpoint
- Google Apps Script โ webhook processor & email sender
- Google Sheets โ open-event storage
- JavaScript (Node.js)
- HTTP-based pixel tracking
- Configure Google Sheet with header schema
- Write Apps Script webhook handler
- Deploy the script and get public URL
- Add URL to Vercel environment variables
- Build
/api/open.jsserverless function - Deploy to Vercel
- Embed pixel in outbound email
- Logs appear in Sheets
- Gmail sends real-time notifications
| Test Case | Input | Expected Output |
|---|---|---|
| Pixel Load | URL hit | GIF + Sheet Row |
| Multiple Opens | Same email | Multiple log rows |
| Missing mid | URL without mid | 400 error |
| Apps Script Down | Webhook unreachable | Pixel still loads |
- End-to-end flow validated for repeated open events
- Verified pixel caching disabled (via
vparam) - Verified Sheets + Gmail notification latency ~1โ2 seconds
- cURL
curl "https://your-app.vercel.app/api/open?mid=test123&v=111"- Postman/Thunder Client
- Google Chrome Network Inspector
| Issue | Fix |
|---|---|
| Pixel not firing | Add v query param to avoid cache |
| No logs | Verify Apps Script URL in Vercel |
| No Gmail notification | Check permissions in Apps Script |
| 500 error | Missing env variable |
- Do not expose Apps Script URL in public repos
- Use HTTPS pixel endpoint
- Use long random
midto avoid enumeration attacks
- Auto-builds API route
- Instant CDN-based scaling
- Not supported for serverless API required by pixel tracking
1. Deploy Apps Script
2. Set APPSCRIPT_WEBHOOK in Vercel
3. Deploy to Vercel
4. Use pixel in email
5. Track opens in Sheets
- Use unique
midfor each email user - Add cache busters using
v=<timestamp> - Pixel loads silentlyโno UI
- Serverless cold start minimal
- Uses fast, stateless HTTP requests
- Apps Script batching possible for future scaling
- Dashboard UI
- Analytics charts
- Geo-IP enhancements
- Event batching
- Rotate script endpoints periodically
- Add IP anonymization for GDPR compliance
- Add retry queue if Apps Script is down
- Achieved 100% serverless, zero-infrastructure system
- Near real-time event tracking
- Infinite scalability using Vercel + Google Apps Script
Email Client โ Vercel Pixel API โ Google Apps Script โ Google Sheets + Gmail Notification
email-open-tracker/
โโโ api/
โ โโโ open.js
โโโ .gitignore
โโโ package.json
โโโ README.md
- Deploy to Vercel
- Send email with:
<img src="https://your-app.vercel.app/api/open?mid=demo123&v=1" />
- Open email from multiple devices
- Show real-time Sheet logs and Gmail notifications
This project provides a production-grade, serverless email open tracking solution with zero infrastructure cost and instant scalability. Leveraging Vercel + Google Apps Script ensures quick deployments, real-time notifications, and a clean, fault-tolerant architecture suitable for enterprise-grade tracking pipelines.
All components are modular, extensible, and aligned with modern web engineering standards.