Playbooks / Set up first-party attribution and tracked short links

Set up first-party attribution and tracked short links

Set up first-party attribution and tracked short links

Ready now

A tracking script and /api/t/* routes that capture visits, touches, bot-filtered sessions, registration and booking events into cc_ tables, send server-side Meta CAPI events, accept Stripe or PayPal sale webhooks, sync Meta ad spend, and render an /attribution page with a report function in Postgres.

Kit

No separate kit. The playbook is self-contained.

You need

AccountWhyFree or paidPlan
SupabasePostgres database, auth (dashboard logins), row level security, Realtime pulse, Edge Functions and pg_cron for every dashboard, the attribution tables, booking alerts and the Brain state.Free tier availablePro (25 USD/mo) for anything a client logs into. The free tier pauses a project after 7 days without traffic and caps an org at 2 active projects; a paused free project took three client dashboards offline at once (a project log).
VercelHosts every site, funnel, dashboard and serverless API (subscribe, book, attribution, AC proxy). Runs the cron jobs declared in vercel.json.Free tier availablePro (20 USD/mo per seat). The Hobby plan forbids commercial use, so any client site or paid product must be on Pro. Hobby is fine for a personal portfolio.
Meta Business Suite (Pixel, Conversions API, Marketing API)Facebook and Instagram ads. The funnel fires Pixel events, the attribution system sends server-side Conversions API events, the Meta Ads tab pulls ad-level insights, and social posting reaches your Pages through Zernio.FreeBusiness account is free; you pay for ad spend only. Requires a verified business and a domain verification TXT record for the Pixel.
StripePayments for the Hook Book (checkout + webhook provisions the account) and sale events for first-party attribution.FreeNo monthly fee; 2.9% + 30c per card charge. Pick Stripe OR PayPal before wiring attribution.
PayPal (Developer)Alternative to Stripe for sale webhooks into first-party attribution.FreeNo monthly fee; per-transaction fees.
ActiveCampaignEmail list, broadcasts, automations and tags. The email engine drafts into a dashboard queue and sends through the AC API; funnels subscribe leads via the API; replies come back through an AC webhook.PaidMarketing Lite or Plus (from about 15 USD to 49 USD/mo at 1,000 contacts). API access is on every plan. Webhooks (for reply tracking) need automations, which Lite has.
CalendlyBooking page for discovery chats. The funnel embeds it, the booking-alert system polls it, the calls page reads upcoming events.Free tier availableFree plan is enough for one event type and the API (Personal Access Tokens work on free). Standard (10 USD/mo) adds webhooks and reminders; the systems here poll instead, so free works.

What you bring

  • Your Meta Pixel id and your conversions token
  • Your tracking convention: the ad URL parameter on every ad, and the tag on every email link
  • Your payment processor choice, and the webhook secret
  • Your destinations for short links

The steps

  1. Create the accounts and set the env
  2. Create the tables, views, report function and cron
  3. Put the tracker on every page and wire the write routes
  4. Tag every ad and turn on server-side conversions
  5. Tag email and organic links
  6. Wire payments and phone sales
  7. Make booked calls count
  8. Create short links
  9. Render the report and verify the numbers against ground truth

Goes further if you have already built Build the Facebook ads funnel (opt-in, self-hosted VSL, booking page, booked page, alerts). You can build this without it.

Get the full playbook

Part of: Get your database sorted