Skip to content

Show admins when a recipient opened their invoice#2004

Open
maebeale wants to merge 2 commits into
mainfrom
maebeale/invoice-page-visit-tracking
Open

Show admins when a recipient opened their invoice#2004
maebeale wants to merge 2 commits into
mainfrom
maebeale/invoice-page-visit-tracking

Conversation

@maebeale

@maebeale maebeale commented Jul 22, 2026

Copy link
Copy Markdown
Collaborator

🤖 suggested review level: 3 Read 📖 contained tracking + read logic behind a concern, one new admin-only view element

Why

Admins had no way to tell whether a registrant/payer had actually opened their invoice (the "Download PDF" button is a client-side window.print(), so downloads aren't observable). This surfaces recipient opens to admins.

What

  • Every invoice open is tracked as an Ahoy event, tagged with a viewer_role (admin vs recipient) so an admin previewing an invoice never counts as the recipient seeing it. (user_id can't distinguish them — a signed-in registrant has one too.)
  • Admin-only badge on the invoice: "First opened · ", a muted "Not opened yet" when unopened, and a CSS-only hover tooltip (no JS) listing every recipient open. Timestamps render in the viewer's time zone.
  • Shared read logic (invoice_views / invoice_viewed? / invoice_view_times + invoice_viewed/invoice_not_viewed scopes) extracted into an InvoiceViewTrackable concern on EventRegistration and FormSubmission.
  • Applies to both invoice pages: the registrant invoice and the bulk-payment invoice (blank admin template is untracked).

Notes

  • Also updates AI files (CLAUDE.md/copilot): documents the admin-only bg-blue-100 styling convention, a "reach for JS last" rule, and a stronger comments-only-when-needed guideline — per review feedback while building this.

The registrant invoice and bulk-payment invoice pages had no view
tracking, so there was no way to tell whether a payer had opened their
invoice. Emit an Ahoy view event on each and expose queryable helpers
and scopes on EventRegistration.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 02:22

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale
maebeale marked this pull request as ready for review July 22, 2026 10:47
Track every invoice open, tagging each with a viewer_role so an admin
previewing an invoice never counts as the recipient having seen it. An
admin-only badge on the invoice shows when the recipient first opened it
(or 'Not opened yet'), with a CSS-only hover tooltip listing all opens.
Timestamps render in the viewer's time zone.

Renames the bulk-payment event to view.event_bulk_payment_invoice and
extracts the shared read logic into an InvoiceViewTrackable concern.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings July 22, 2026 11:18

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@maebeale maebeale changed the title Track invoice page views so admins can see if it's been opened Show admins when a recipient opened their invoice Jul 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants