Repository navigation
feat(analytics): send the redirect target of the login page - #609
Merged
Merged
Conversation
Add a redirect_target property to each event on / that has a redirect query, so Plausible shows which page a signed-out visitor tried to open.
|
✅ No security or compliance issues detected. Reviewed everything up to b9c9b75. Security OverviewDetected Code Changes
|
📊 Build Bundle StatsThe latest build generated the following assets: 🚦 Startup JS budget✅ The startup JS is 478,642 bytes gzip. The budget is 480,000. 27 startup files
|
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
The redirect-target regex exposes alphabetic principal IDs in analytics because it accepts arbitrary lowercase and hyphenated path segments instead of restricting them to known static routes.
1 open issue
What changed in this PR
Adds redirect-target tracking to login-page analytics so Plausible can show which pages signed-out visitors intended to open.
Changes:
- Adds
redirect_targetto login-page events, grouping proposal URLs and masking unsupported path forms. - Extracts the target before removing URL query parameters.
- Adds helper tests and coverage for pageviews, login success, and outbound clicks.
| File | Description |
|---|---|
src/governance-app-frontend/src/features/analytics/transformRequest.ts |
Adds redirect-target extraction and path normalization. |
src/governance-app-frontend/src/features/analytics/transformRequest.spec.ts |
Tests target grouping, filtering, and property preservation. |
src/governance-app-frontend/src/features/analytics/service.ts |
Applies redirect tracking before URL cleanup. |
src/governance-app-frontend/src/features/analytics/service.spec.ts |
Tests redirect properties across login-page event types. |
Review effort: Balanced
A path such as /accounts/<principal> has no digits, so the pattern let a principal through. Report any path that is not an app page as other.
yhabib
enabled auto-merge
November 16, 2026 07:12
artkorotkikh-dfinity
approved these changes
Nov 16, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Motivation
From 2 to 15 Nov, 2,465 of 8,662 login page visits (28%) never signed in. Plausible cannot tell which page these visitors tried to open.
requireIdentitysends them to/?redirect=<path>before the tracker starts, andremoveUrlParamsdrops the query.Changes
addRedirectTarget, which sets aredirect_targetproperty on each event on/that has aredirectquery./voting/proposals/:idand reported paths with any other form asother, so no ID reaches Plausible.transformRequestbeforeremoveUrlParams.login_success, and outbound click on the login page.