Skip to content

LG-11631: Add front end logging for selfie capture#9795

Merged
night-jellyfish merged 9 commits intomainfrom
lg-11631-add-fe-logging-for-selfie-capture
Dec 20, 2023
Merged

LG-11631: Add front end logging for selfie capture#9795
night-jellyfish merged 9 commits intomainfrom
lg-11631-add-fe-logging-for-selfie-capture

Conversation

@night-jellyfish
Copy link
Contributor

🎫 Ticket

LG-11631

🛠 Summary of changes

This PR adds 5 logging events:

  1. idv_sdk_selfie_image_capture_opened (mobile only - logs when a user opens the SDK for selfie capture)
  2. idv_sdk_selfie_image_capture_closed_without_photo (mobile only - logs when a user starts to take a selfie with the SDK but exits out without adding one)
  3. idv_sdk_selfie_image_capture_failed (mobile only - logs when an error happens in the process of adding the selfie via the SDK)
  4. idv_sdk_selfie_image_added (mobile only - logs when a user uses the SDK to click the green checkmark and accept their selfie)
  5. idv_selfie_image_file_uploaded (desktop only - logs when a user uses the file picker instead of the SDK to add a selfie)

📜 Testing Plan

  • As noted above, you'll have to follow the mobile setup instructions to test 4/5 of the events
  • In your application.yml, set doc_auth_selfie_capture_enabled: true
  • Run make watch_events (or, look at log/events.log)
  • Follow through the flow to the document capture page
  • Trigger the events above by taking the actions noted above and make sure they come through the make watch_events stream

Co-authored-by: Charles Ferguson charles.ferguson@gsa.gov

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wasn't sure if it would be better to only list this comment once and write something like see test for "OnSelfieCaptureOpen" above for more info. But I thought if the code changed, we could easily lose the main comment, while still referencing it in other comments, so I thought in this case it was better to leave it repeated.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I agree with your concern about the code changing and causing see test for "OnSelfieCaptureOpen" above for more info to lose its meaning. I'm good with the repeat.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This test, as it stands, can only test the desktop flow and cannot test SDK interaction. We don't seem to have a way to test / mock SDK interaction on the back end (and as I found, other "SDK-only" events like Acuant SDK loaded were not found in this file). This prevents us from testing the whole flow from front --> back. I plan to make a ticket for this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@night-jellyfish night-jellyfish requested review from a team and dawei-nava and removed request for a team December 19, 2023 01:53
Brittany Greaner and others added 8 commits December 19, 2023 11:32
We may eventually want to send more metadata of the selfie image as
well, but it is not currently available. So sending the metadata was
determined out of scope, and looked at in future work.

Co-authored-by: Charles Ferguson <charles.ferguson@gsa.gov>
- idv_sdk_selfie_image_capture_closed_without_photo
- idv_sdk_selfie_image_capture_failed
- idv_sdk_selfie_image_capture_opened
This event will only fire on selfie image upload, not on SDK
interaction.

For the metadata coming through on the event, I mostly modeled the data
I saw coming through for the front and back doc auth images, and then
removed some items that I didn't see data coming through for.

Unsure if that was the right way to go about it.

In addition, this is the only "selfie" event we can currently test on
the backend, so that is why it's the only one included in
`analytics_spec` for now. We may add a ticket for finding ways to test
the other events on the backend, especially since we are unsure if file
upload will stay as an option for selfie.
Sometimes you don't see these until a PR is up.
@night-jellyfish night-jellyfish force-pushed the lg-11631-add-fe-logging-for-selfie-capture branch from 64d9c84 to 830a3cb Compare December 19, 2023 19:33
@dawei-nava
Copy link
Contributor

Example logs:

