Skip to content

feat: record install attribution method and matched signals#32

Merged
onamfc merged 1 commit into
mainfrom
brandon/sit-296-attribution-enrichment
Jul 1, 2026
Merged

feat: record install attribution method and matched signals#32
onamfc merged 1 commit into
mainfrom
brandon/sit-296-attribution-enrichment

Conversation

@onamfc

@onamfc onamfc commented Jul 1, 2026

Copy link
Copy Markdown
Member

What

Makes install attribution measurable by persisting how each install was attributed and which signals drove it.

  • install_events gains attribution_method ('fingerprint' on a match, 'none' when organic) and matched_factors TEXT[] (the fingerprint signals that matched — already computed by the matcher, previously discarded). Idempotent ALTER for existing databases. [1] [2]
  • Set in recordInstallEvent (current install attribution is fingerprint-based, so the method is derived from whether a ≥threshold match was found). [1]
  • scripts/backfill-attribution.ts (npm run backfill:attribution): one-time, keyset-paginated backfill of attribution_method for historical rows from whether they were attributed (link_id present). matched_factors stays NULL for history (the signals weren't stored). [1] [2]

Why

Attribution confidence is only meaningful for fingerprint-matched installs; without a stored method, the confidence distribution mixes fingerprint and organic installs and can't be interpreted. This lets us measure attribution quality by method and audit which signals matched.

Verification

  • 139 unit tests pass (the install-insert column-alignment guards were updated for the two new trailing columns). [1] [2]
  • Integration check against Postgres: columns present, matched_factors TEXT[] round-trips, and the backfill sets organic rows to 'none'.

Make install attribution measurable. install_events gains attribution_method
('fingerprint' on a match, 'none' when organic) and matched_factors (the
fingerprint signals that matched — already computed by the matcher, now
persisted). Set in recordInstallEvent; idempotent ALTER for existing databases.

Adds scripts/backfill-attribution.ts (npm run backfill:attribution): one-time,
keyset-paginated backfill of attribution_method for historical rows from
whether they were attributed (link_id present); matched_factors stays NULL for
history.

Enables measuring attribution quality by method (fingerprint vs organic) and
auditing which signals drove each match. Verified: 139 unit tests pass; an
integration check confirms the columns, TEXT[] persistence, and the backfill.
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 41.37931% with 17 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/lib/database.ts 0.00% 17 Missing ⚠️

📢 Thoughts on this report? Let us know!

@onamfc onamfc merged commit b82dce4 into main Jul 1, 2026
12 of 13 checks passed
@github-actions github-actions Bot locked and limited conversation to collaborators Jul 1, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant