Skip to content

Add tracking for Preserve Intent banner actions (#9409)#12849

Merged
mekarpeles merged 2 commits into
internetarchive:masterfrom
Sadashii:9409/feat/preserve-patron-intent-tracking
Jun 11, 2026
Merged

Add tracking for Preserve Intent banner actions (#9409)#12849
mekarpeles merged 2 commits into
internetarchive:masterfrom
Sadashii:9409/feat/preserve-patron-intent-tracking

Conversation

@Sadashii

@Sadashii Sadashii commented Jun 3, 2026

Copy link
Copy Markdown
Collaborator

Closes #9409

Adds link tracking tags (data-ol-link-track) to the "continue" and "dismiss" options on the Preserve Intent login-redirect banner, and ensures the pending_action cookie is cleared upon successful login with a valid redirect target.

Technical

  • Dynamically applies data-ol-link-track="PreserveIntent|Continue" and data-ol-link-track="PreserveIntent|Dismiss" to the respective banner elements using JavaScript at DOMContentLoaded in view.html.
  • Clears the pending_action cookie in the legacy login handler (openlibrary/plugins/upstream/account.py) and the FastAPI login handler (openlibrary/fastapi/account.py) when the redirect is safe and not blacklisted.
  • Added comprehensive unit tests for both legacy and FastAPI login redirect/cookie clearing behaviors.

Testing

Run Python tests:

pytest openlibrary/plugins/upstream/tests/test_account.py openlibrary/tests/fastapi/test_account.py

Manually verified behaviour, cookie is deleted with correct redirect and the html attributes are present on web view.

Screenshot

N/A

Stakeholders

@mekarpeles

Copilot AI review requested due to automatic review settings June 3, 2026 15:44
@github-actions github-actions Bot added the Priority: 2 Important, as time permits. [managed] label Jun 3, 2026

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.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Adds client-side link tracking metadata for “pending action” banner interactions on the account view page.

Changes:

  • Add data-ol-link-track to the “Continue” link.
  • Add data-ol-link-track to the dismiss/close control for the banner.

Comment thread openlibrary/templates/account/view.html
@mekarpeles

Copy link
Copy Markdown
Member

Thanks for the PR, @Sadashii!

Copilot has been assigned for an initial review.

@mekarpeles is assigned to this PR and currently has:

  • 0 open PR(s) of equal or higher priority to review first

Possible improvements for this PR

  • Proof of testing — the testing section covers style checks but doesn't describe how the tracking attributes were verified at runtime (e.g., confirming that data-ol-link-track values appear on the expected DOM elements, or that analytics events fire when the banner buttons are clicked). A brief note on what was manually checked would help reviewers.
PR triage checklist (maintainers / Pam)
  • PR description — not empty; explains what the change does and how to verify it
  • References an issue — PR body contains a #NNN reference
    • Linked issue is triaged — has a Priority: * label (not just Needs: Triage)
    • Linked issue is assigned — has at least one assignee
  • Commit history clean — no WIP/fixup/conflict noise; commit messages are meaningful
  • CI passing — no failing check-runs
  • Test cases present — if the change touches substantive logic, test coverage exists or is explained
  • Proof of testing — PR body includes a description of what was tested, a screenshot, or a video

Note

This comment was automatically generated by Pam, Open Library's Project AI Manager, on behalf of @mekarpeles. Pam is designed to provide status visibility, perform basic project management functions and relevant codebase research, and provide actionable feedback so contributors aren't left waiting.

@mekarpeles mekarpeles added the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jun 3, 2026
@github-actions github-actions Bot removed the Needs: Submitter Input Waiting on input from the creator of the issue/pr [managed] label Jun 3, 2026
@mekarpeles mekarpeles merged commit bc7b594 into internetarchive:master Jun 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Priority: 2 Important, as time permits. [managed]

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Save/preserve patron's registration action post-registration

3 participants