← work / web-signals
Web Signals
Conversion analytics with AI-written site audits
// the problem
Site owners see traffic numbers but not where intent builds or leaks. Web Signals scores each session by intent and turns the behaviour into prioritised, readable findings.
// context
Built for a handful of client sites rather than as self-serve SaaS. The tracker runs inside someone else's page, so it has to fail silently.
// what I built
- A tracker script that records page views, scroll depth, CTA clicks, outbound and tel/mailto clicks, form starts, submits and abandons, and click heatmaps.
- Detection that survives modern frontends: fetch and XHR interception for AJAX form submissions, SPA route changes via history API, and MutationObserver for elements added later.
- Session intent scoring (capped at 200) classified low, moderate, strong and high, with traffic-source and UTM breakdown.
- Claude-generated audit findings, prioritised, with shareable report pages, task tracking from todo to deployed, and automated email follow-up through Resend.
// key decisions
- Batch in the browser, queue at the edge
The tracker buffers events and flushes every 2 seconds, sending page views, exits and form submits or abandons immediately. Batches go through a Cloudflare Queue, which cuts ingest requests by an estimated 3 to 5 times.
- Never break the host page
The tracker exits early on localhost or without a site key, wraps every handler in try/catch, uses passive listeners, and sends with sendBeacon as text/plain, which avoids a CORS preflight. Lost analytics are acceptable; a broken client page is not.
- Wrap browser globals, always pass through
fetch, XHR and the history API are wrapped to catch AJAX form submits and SPA route changes, and every wrapper calls the original. Interception is limited to same-origin POST and PUT on forms already started, giving up coverage to keep the risk to the host page low.
- Scoring that passive browsing cannot max out
Only the first 3 page views count toward a session's intent score, the score is capped at 200, and the high tier starts at 85. Three pricing pages plus the returning-visitor bonus reach 75, so a session needs at least one real action to be marked high intent.
// results
- 14 event types captured by the tracker.
- 27 migrations and 7 jobs on the daily cron.