{
  "name": "Frontend (warning): IdV: selfie image clicked",
  "properties": {
    "event_properties": {
      "source": "button",
      "isDrop": false,
      "flow_path": "standard",
      "acuant_sdk_upgrade_a_b_testing_enabled": "false",
      "use_alternate_sdk": "false",
      "acuant_version": "11.9.1",
      "opted_in_to_in_person_proofing": "false"
    },
    "new_event": true,
    "path": "/api/logger",
    "session_duration": 214.368293,
    "user_id": "26ba4b31-ceb8-4e43-9dec-ace9331013c8",
    "locale": "en",
    "user_ip": "192.168.86.20",
    "hostname": "192.168.86.22",
    "pid": 50391,
    "service_provider": null,
    "trace_id": null,
    "git_sha": "830a3cba",
    "git_branch": "lg-11631-add-fe-logging-for-selfie-capture",
    "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
    "browser_name": "Safari",
    "browser_version": "16.6",
    "browser_platform_name": "iOS (iPhone)",
    "browser_platform_version": "16.7.2",
    "browser_device_name": "iPhone",
    "browser_mobile": true,
    "browser_bot": false
  },
  "time": "2023-12-20T14:53:04.368Z",
  "id": "05507cf0-1d9b-43e4-ae0c-385dac786eff",
  "visitor_id": "4aaef3e3-8c27-434b-b657-cb8365f2521e",
  "visit_id": "7ce570ae-0e4b-4572-9d01-7384eb2b4f60",
  "log_filename": "events.log"
}
{
  "name": "idv_sdk_selfie_image_capture_opened",
  "properties": {
    "event_properties": {},
    "new_event": true,
    "path": "/api/logger",
    "session_duration": 214.379125,
    "user_id": "26ba4b31-ceb8-4e43-9dec-ace9331013c8",
    "locale": "en",
    "user_ip": "192.168.86.20",
    "hostname": "192.168.86.22",
    "pid": 50391,
    "service_provider": null,
    "trace_id": null,
    "git_sha": "830a3cba",
    "git_branch": "lg-11631-add-fe-logging-for-selfie-capture",
    "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
    "browser_name": "Safari",
    "browser_version": "16.6",
    "browser_platform_name": "iOS (iPhone)",
    "browser_platform_version": "16.7.2",
    "browser_device_name": "iPhone",
    "browser_mobile": true,
    "browser_bot": false
  },
  "time": "2023-12-20T14:53:04.379Z",
  "id": "30170d03-2bfe-46c5-838c-6eedf944af94",
  "visitor_id": "4aaef3e3-8c27-434b-b657-cb8365f2521e",
  "visit_id": "7ce570ae-0e4b-4572-9d01-7384eb2b4f60",
  "log_filename": "events.log"
}
{
  "name": "idv_sdk_selfie_image_capture_closed_without_photo",
  "properties": {
    "event_properties": {},
    "new_event": true,
    "path": "/api/logger",
    "session_duration": 240.035688,
    "user_id": "26ba4b31-ceb8-4e43-9dec-ace9331013c8",
    "locale": "en",
    "user_ip": "192.168.86.20",
    "hostname": "192.168.86.22",
    "pid": 50391,
    "service_provider": null,
    "trace_id": null,
    "git_sha": "830a3cba",
    "git_branch": "lg-11631-add-fe-logging-for-selfie-capture",
    "user_agent": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_7_2 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
    "browser_name": "Safari",
    "browser_version": "16.6",
    "browser_platform_name": "iOS (iPhone)",
    "browser_platform_version": "16.7.2",
    "browser_device_name": "iPhone",
    "browser_mobile": true,
    "browser_bot": false
  },
  "time": "2023-12-20T14:53:30.036Z",
  "id": "4d060239-c761-42aa-aeaa-56de3ececa02",
  "visitor_id": "4aaef3e3-8c27-434b-b657-cb8365f2521e",
  "visit_id": "7ce570ae-0e4b-4572-9d01-7384eb2b4f60",
  "log_filename": "events.log"
}

Copy link
Contributor

@dawei-nava dawei-nava left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@eileen-nava eileen-nava left a comment

Choose a reason for hiding this comment

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

Approved. 👍🏻

* Failure callback
*/
onImageCaptureFailure: any;
onImageCaptureFailure: (error: { code: number; message: string }) => void;
Copy link
Contributor

Choose a reason for hiding this comment

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

🚀

Copy link
Contributor

Choose a reason for hiding this comment

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

Yeah, I agree with your concern about the code changing and causing see test for "OnSelfieCaptureOpen" above for more info to lose its meaning. I'm good with the repeat.

@night-jellyfish night-jellyfish merged commit 5a70cd1 into main Dec 20, 2023
@night-jellyfish night-jellyfish deleted the lg-11631-add-fe-logging-for-selfie-capture branch December 20, 2023 18:57
@jmdembe jmdembe mentioned this pull request Dec 21, 2023
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.

4 participants