• Townie
    AI
  • Blog
  • Docs
  • Pricing
  • We’re hiring!
Log inSign up
orjpap

orjpap

pixeltracker

Public
Like
pixeltracker
Home
Code
2
README.md
H
main.tsx
Branches
1
Pull requests
Remixes
History
Environment variables
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.
Sign up now
Code
/
Code
/
Search
main.tsx
https://orjpap--624de8743ca111f098469e149126039e.web.val.run
README.md

✨ 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
HTTP
  • main.tsx
    orjpap--62…9e.web.val.run
Code
README.md
H
main.tsx
FeaturesVersion controlCode intelligenceCLI
Use cases
TeamsAI agentsSlackGTM
DocsShowcaseTemplatesNewestTrendingAPI examplesNPM packages
PricingNewsletterBlogAboutCareers
We’re hiring!
Brandhi@val.townStatus
X (Twitter)
Discord community
GitHub discussions
YouTube channel
Bluesky
Terms of usePrivacy policyAbuse contact
Β© 2025 Val Town, Inc.