diff --git a/lib/reporting/drop_off_report.rb b/lib/reporting/drop_off_report.rb index 34ad179b546..b95b59393db 100644 --- a/lib/reporting/drop_off_report.rb +++ b/lib/reporting/drop_off_report.rb @@ -388,6 +388,11 @@ def query name , properties.user_id AS user_id , coalesce(properties.event_properties.success, 0) AS success + , coalesce(properties.event_properties.fraud_review_pending, 0) AS fraud_review_pending + , coalesce(properties.event_properties.gpo_verification_pending, 0) AS gpo_verification_pending + , coalesce(properties.event_properties.in_person_verification_pending, 0) AS in_person_verification_pending + , ispresent(properties.event_properties.deactivation_reason) AS has_other_deactivation_reason + , !fraud_review_pending and !gpo_verification_pending and !in_person_verification_pending and !has_other_deactivation_reason AS identity_verified #{issuers.present? ? '| filter properties.service_provider IN %{issuers}' : ''} | filter name in %{event_names} | limit 10000 @@ -403,9 +408,10 @@ def data end fetch_results.each do |row| - event_users[row['name']] << row['user_id'] - event = row['name'] + user_id = row['user_id'] + event_users[event] << user_id + case event when Events::IDV_FINAL_RESOLUTION if row['identity_verified'] == '1' diff --git a/spec/lib/reporting/drop_off_report_spec.rb b/spec/lib/reporting/drop_off_report_spec.rb index 7486b6544c9..b5e6ad5b62a 100644 --- a/spec/lib/reporting/drop_off_report_spec.rb +++ b/spec/lib/reporting/drop_off_report_spec.rb @@ -23,6 +23,7 @@ { 'user_id' => 'user1', 'name' => 'idv_enter_password_visited' }, { 'user_id' => 'user1', 'name' => 'idv_enter_password_submitted' }, { 'user_id' => 'user1', 'name' => 'IdV: personal key submitted' }, + { 'user_id' => 'user1', 'identity_verified' => '1', 'name' => 'IdV: final resolution' }, # gets through phone finder, then drops { 'user_id' => 'user2', 'name' => 'IdV: doc auth welcome visited' }, @@ -50,6 +51,54 @@ # bails after viewing the user agreement { 'user_id' => 'user5', 'name' => 'IdV: doc auth welcome visited' }, { 'user_id' => 'user5', 'name' => 'IdV: doc auth welcome submitted' }, + + # finishes funnel but has to wait for GPO letter + { 'user_id' => 'user6', 'name' => 'IdV: doc auth welcome visited' }, + { 'user_id' => 'user6', 'name' => 'IdV: doc auth welcome submitted' }, + { 'user_id' => 'user6', 'name' => 'IdV: doc auth image upload vendor submitted' }, + { 'user_id' => 'user6', 'name' => 'IdV: doc auth document_capture visited' }, + { 'user_id' => 'user6', 'name' => 'IdV: doc auth ssn visited' }, + { 'user_id' => 'user6', 'name' => 'IdV: doc auth verify visited' }, + { 'user_id' => 'user6', 'name' => 'IdV: doc auth verify submitted' }, + { 'user_id' => 'user6', + 'gpo_verification_pending' => '1', + 'name' => 'IdV: phone of record visited' }, + { 'user_id' => 'user6', 'name' => 'idv_enter_password_visited' }, + { 'user_id' => 'user6', 'name' => 'idv_enter_password_submitted' }, + { 'user_id' => 'user6', 'name' => 'IdV: personal key submitted' }, + { 'user_id' => 'user6', 'identity_verified' => '0', 'name' => 'IdV: final resolution' }, + + # finishes funnel but has to wait for IPP + { 'user_id' => 'user7', 'name' => 'IdV: doc auth welcome visited' }, + { 'user_id' => 'user7', 'name' => 'IdV: doc auth welcome submitted' }, + { 'user_id' => 'user7', 'name' => 'IdV: doc auth image upload vendor submitted' }, + { 'user_id' => 'user7', 'name' => 'IdV: doc auth document_capture visited' }, + { 'user_id' => 'user7', 'name' => 'IdV: doc auth ssn visited' }, + { 'user_id' => 'user7', 'name' => 'IdV: doc auth verify visited' }, + { 'user_id' => 'user7', + 'in_person_verification_pending' => '1', + 'name' => 'IdV: doc auth verify submitted' }, + { 'user_id' => 'user7', 'name' => 'IdV: phone of record visited' }, + { 'user_id' => 'user7', 'name' => 'idv_enter_password_visited' }, + { 'user_id' => 'user7', 'name' => 'idv_enter_password_submitted' }, + { 'user_id' => 'user7', 'name' => 'IdV: personal key submitted' }, + { 'user_id' => 'user7', 'name' => 'IdV: final resolution' }, + + # finishes funnel but has to wait for fraud review + { 'user_id' => 'user8', 'name' => 'IdV: doc auth welcome visited' }, + { 'user_id' => 'user8', 'name' => 'IdV: doc auth welcome submitted' }, + { 'user_id' => 'user8', 'name' => 'IdV: doc auth image upload vendor submitted' }, + { 'user_id' => 'user8', 'name' => 'IdV: doc auth document_capture visited' }, + { 'user_id' => 'user8', 'name' => 'IdV: doc auth ssn visited' }, + { 'user_id' => 'user8', 'name' => 'IdV: doc auth verify visited' }, + { 'user_id' => 'user8', + 'fraud_review_pending' => '1', + 'name' => 'IdV: doc auth verify submitted' }, + { 'user_id' => 'user8', 'name' => 'IdV: phone of record visited' }, + { 'user_id' => 'user8', 'name' => 'idv_enter_password_visited' }, + { 'user_id' => 'user8', 'name' => 'idv_enter_password_submitted' }, + { 'user_id' => 'user8', 'name' => 'IdV: personal key submitted' }, + { 'user_id' => 'user8', 'name' => 'IdV: final resolution' }, ], ) @@ -144,18 +193,18 @@ def expected_tables(strings: false) [ ['Step', 'Unique user count', 'Users lost', 'Dropoff from last step', 'Users left from start'], - ['Welcome (page viewed)'] + string_or_num(strings, 5), - ['User agreement (page viewed)'] + string_or_num(strings, 5, 0, 0.0, 1.0), - ['Capture Document (page viewed)'] + string_or_num(strings, 4, 1, 0.2, 0.8), - ['Document submitted (event)'] + string_or_num(strings, 4, 0, 0.0, 0.8), - ['SSN (page view)'] + string_or_num(strings, 3, 1, 0.25, 0.6), - ['Verify Info (page view)'] + string_or_num(strings, 2, 1, 0.3333333333333333, 0.4), - ['Verify submit (event)'] + string_or_num(strings, 2, 0, 0.0, 0.4), - ['Phone finder (page view)'] + string_or_num(strings, 2, 0, 0.0, 0.4), - ['Encrypt account: enter password (page view)'] + string_or_num(strings, 1, 1, 0.5, 0.2), - ['Personal key input (page view)'] + string_or_num(strings, 1, 0, 0.0, 0.2), - ['Verified (event)'] + string_or_num(strings, 1, 0, 0.0, 0.2), - ['Workflow Complete - Total Pending'] + string_or_num(strings, 0), + ['Welcome (page viewed)'] + string_or_num(strings, 8), + ['User agreement (page viewed)'] + string_or_num(strings, 8, 0, 0.0, 1.0), + ['Capture Document (page viewed)'] + string_or_num(strings, 7, 1, 0.125, 0.875), + ['Document submitted (event)'] + string_or_num(strings, 7, 0, 0.0, 0.875), + ['SSN (page view)'] + string_or_num(strings, 6, 1, 1.0 / 7, 0.75), + ['Verify Info (page view)'] + string_or_num(strings, 5, 1, 1.0 / 6, 0.625), + ['Verify submit (event)'] + string_or_num(strings, 5, 0, 0.0, 0.625), + ['Phone finder (page view)'] + string_or_num(strings, 5, 0, 0.0, 0.625), + ['Encrypt account: enter password (page view)'] + string_or_num(strings, 4, 1, 0.2, 0.5), + ['Personal key input (page view)'] + string_or_num(strings, 4, 0, 0.0, 0.5), + ['Verified (event)'] + string_or_num(strings, 4, 0, 0.0, 0.5), + ['Workflow Complete - Total Pending'] + string_or_num(strings, 3), ], ] end