Edge tracking pixel that records ad impressions, enriches them with IP geolocation and syncs them to Snowflake for campaign analytics.
Role: Software architect and developer
Client: Ad-tech client
Team: Solo
Period: 2024
Challenge
An ad-tech company needed to measure what happens after an ad is shown. Each impression carries campaign, brand, ad, network and device parameters and has to be stored with location data for analysis in Snowflake. The endpoint had to answer instantly under heavy load, validate every parameter and keep events safe until they reach the warehouse, while infrastructure costs and maintenance stayed low.
Solution
The pixel is a Hono app on Cloudflare Workers: /pixel.gif sets a first-party cookie, validates parameters against a config and writes the impression with IP, user agent and referrer to Cloudflare D1. Scheduled workers import MaxMind GeoLite2 IPv4 and IPv6 ranges in parallel chunks from zipped CSV streams, enrich impressions with location, sync them to Snowflake in batches through a small proxy service and clean up old rows hourly. I designed the pipeline end to end; load tests run on Bun, deployment goes through Wrangler and GitHub Actions.
Key features
Pixel endpoint at the edge with cookie ID and parameter validation
Impressions stored in Cloudflare D1 with IP, user agent and referrer
Parallel GeoLite2 import of IPv4/IPv6 ranges from streamed archives
Batched sync to Snowflake via a proxy service; hourly cleanup cron
Load tests on Bun; deployment with Wrangler and GitHub Actions
Outcome
Designed and built solo in four months (15 commits) as a fully serverless edge pipeline