Skip to content

SCHOL-1152: Add TrackEvent Callback Prop - #215

Merged
nprotheroNYPL merged 7 commits into
mainfrom
SCHOL-951/trackevent-callback
Nov 5, 2026
Merged

nprotheroNYPL merged 7 commits into
mainfrom
SCHOL-951/trackevent-callback

Conversation

@nprotheroNYPL

@nprotheroNYPL nprotheroNYPL commented Nov 4, 2026 •

Copy link
Copy Markdown
Contributor

SCHOL-1152

Purpose

  • SCHOL-951 requires event tracking on webReader toolbar ui interactions, I thought that the best approach would be creating an onTrackEvent callback prop.

Changes made

  • Added a new callback prop onTrackEvent to web reader
  • Calls on every toolbar option click
  • Created unit tests for onTrackEvent prop

How to Test

  1. Build & pack this branch
npm run build
rm -f nypl-web-reader-*.tgz  # clean up old builds if exists
npm pack                     # → nypl-web-reader-5.2.2.tgz
  1. Install the tarball into the enhanced-search web app
cd ../enhanced-search/web
npm install ../../web-reader/nypl-web-reader-5.2.2.tgz
rm -rf .next
npm run dev
  1. Add this in ResearchAssistantViewer.tsx:
const handleWebReaderTrackEvent = (event: WebReaderUiEvent) => {
  console.log("web-reader onTrackEvent:", event);
};

  1. And this to <WebReader> in ResearchAssistantViewer.tsx:
onTrackEvent={handleWebReaderTrackEvent}

After testing, restore with: git checkout package.json package-lock.json && npm install.

@vercel

vercel Bot commented Nov 4, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
web-reader Ready Ready Preview Nov 4, 2026 9:13pm UTC

Request Review

@nprotheroNYPL nprotheroNYPL changed the title SCHOL-951: Add TrackEvent Callback Prop SCHOL-1152: Add TrackEvent Callback Prop Nov 4, 2026

@jackiequach jackiequach left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Works well, just a few minor comments

Comment thread src/types.ts Resolved
Comment thread src/ui/toolbar/Toolbar.tsx Resolved

@jackiequach jackiequach left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

looks good

@nprotheroNYPL
nprotheroNYPL merged commit 02de5b3 into main Nov 5, 2026
7 checks passed
@nprotheroNYPL
nprotheroNYPL deleted the SCHOL-951/trackevent-callback branch November 5, 2026 16:39

This branch was successfully deployed

1 active deployment
Preview — 6badc552 Deployed Nov 4, 2026 by vercel[bot]
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