Public
Like
pixeltracker
Val Town is a collaborative website to build and scale JavaScript apps.
Deploy APIs, crons, & store data β all from the browser, and deployed in milliseconds.
main.tsx
https://orjpap--624de8743ca111f098469e149126039e.web.val.run
A simple HTTP server that serves a 1x1 transparent PNG tracking pixel and logs visitor information including IP addresses, user agents, and referrers.
- πΌοΈ 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
- URL:
/sparkle.png
- Method: GET
- Response: 1x1 transparent PNG image
- Side Effect: Logs visitor information to database
- URL:
/admin/logs
- Method: GET
- Response: HTML page showing all tracked requests
- URL:
/
- Method: GET
- Response: Information page with usage instructions
<img src="https://your-val-url.web.val.run/sparkle.png" width="1" height="1" style="display:none;" />
<img src="https://your-val-url.web.val.run/sparkle.png" width="1" height="1" alt="" />
const img = new Image();
img.src = 'https://your-val-url.web.val.run/sparkle.png';
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
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 );
This tracking pixel collects visitor information including IP addresses. Make sure to:
- Comply with privacy laws (GDPR, CCPA, etc.)
- Include appropriate privacy notices
- Obtain consent where required
- Consider data retention policies
- 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