Kmas lg 10488 add missing analytics#8940
Conversation
aduth
left a comment
There was a problem hiding this comment.
Can we add some test coverage for places where we're expecting analytics to be logged?
|
|
||
| def edit; end | ||
| def edit | ||
| analytics.backup_code_regenerate_visit |
There was a problem hiding this comment.
This screen can be visited in the account creation flow. Per the AC of the ticket, can we ensure that we have a way to differentiate whether the user is regenerating backup codes from the account dashboard vs. account creation?
Account Creation:
- Go to http://localhost:3000
- Click Create an account
- Create an account up to MFA selection
- Choose Backup codes
- Continue up to "You’ve added your first authentication method!" screen
- Click "Skip for now"
- Click "I need new backup codes"
- This event would be logged, and I should be able to query distinct from existing account
Existing Account:
- Go to http://localhost:3000
- Sign in with an existing account
- From the account dashboard, click "Get backup codes"
- This event would be logged, and I should be able to query distinct from account creation
There was a problem hiding this comment.
That should now be attached to the event by way of
{"event_properties":{"request_came_from":"accounts#show"}...}
{"event_properties":{"request_came_from":"users/backup_code_setup#confirm_backup_codes"}
aduth
left a comment
There was a problem hiding this comment.
Couple minor notes, but overall LGTM
|
|
||
| private | ||
|
|
||
| def properties |
There was a problem hiding this comment.
Can we prefix this with analytics_ to be clear that these values are related to analytics? Also for consistency with how similar methods are named elsewhere (though there's a fair bit of existing inconsistency between calling it analytics_arguments vs. analytics_properties 😅 ).
| end | ||
|
|
||
| # Tracks when the user visits the Backup Code Regenerate page. | ||
| def backup_code_regenerate_visit(**properties) |
There was a problem hiding this comment.
Can we list out the specific properties we're expecting here, and document them in the method (YARD) documentation? So that it's clear what it's logging and can be included in the handbook analytics events documentation.
| def backup_code_regenerate_visit(**properties) | |
| # @param [String] request_came_from the controller/action the request came from | |
| def backup_code_regenerate_visit(request_came_from:, **extra) |
| get :edit | ||
| expect(@analytics).to have_logged_event( | ||
| 'Backup Code Regenerate Visited', | ||
| hash_including(request_came_from: anything), |
There was a problem hiding this comment.
Can we have a real string here rather than anything ? I'd only expect to see anything if the value was rather unpredictable.
🎫 Ticket
LG-10488
🛠 Summary of changes
Added analytics methods for when a user visits Add Email Address, Edit Password, and Regenerate Backup Codes pages
📜 Testing Plan
Provide a checklist of steps to confirm the changes.