✨ Tracking Pixel Server

A simple HTTP server that serves a 1x1 transparent PNG tracking pixel and logs visitor information including IP addresses, user agents, and referrers.

Features

  • 🖼️ Invisible Tracking: Serves a 1x1 transparent PNG pixel named sparkle.png
  • 📊 IP Logging: Captures and logs visitor IP addresses with timestamps
  • 🔍 Admin Dashboard: Web interface to view all tracking logs
  • 🚫 No Cache: Ensures every request is tracked (no browser caching)
  • 📱 Detailed Info: Logs user agent, referer, and request timestamp

Endpoints

Tracking Pixel

  • URL: /sparkle.png
  • Method: GET
  • Response: 1x1 transparent PNG image
  • Side Effect: Logs visitor information to database

Admin Dashboard

  • URL: /admin/logs
  • Method: GET
  • Response: HTML page showing all tracked requests

Home Page

  • URL: /
  • Method: GET
  • Response: Information page with usage instructions

Usage

Embed in HTML

<img src="https://your-val-url.web.val.run/sparkle.png" width="1" height="1" style="display:none;" />

Embed in Email

<img src="https://your-val-url.web.val.run/sparkle.png" width="1" height="1" alt="" />

Track with JavaScript

const img = new Image(); img.src = 'https://your-val-url.web.val.run/sparkle.png';

Data Collected

For each request to the tracking pixel, the following information is logged:

  • IP Address: Client's IP (supports proxies and CDNs)
  • Timestamp: When the request was made
  • User Agent: Browser/client information
  • Referer: The page that loaded the tracking pixel
  • Request Path: Always /sparkle.png

Database Schema

CREATE TABLE pixel_tracking_logs ( id INTEGER PRIMARY KEY AUTOINCREMENT, ip_address TEXT NOT NULL, user_agent TEXT, referer TEXT, timestamp DATETIME DEFAULT CURRENT_TIMESTAMP, request_path TEXT );

Privacy Considerations

This tracking pixel collects visitor information including IP addresses. Make sure to:

  1. Comply with privacy laws (GDPR, CCPA, etc.)
  2. Include appropriate privacy notices
  3. Obtain consent where required
  4. Consider data retention policies

Technical Details

  • Built with Hono framework
  • Uses Val Town's SQLite for data storage
  • Supports IP detection through various proxy headers
  • Returns proper HTTP headers to prevent caching
  • Base64-encoded 1x1 transparent PNG pixel