feat: add statsd counters for signup funnel (account created + email verified, by device)#13190
Open
Sadashii wants to merge 1 commit into
Open
Conversation
Track ol.account.created and ol.account.email_verified via statsd so we can compute the signup->verification funnel rate in Grafana. Also split each counter by device type (mobile/desktop) derived from the User-Agent header, so we can see whether mobile users drop off at a higher rate than desktop users at the verification step. Counters added: ol.account.created - fires on successful IA account creation ol.account.created.mobile - same, mobile UA ol.account.created.desktop - same, desktop UA ol.account.email_verified - fires on successful email link activation ol.account.email_verified.mobile - same, mobile UA ol.account.email_verified.desktop - same, desktop UA
Sadashii
force-pushed
the
4369/feature/statsd-email-verification
branch
from
July 21, 2026 17:12
24b5792 to
6210717
Compare
Member
|
As noted in our 1:1 conversation, statsd + devices might be challenging It might make more sense to use matomo (which already has device type) The question becomes much simpler; how can we trigger a matomo event on the page or redirect triggered by the activate endpoint |
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.
Closes #
This PR adds statsd counters to measure signup funnel dropoff — specifically, how many users who create an account actually complete email verification. We also track device type (mobile vs desktop) at both steps to test a hypothesis that the link-only email verification flow causes disproportionate mobile dropoff.
Background / Hunch: When a user signs up on mobile and hasn't logged into their email client on that device, clicking a verification link opens a new browser session where they may not have context, or worse, they may have to switch apps entirely. This friction likely causes a meaningful portion of signups to bounce before verifying. Adding device-aware counters lets us validate (or disprove) this before investing in an OTP-based alternative verification flow.
Technical
Added to
openlibrary/plugins/upstream/account.py:_MOBILE_UA_RE— compiled regex to classify User-Agent as mobile or desktop (no new dependencies)get_device_label()— thin helper that readsHTTP_USER_AGENTfromweb.ctx.envCounters (via
openlibrary.core.stats.increment):ol.account.createdol.account.created.mobile/.desktopol.account.email_verifiedol.account.email_verified.mobile/.desktopIn Grafana:
email_verified / createdgives the overall funnel %. Comparing.mobilevs.desktopsub-rates will show whether mobile users are dropping off disproportionately at the verification step.Note: previously,
admin_range__membersinadmin/numbers.pycounted new accounts daily, but only post-verification (a/type/userrecord isn't created until first login after activation). There was no counter for attempted signups, so there was no way to compute a funnel rate. These counters close that gap.Testing
No new behaviour — purely additive observability. Existing tests pass unchanged.
To manually verify locally:
/account/createol.account.createdandol.account.created.{mobile,desktop}ol.account.email_verifiedandol.account.email_verified.{mobile,desktop}Screenshot
N/A — no UI changes.
Stakeholders
@mek