Ad bindings (retired)
This page has been retired. Bindings are now managed inside the ClickUp Audit "Linked Ads" tab.
- Route:
/admin/ad-bindings - Guard:
/admin/*layout (isAdminTier()); the destination tab's data API additionally enforces platform-admin server-side. - Redirects to:
/admin/clickup-audit?tab=links— the screenshot below shows that destination.

What this route is now
The standalone Ad Linking workspace was merged into the consolidated
/admin/clickup-audit page. src/app/admin/ad-bindings/page.tsx is a
parameter-preserving redirect: it forwards ?tab= (translated through
resolveClickupAuditSection(), which maps legacy tab names like
bindings/ad-bindings/linked-ads → links, review-queue → checks),
plus ?create=true, ?ad_id=, and ?client_id=, so deep links into
"create a binding for this ad" still open the right pre-filled tool.
src/app/admin/ad-bindings/tabs.ts keeps the old AdLinkingTab type
(requests | links | checks) for backward compatibility.
The "Linked Ads" tab (destination)
Rendered by AdBindings.tsx inside ClickUpCoveragePanel:
- Bindings table — up to 500 existing ad→ClickUp-task bindings from
GET /api/admin/ad-bindings?limit=500, each row tying anad_idto aclickup_task_idunder a client, with binding source/provenance. - Link-an-ad tool — creates a manual binding; the client picker is fed by
GET /api/admin/clients?status=active&purpose=ad-linking(active clients only). Opened automatically when arriving with?create=true&ad_id=…. - Find-a-link / client filter — search and per-client filtering over the binding list (visible in the screenshot's filter controls).
- AdBindingDrawer — per-row drawer for inspecting/editing one binding.
Data model and provenance
Bindings live in the Supabase ad_bindings table. Migration
supabase/migrations/052_ad_bindings_v1_import_provenance.sql extended the
provenance enum with a v1_import source, so bindings carried over from the
legacy V1 system are distinguishable from ones created manually in this UI or
automatically by the matcher.
Relation to the bind-ads-to-clickup Inngest job
Automatic linking is done by the Inngest function
src/inngest/functions/bind-ads-to-clickup.ts (function id
bind-ads-to-clickup). It fans out a marketing/bind-ads.requested event per
client and matches ads to ClickUp tasks; manual bindings made here coexist
with its output, and a binding cleared in the audit "Fix & recheck" tab can be
re-linked on the next linking run. Coverage of this matching (how many ads
have a task at all) is the whole point of the parent ClickUp Audit page (P29).
Behavior summary
| Aspect | Value |
|---|---|
| HTTP behavior | Server redirect to /admin/clickup-audit?tab=links |
| Query params | tab (legacy names resolved), create, ad_id, client_id all preserved |
| Nav entry | None — the old "Ad Linking" sidebar item was removed; ClickUp Audit (requires manage_clickup) is the entry point |
| Rendering mode | force-dynamic |
Key files
| File / endpoint | Role |
|---|---|
src/app/admin/ad-bindings/page.tsx | Redirect with param translation |
src/app/admin/ad-bindings/tabs.ts | Legacy AdLinkingTab type kept for callers |
src/lib/clickup/audit-navigation.ts | resolveClickupAuditSection() legacy-tab alias map |
src/components/admin/AdBindings.tsx | Linked Ads tab UI (table + link tool + drawer) |
src/components/admin/AdBindingDrawer.tsx | Per-binding drawer |
GET/POST /api/admin/ad-bindings | Binding list/create API |
GET /api/admin/clients?purpose=ad-linking | Client picker source |
src/inngest/functions/bind-ads-to-clickup.ts | Automatic linking job |
supabase/migrations/052_ad_bindings_v1_import_provenance.sql | V1-import provenance |