diff --git a/app/controllers/idv/capture_doc_controller.rb b/app/controllers/idv/capture_doc_controller.rb index 0fd1efca22d..700787c90b3 100644 --- a/app/controllers/idv/capture_doc_controller.rb +++ b/app/controllers/idv/capture_doc_controller.rb @@ -15,7 +15,7 @@ class CaptureDocController < ApplicationController step_url: :idv_capture_doc_step_url, final_url: :root_url, flow: Idv::Flows::CaptureDocFlow, - analytics_id: Analytics::DOC_AUTH, + analytics_id: 'Doc Auth', }.freeze def return_to_sp diff --git a/app/controllers/idv/doc_auth_controller.rb b/app/controllers/idv/doc_auth_controller.rb index 7d225b4ab30..a97513c1d38 100644 --- a/app/controllers/idv/doc_auth_controller.rb +++ b/app/controllers/idv/doc_auth_controller.rb @@ -23,7 +23,7 @@ class DocAuthController < ApplicationController step_url: :idv_doc_auth_step_url, final_url: :idv_review_url, flow: Idv::Flows::DocAuthFlow, - analytics_id: Analytics::DOC_AUTH, + analytics_id: 'Doc Auth', }.freeze def return_to_sp diff --git a/app/controllers/idv/inherited_proofing_controller.rb b/app/controllers/idv/inherited_proofing_controller.rb index e16d55545f9..ce4b3235f60 100644 --- a/app/controllers/idv/inherited_proofing_controller.rb +++ b/app/controllers/idv/inherited_proofing_controller.rb @@ -11,7 +11,7 @@ class InheritedProofingController < ApplicationController step_url: :idv_inherited_proofing_step_url, final_url: :idv_phone_url, flow: Idv::Flows::InheritedProofingFlow, - analytics_id: nil, + analytics_id: 'Inherited Proofing', }.freeze def return_to_sp diff --git a/app/services/analytics.rb b/app/services/analytics.rb index fee5bf48573..394206f9c47 100644 --- a/app/services/analytics.rb +++ b/app/services/analytics.rb @@ -135,6 +135,4 @@ def session_started_at return value unless value.is_a?(String) Time.zone.parse(value) end - - DOC_AUTH = 'Doc Auth' # visited or submitted is appended end diff --git a/app/services/analytics_events.rb b/app/services/analytics_events.rb index 3e1935e0bae..56c48199235 100644 --- a/app/services/analytics_events.rb +++ b/app/services/analytics_events.rb @@ -565,6 +565,22 @@ def idv_verify_in_person_troubleshooting_option_clicked(flow_path:, **extra) ) end + def idv_inherited_proofing_agreement_submitted(**extra) + track_event('Idv: inherited proofing agreement submitted', **extra) + end + + def idv_inherited_proofing_agreement_visited(**extra) + track_event('Idv: inherited proofing agreement visited', **extra) + end + + def idv_inherited_proofing_get_started_submitted(**extra) + track_event('Idv: inherited proofing get_started submitted', **extra) + end + + def idv_inherited_proofing_get_started_visited(**extra) + track_event('Idv: inherited proofing get_started visited', **extra) + end + # @param [String] flow_path Document capture path ("hybrid" or "standard") # The user visited the in person proofing location step def idv_in_person_location_visited(flow_path:, **extra) @@ -595,6 +611,34 @@ def idv_in_person_prepare_submitted(flow_path:, **extra) track_event('IdV: in person proofing prepare submitted', flow_path: flow_path, **extra) end + def idv_in_person_proofing_address_submitted(**extra) + track_event('IdV: in person proofing address submitted', **extra) + end + + def idv_in_person_proofing_address_visited(**extra) + track_event('IdV: in person proofing address visited', **extra) + end + + def idv_in_person_proofing_cancel_update_address(**extra) + track_event('IdV: in person proofing cancel_update_address submitted', **extra) + end + + def idv_in_person_proofing_cancel_update_state_id(**extra) + track_event('IdV: in person proofing cancel_update_state_id submitted', **extra) + end + + def idv_in_person_proofing_redo_state_id_submitted(**extra) + track_event('IdV: in person proofing redo_state_id submitted', **extra) + end + + def idv_in_person_proofing_state_id_submitted(**extra) + track_event('IdV: in person proofing state_id submitted', **extra) + end + + def idv_in_person_proofing_state_id_visited(**extra) + track_event('IdV: in person proofing state_id visited', **extra) + end + # @param [String] flow_path Document capture path ("hybrid" or "standard") # The user visited the in person proofing switch_back step def idv_in_person_switch_back_visited(flow_path:, **extra) @@ -617,6 +661,43 @@ def idv_in_person_ready_to_verify_visit(proofing_components: nil, **extra) ) end + def idv_doc_auth_agreement_submitted(**extra) + track_event('IdV: doc auth agreement submitted', **extra) + end + + def idv_doc_auth_agreement_visited(**extra) + track_event('IdV: doc auth agreement visited', **extra) + end + + def idv_doc_auth_cancel_link_sent_submitted(**extra) + track_event('IdV: doc auth cancel_link_sent submitted', **extra) + end + + def idv_doc_auth_cancel_send_link_submitted(**extra) + track_event('IdV: doc auth cancel_send_link submitted', **extra) + end + + # @identity.idp.previous_event_name IdV: in person proofing cancel_update_ssn submitted + def idv_doc_auth_cancel_update_ssn_submitted(**extra) + track_event('IdV: doc auth cancel_update_ssn submitted', **extra) + end + + def idv_doc_auth_capture_complete_visited(**extra) + track_event('IdV: doc auth capture_complete visited', **extra) + end + + def idv_doc_auth_document_capture_visited(**extra) + track_event('IdV: doc auth document_capture visited', **extra) + end + + def idv_doc_auth_document_capture_submitted(**extra) + track_event('IdV: doc auth document_capture submitted', **extra) + end + + def idv_doc_auth_email_sent_visited(**extra) + track_event('IdV: doc auth email_sent visited', **extra) + end + # @param [String] step_name which step the user was on # @param [Integer] remaining_attempts how many attempts the user has left before we throttle them # The user visited an error page due to an encountering an exception talking to a proofing vendor @@ -629,6 +710,50 @@ def idv_doc_auth_exception_visited(step_name:, remaining_attempts:, **extra) ) end + def idv_doc_auth_link_sent_submitted(**extra) + track_event('IdV: doc auth send_link submitted', **extra) + end + + def idv_doc_auth_link_sent_visited(**extra) + track_event('IdV: doc auth link_sent visited', **extra) + end + + # @identity.idp.previous_event_name IdV: in person proofing optional verify_wait submitted + def idv_doc_auth_optional_verify_wait_submitted(**extra) + track_event('IdV: doc auth optional verify_wait submitted', **extra) + end + + def idv_doc_auth_redo_document_capture_submitted(**extra) + track_event('IdV: doc auth redo_document_capture submitted', **extra) + end + + def idv_doc_auth_send_link_visited(**extra) + track_event('IdV: doc auth send_link visited', **extra) + end + + def idv_doc_auth_send_link_submitted(**extra) + track_event('IdV: doc auth send_link submitted', **extra) + end + + # @identity.idp.previous_event_name IdV: in person proofing ssn submitted + def idv_doc_auth_ssn_submitted(**extra) + track_event('IdV: doc auth ssn submitted', **extra) + end + + # @identity.idp.previous_event_name IdV: in person proofing ssn visited + def idv_doc_auth_ssn_visited(**extra) + track_event('IdV: doc auth ssn visited', **extra) + end + + # @identity.idp.previous_event_name IdV: in person proofing redo_address submitted + def idv_doc_auth_redo_address_submitted(**extra) + track_event('IdV: doc auth redo_address submitted', **extra) + end + + def idv_doc_auth_redo_ssn_submitted(**extra) + track_event('IdV: doc auth redo_ssn submitted', **extra) + end + # @param [Boolean] success # @param [Hash] errors # @param [Integer] attempts @@ -737,6 +862,33 @@ def idv_doc_auth_submitted_pii_validation( ) end + def idv_doc_auth_upload_submitted(**extra) + track_event('IdV: doc auth upload submitted', **extra) + end + + def idv_doc_auth_upload_visited(**extra) + track_event('IdV: doc auth upload visited', **extra) + end + + def idv_doc_auth_verify_document_status_submitted(**extra) + track_event('IdV: doc auth verify_document_status submitted', **extra) + end + + # @identity.idp.previous_event_name IdV: in person proofing verify submitted + def idv_doc_auth_verify_submitted(**extra) + track_event('IdV: doc auth verify submitted', **extra) + end + + # @identity.idp.previous_event_name IdV: in person proofing verify visited + def idv_doc_auth_verify_visited(**extra) + track_event('IdV: doc auth verify visited', **extra) + end + + # @identity.idp.previous_event_name IdV: in person proofing verify_wait visited + def idv_doc_auth_verify_wait_step_visited(**extra) + track_event('IdV: doc auth verify_wait visited', **extra) + end + # @param [String] step_name # @param [Integer] remaining_attempts # The user was sent to a warning page during the IDV flow @@ -753,6 +905,14 @@ def idv_doc_auth_warning_visited( ) end + def idv_doc_auth_welcome_submitted(**extra) + track_event('IdV: doc auth welcome submitted', **extra) + end + + def idv_doc_auth_welcome_visited(**extra) + track_event('IdV: doc auth welcome visited', **extra) + end + # @param [Idv::ProofingComponentsLogging] proofing_components User's current proofing components # User visited forgot password page def idv_forgot_password(proofing_components: nil, **extra) diff --git a/app/services/flow/flow_state_machine.rb b/app/services/flow/flow_state_machine.rb index 256fcc1adf1..cc0e06f7c14 100644 --- a/app/services/flow/flow_state_machine.rb +++ b/app/services/flow/flow_state_machine.rb @@ -21,10 +21,12 @@ def show def update step = current_step result = flow.handle(step) - if @analytics_id - increment_step_name_counts - analytics.track_event(analytics_submitted, result.to_h.merge(analytics_properties)) - end + + increment_step_name_counts + analytics.public_send( + flow.step_handler(step).analytics_submitted_event, + **result.to_h.merge(analytics_properties), + ) register_update_step(step, result) if flow.json @@ -46,10 +48,12 @@ def current_step end def track_step_visited - if @analytics_id - increment_step_name_counts - analytics.track_event(analytics_visited, analytics_properties) - end + increment_step_name_counts + analytics.public_send( + flow.step_handler(current_step).analytics_visited_event, + **analytics_properties, + ) + Funnel::DocAuth::RegisterStep.new(user_id, issuer).call(current_step, :view, true) end @@ -121,12 +125,16 @@ def call_optional_show_step(optional_step) return unless optional_show_step result = optional_show_step.new(@flow).base_call - if @analytics_id - optional_show_step_name = optional_show_step.to_s.demodulize.underscore - optional_properties = result.to_h.merge(step: optional_show_step_name) + optional_show_step_name = optional_show_step.to_s.demodulize.underscore + optional_properties = result.to_h.merge( + step: optional_show_step_name, + analytics_id: @analytics_id, + ) - analytics.track_event(analytics_optional_step, optional_properties) - end + analytics.public_send( + optional_show_step.analytics_optional_step_event, + **optional_properties, + ) if next_step.to_s != optional_step if next_step_is_url @@ -162,23 +170,12 @@ def redirect_to_step(step) redirect_to send(@step_url, step: step) end - def analytics_submitted - 'IdV: ' + "#{@analytics_id} #{current_step} submitted".downcase - end - - def analytics_visited - 'IdV: ' + "#{@analytics_id} #{current_step} visited".downcase - end - - def analytics_optional_step - 'IdV: ' + "#{@analytics_id} optional #{current_step} submitted".downcase - end - def analytics_properties { flow_path: @flow.flow_path, step: current_step, step_count: current_flow_step_counts[current_step_name], + analytics_id: @analytics_id, } end diff --git a/app/services/idv/actions/cancel_link_sent_action.rb b/app/services/idv/actions/cancel_link_sent_action.rb index b8ebc0b2e93..5d5d51d8bca 100644 --- a/app/services/idv/actions/cancel_link_sent_action.rb +++ b/app/services/idv/actions/cancel_link_sent_action.rb @@ -1,6 +1,10 @@ module Idv module Actions class CancelLinkSentAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_doc_auth_cancel_link_sent_submitted + end + def call mark_step_incomplete(:send_link) end diff --git a/app/services/idv/actions/cancel_send_link_action.rb b/app/services/idv/actions/cancel_send_link_action.rb index 8d9fe50ce29..1bf64fefef9 100644 --- a/app/services/idv/actions/cancel_send_link_action.rb +++ b/app/services/idv/actions/cancel_send_link_action.rb @@ -1,6 +1,10 @@ module Idv module Actions class CancelSendLinkAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_doc_auth_cancel_send_link_submitted + end + def call mark_step_incomplete(:upload) end diff --git a/app/services/idv/actions/cancel_update_ssn_action.rb b/app/services/idv/actions/cancel_update_ssn_action.rb index 06341459f09..d8b7b52b82d 100644 --- a/app/services/idv/actions/cancel_update_ssn_action.rb +++ b/app/services/idv/actions/cancel_update_ssn_action.rb @@ -1,6 +1,10 @@ module Idv module Actions class CancelUpdateSsnAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_doc_auth_cancel_update_ssn_submitted + end + def call mark_step_complete(:ssn) if flow_session.dig(:pii_from_doc, :ssn) end diff --git a/app/services/idv/actions/in_person/cancel_update_address_action.rb b/app/services/idv/actions/in_person/cancel_update_address_action.rb index 5732f833814..bbb687dee38 100644 --- a/app/services/idv/actions/in_person/cancel_update_address_action.rb +++ b/app/services/idv/actions/in_person/cancel_update_address_action.rb @@ -2,6 +2,10 @@ module Idv module Actions module InPerson class CancelUpdateAddressAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_in_person_proofing_cancel_update_address + end + def call mark_step_complete(:address) if flow_session.dig(:pii_from_user, :address1) end diff --git a/app/services/idv/actions/in_person/cancel_update_ssn_action.rb b/app/services/idv/actions/in_person/cancel_update_ssn_action.rb index c2219ae47af..b4320ca4ee0 100644 --- a/app/services/idv/actions/in_person/cancel_update_ssn_action.rb +++ b/app/services/idv/actions/in_person/cancel_update_ssn_action.rb @@ -2,6 +2,10 @@ module Idv module Actions module InPerson class CancelUpdateSsnAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_doc_auth_cancel_update_ssn_submitted + end + def call mark_step_complete(:ssn) if flow_session.dig(:pii_from_user, :ssn) end diff --git a/app/services/idv/actions/in_person/cancel_update_state_id_action.rb b/app/services/idv/actions/in_person/cancel_update_state_id_action.rb index a98a6a37ef7..5ec79a7b0f1 100644 --- a/app/services/idv/actions/in_person/cancel_update_state_id_action.rb +++ b/app/services/idv/actions/in_person/cancel_update_state_id_action.rb @@ -2,6 +2,10 @@ module Idv module Actions module InPerson class CancelUpdateStateIdAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_in_person_proofing_cancel_update_state_id + end + def call mark_step_complete(:state_id) if flow_session.dig(:pii_from_user, :first_name) end diff --git a/app/services/idv/actions/in_person/redo_address_action.rb b/app/services/idv/actions/in_person/redo_address_action.rb index d37321e4f98..dc88870c023 100644 --- a/app/services/idv/actions/in_person/redo_address_action.rb +++ b/app/services/idv/actions/in_person/redo_address_action.rb @@ -2,6 +2,10 @@ module Idv module Actions module InPerson class RedoAddressAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_doc_auth_redo_address_submitted + end + def call mark_step_incomplete(:address) end diff --git a/app/services/idv/actions/in_person/redo_state_id_action.rb b/app/services/idv/actions/in_person/redo_state_id_action.rb index dba901b8211..dd7025865e7 100644 --- a/app/services/idv/actions/in_person/redo_state_id_action.rb +++ b/app/services/idv/actions/in_person/redo_state_id_action.rb @@ -2,6 +2,10 @@ module Idv module Actions module InPerson class RedoStateIdAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_in_person_proofing_redo_state_id_submitted + end + def call mark_step_incomplete(:state_id) end diff --git a/app/services/idv/actions/redo_address_action.rb b/app/services/idv/actions/redo_address_action.rb index a67f6c29ecd..ce9b404cc8b 100644 --- a/app/services/idv/actions/redo_address_action.rb +++ b/app/services/idv/actions/redo_address_action.rb @@ -1,6 +1,10 @@ module Idv module Actions class RedoAddressAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_doc_auth_redo_address_submitted + end + def call redirect_to idv_address_url end diff --git a/app/services/idv/actions/redo_document_capture_action.rb b/app/services/idv/actions/redo_document_capture_action.rb index 0b86b50b4ff..2e0fa2a7fd9 100644 --- a/app/services/idv/actions/redo_document_capture_action.rb +++ b/app/services/idv/actions/redo_document_capture_action.rb @@ -1,6 +1,10 @@ module Idv module Actions class RedoDocumentCaptureAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_doc_auth_redo_document_capture_submitted + end + def call mark_step_incomplete(:document_capture) unless flow_session[:skip_upload_step] diff --git a/app/services/idv/actions/redo_ssn_action.rb b/app/services/idv/actions/redo_ssn_action.rb index 2d85686f527..0c0f69c9db9 100644 --- a/app/services/idv/actions/redo_ssn_action.rb +++ b/app/services/idv/actions/redo_ssn_action.rb @@ -1,6 +1,10 @@ module Idv module Actions class RedoSsnAction < Idv::Steps::DocAuthBaseStep + def self.analytics_submitted_event + :idv_doc_auth_redo_ssn_submitted + end + def call mark_step_incomplete(:ssn) end diff --git a/app/services/idv/actions/verify_document_status_action.rb b/app/services/idv/actions/verify_document_status_action.rb index 83f45c80ebc..0acc60cc377 100644 --- a/app/services/idv/actions/verify_document_status_action.rb +++ b/app/services/idv/actions/verify_document_status_action.rb @@ -5,6 +5,10 @@ def call process_async_state(async_state) end + def self.analytics_submitted_event + :idv_doc_auth_verify_document_status_submitted + end + private def process_async_state(current_async_state) diff --git a/app/services/idv/steps/agreement_step.rb b/app/services/idv/steps/agreement_step.rb index f65657dd5cf..44171846b07 100644 --- a/app/services/idv/steps/agreement_step.rb +++ b/app/services/idv/steps/agreement_step.rb @@ -3,6 +3,14 @@ module Steps class AgreementStep < DocAuthBaseStep STEP_INDICATOR_STEP = :getting_started + def self.analytics_visited_event + :idv_doc_auth_agreement_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_agreement_submitted + end + def call end diff --git a/app/services/idv/steps/capture_complete_step.rb b/app/services/idv/steps/capture_complete_step.rb index b6fb435cb88..b5e30cf6f6c 100644 --- a/app/services/idv/steps/capture_complete_step.rb +++ b/app/services/idv/steps/capture_complete_step.rb @@ -3,6 +3,10 @@ module Steps class CaptureCompleteStep < DocAuthBaseStep STEP_INDICATOR_STEP = :verify_id + def self.analytics_visited_event + :idv_doc_auth_capture_complete_visited + end + def call; end end end diff --git a/app/services/idv/steps/document_capture_step.rb b/app/services/idv/steps/document_capture_step.rb index 35cc4de2905..12d34952bad 100644 --- a/app/services/idv/steps/document_capture_step.rb +++ b/app/services/idv/steps/document_capture_step.rb @@ -5,6 +5,14 @@ class DocumentCaptureStep < DocAuthBaseStep front_image back_image selfie_image ].freeze + def self.analytics_visited_event + :idv_doc_auth_document_capture_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_document_capture_submitted + end + def call handle_stored_result if !FeatureManagement.document_capture_async_uploads_enabled? end diff --git a/app/services/idv/steps/email_sent_step.rb b/app/services/idv/steps/email_sent_step.rb index 94a71b5b034..c5b75c8c43e 100644 --- a/app/services/idv/steps/email_sent_step.rb +++ b/app/services/idv/steps/email_sent_step.rb @@ -3,6 +3,10 @@ module Steps class EmailSentStep < DocAuthBaseStep STEP_INDICATOR_STEP = :verify_id + def self.analytics_visited_event + :idv_doc_auth_email_sent_visited + end + def call; end end end diff --git a/app/services/idv/steps/in_person/address_step.rb b/app/services/idv/steps/in_person/address_step.rb index 8a0ae5aa5d8..43c58c72e87 100644 --- a/app/services/idv/steps/in_person/address_step.rb +++ b/app/services/idv/steps/in_person/address_step.rb @@ -4,6 +4,14 @@ module InPerson class AddressStep < DocAuthBaseStep STEP_INDICATOR_STEP = :verify_info + def self.analytics_visited_event + :idv_in_person_proofing_address_visited + end + + def self.analytics_submitted_event + :idv_in_person_proofing_address_submitted + end + def call Idv::InPerson::AddressForm::ATTRIBUTES.each do |attr| flow_session[:pii_from_user][attr] = flow_params[attr] diff --git a/app/services/idv/steps/in_person/ssn_step.rb b/app/services/idv/steps/in_person/ssn_step.rb index cb2f3491032..afd168ae626 100644 --- a/app/services/idv/steps/in_person/ssn_step.rb +++ b/app/services/idv/steps/in_person/ssn_step.rb @@ -6,6 +6,14 @@ class SsnStep < DocAuthBaseStep include ThreatMetrixStepHelper + def self.analytics_visited_event + :idv_doc_auth_ssn_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_ssn_submitted + end + def call flow_session[:pii_from_user][:ssn] = ssn diff --git a/app/services/idv/steps/in_person/state_id_step.rb b/app/services/idv/steps/in_person/state_id_step.rb index c90d8383f62..3afeb3f0d4c 100644 --- a/app/services/idv/steps/in_person/state_id_step.rb +++ b/app/services/idv/steps/in_person/state_id_step.rb @@ -4,6 +4,14 @@ module InPerson class StateIdStep < DocAuthBaseStep STEP_INDICATOR_STEP = :verify_info + def self.analytics_visited_event + :idv_in_person_proofing_state_id_visited + end + + def self.analytics_submitted_event + :idv_in_person_proofing_state_id_submitted + end + def call Idv::StateIdForm::ATTRIBUTES.each do |attr| flow_session[:pii_from_user][attr] = flow_params[attr] diff --git a/app/services/idv/steps/in_person/verify_step.rb b/app/services/idv/steps/in_person/verify_step.rb index 5d5c837cc4e..3203dd4846d 100644 --- a/app/services/idv/steps/in_person/verify_step.rb +++ b/app/services/idv/steps/in_person/verify_step.rb @@ -4,6 +4,14 @@ module InPerson class VerifyStep < VerifyBaseStep STEP_INDICATOR_STEP = :verify_info + def self.analytics_visited_event + :idv_doc_auth_verify_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_verify_submitted + end + def call pii[:state_id_type] = 'drivers_license' unless invalid_state? add_proofing_component diff --git a/app/services/idv/steps/in_person/verify_wait_step.rb b/app/services/idv/steps/in_person/verify_wait_step.rb index 297ee837099..ee0ee168d54 100644 --- a/app/services/idv/steps/in_person/verify_wait_step.rb +++ b/app/services/idv/steps/in_person/verify_wait_step.rb @@ -4,6 +4,10 @@ module InPerson class VerifyWaitStep < VerifyBaseStep STEP_INDICATOR_STEP = :verify_info + def self.analytics_visited_event + :idv_doc_auth_verify_wait_step_visited + end + def call; end end end diff --git a/app/services/idv/steps/in_person/verify_wait_step_show.rb b/app/services/idv/steps/in_person/verify_wait_step_show.rb index b3ef39b7fbe..d16c14304be 100644 --- a/app/services/idv/steps/in_person/verify_wait_step_show.rb +++ b/app/services/idv/steps/in_person/verify_wait_step_show.rb @@ -4,6 +4,10 @@ module InPerson class VerifyWaitStepShow < VerifyBaseStep STEP_INDICATOR_STEP = :verify_info + def self.analytics_optional_step_event + :idv_doc_auth_optional_verify_wait_submitted + end + def call poll_with_meta_refresh(IdentityConfig.store.poll_rate_for_verify_in_seconds) diff --git a/app/services/idv/steps/inherited_proofing/agreement_step.rb b/app/services/idv/steps/inherited_proofing/agreement_step.rb index 301112f93fc..ef68102b6e6 100644 --- a/app/services/idv/steps/inherited_proofing/agreement_step.rb +++ b/app/services/idv/steps/inherited_proofing/agreement_step.rb @@ -5,6 +5,14 @@ class AgreementStep < VerifyBaseStep delegate :controller, :idv_session, to: :@flow STEP_INDICATOR_STEP = :getting_started + def self.analytics_visited_event + :idv_inherited_proofing_agreement_visited + end + + def self.analytics_submitted_event + :idv_inherited_proofing_agreement_submitted + end + def call enqueue_job end diff --git a/app/services/idv/steps/inherited_proofing/get_started_step.rb b/app/services/idv/steps/inherited_proofing/get_started_step.rb index af5c7489a2e..7afedc41f9b 100644 --- a/app/services/idv/steps/inherited_proofing/get_started_step.rb +++ b/app/services/idv/steps/inherited_proofing/get_started_step.rb @@ -4,6 +4,14 @@ module InheritedProofing class GetStartedStep < InheritedProofingBaseStep STEP_INDICATOR_STEP = :getting_started + def self.analytics_visited_event + :idv_inherited_proofing_get_started_visited + end + + def self.analytics_submitted_event + :idv_inherited_proofing_get_started_submitted + end + def call end end diff --git a/app/services/idv/steps/inherited_proofing/verify_info_step.rb b/app/services/idv/steps/inherited_proofing/verify_info_step.rb index 02ddfda63d6..b54f4e26e91 100644 --- a/app/services/idv/steps/inherited_proofing/verify_info_step.rb +++ b/app/services/idv/steps/inherited_proofing/verify_info_step.rb @@ -4,6 +4,14 @@ module InheritedProofing class VerifyInfoStep < InheritedProofingBaseStep STEP_INDICATOR_STEP = :verify_info + def self.analytics_visited_event + :idv_doc_auth_verify_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_verify_submitted + end + def call end diff --git a/app/services/idv/steps/inherited_proofing/verify_wait_step.rb b/app/services/idv/steps/inherited_proofing/verify_wait_step.rb index 3dfac80bbd4..856d20a55e7 100644 --- a/app/services/idv/steps/inherited_proofing/verify_wait_step.rb +++ b/app/services/idv/steps/inherited_proofing/verify_wait_step.rb @@ -4,6 +4,10 @@ module InheritedProofing class VerifyWaitStep < InheritedProofingBaseStep STEP_INDICATOR_STEP = :getting_started + def self.analytics_visited_event + :idv_doc_auth_verify_wait_step_visited + end + def call; end end end diff --git a/app/services/idv/steps/inherited_proofing/verify_wait_step_show.rb b/app/services/idv/steps/inherited_proofing/verify_wait_step_show.rb index 231c1e7014f..f66490c971e 100644 --- a/app/services/idv/steps/inherited_proofing/verify_wait_step_show.rb +++ b/app/services/idv/steps/inherited_proofing/verify_wait_step_show.rb @@ -8,6 +8,10 @@ class VerifyWaitStepShow < VerifyBaseStep STEP_INDICATOR_STEP = :getting_started + def self.analytics_optional_step_event + :idv_doc_auth_optional_verify_wait_submitted + end + def call poll_with_meta_refresh(IdentityConfig.store.poll_rate_for_verify_in_seconds) diff --git a/app/services/idv/steps/link_sent_step.rb b/app/services/idv/steps/link_sent_step.rb index a7b8bb3a8fa..3d93ca64799 100644 --- a/app/services/idv/steps/link_sent_step.rb +++ b/app/services/idv/steps/link_sent_step.rb @@ -5,6 +5,14 @@ class LinkSentStep < DocAuthBaseStep HYBRID_FLOW_STEPS = %i[upload send_link link_sent email_sent document_capture] + def self.analytics_visited_event + :idv_doc_auth_link_sent_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_link_sent_submitted + end + def call return render_document_capture_cancelled if document_capture_session&.cancelled_at return render_step_incomplete_error unless take_photo_with_phone_successful? diff --git a/app/services/idv/steps/send_link_step.rb b/app/services/idv/steps/send_link_step.rb index 9d2eadf42a9..2b5d2515a43 100644 --- a/app/services/idv/steps/send_link_step.rb +++ b/app/services/idv/steps/send_link_step.rb @@ -5,6 +5,14 @@ class SendLinkStep < DocAuthBaseStep STEP_INDICATOR_STEP = :verify_id + def self.analytics_visited_event + :idv_doc_auth_send_link_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_send_link_submitted + end + def call return throttled_failure if throttle.throttled_else_increment? telephony_result = send_link diff --git a/app/services/idv/steps/ssn_step.rb b/app/services/idv/steps/ssn_step.rb index 454bdd075ef..081c272a7d4 100644 --- a/app/services/idv/steps/ssn_step.rb +++ b/app/services/idv/steps/ssn_step.rb @@ -5,6 +5,14 @@ class SsnStep < DocAuthBaseStep include ThreatMetrixStepHelper + def self.analytics_visited_event + :idv_doc_auth_ssn_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_ssn_submitted + end + def call return invalid_state_response if invalid_state? diff --git a/app/services/idv/steps/upload_step.rb b/app/services/idv/steps/upload_step.rb index 039b91aebe8..938878121a8 100644 --- a/app/services/idv/steps/upload_step.rb +++ b/app/services/idv/steps/upload_step.rb @@ -3,6 +3,14 @@ module Steps class UploadStep < DocAuthBaseStep STEP_INDICATOR_STEP = :verify_id + def self.analytics_visited_event + :idv_doc_auth_upload_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_upload_submitted + end + def call @flow.irs_attempts_api_tracker.idv_document_upload_method_selected( upload_method: params[:type], diff --git a/app/services/idv/steps/verify_step.rb b/app/services/idv/steps/verify_step.rb index da16f242e65..ef3fa383bc0 100644 --- a/app/services/idv/steps/verify_step.rb +++ b/app/services/idv/steps/verify_step.rb @@ -3,6 +3,14 @@ module Steps class VerifyStep < VerifyBaseStep STEP_INDICATOR_STEP = :verify_info + def self.analytics_visited_event + :idv_doc_auth_verify_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_verify_submitted + end + def call enqueue_job end diff --git a/app/services/idv/steps/verify_wait_step.rb b/app/services/idv/steps/verify_wait_step.rb index 01068d2c3f4..ee4f43d5326 100644 --- a/app/services/idv/steps/verify_wait_step.rb +++ b/app/services/idv/steps/verify_wait_step.rb @@ -3,6 +3,10 @@ module Steps class VerifyWaitStep < VerifyBaseStep STEP_INDICATOR_STEP = :verify_info + def self.analytics_visited_event + :idv_doc_auth_verify_wait_step_visited + end + def call; end end end diff --git a/app/services/idv/steps/verify_wait_step_show.rb b/app/services/idv/steps/verify_wait_step_show.rb index 262358d5289..2292b7261d0 100644 --- a/app/services/idv/steps/verify_wait_step_show.rb +++ b/app/services/idv/steps/verify_wait_step_show.rb @@ -3,6 +3,10 @@ module Steps class VerifyWaitStepShow < VerifyBaseStep STEP_INDICATOR_STEP = :verify_info + def self.analytics_optional_step_event + :idv_doc_auth_optional_verify_wait_submitted + end + def call poll_with_meta_refresh(IdentityConfig.store.poll_rate_for_verify_in_seconds) diff --git a/app/services/idv/steps/welcome_step.rb b/app/services/idv/steps/welcome_step.rb index 92ff02bf433..1a5744a5e94 100644 --- a/app/services/idv/steps/welcome_step.rb +++ b/app/services/idv/steps/welcome_step.rb @@ -3,6 +3,14 @@ module Steps class WelcomeStep < DocAuthBaseStep STEP_INDICATOR_STEP = :getting_started + def self.analytics_visited_event + :idv_doc_auth_welcome_visited + end + + def self.analytics_submitted_event + :idv_doc_auth_welcome_submitted + end + def call return no_camera_redirect if params[:no_camera] create_document_capture_session(document_capture_session_uuid_key) diff --git a/spec/controllers/idv/capture_doc_controller_spec.rb b/spec/controllers/idv/capture_doc_controller_spec.rb index 5291b13ce4e..5605101be7b 100644 --- a/spec/controllers/idv/capture_doc_controller_spec.rb +++ b/spec/controllers/idv/capture_doc_controller_spec.rb @@ -136,14 +136,19 @@ it 'tracks expected events' do mock_next_step(:capture_complete) - result = { step: 'capture_complete', flow_path: 'hybrid', step_count: 1 } + result = { + step: 'capture_complete', + flow_path: 'hybrid', + step_count: 1, + analytics_id: 'Doc Auth', + } get :show, params: { step: 'capture_complete' } expect(@irs_attempts_api_tracker).not_to have_received(:idv_phone_upload_link_used) expect(@analytics).to have_received(:track_event).with( - 'IdV: ' + "#{Analytics::DOC_AUTH} capture_complete visited".downcase, result + 'IdV: doc auth capture_complete visited', result ) end @@ -156,11 +161,11 @@ expect(@irs_attempts_api_tracker).not_to have_received(:idv_phone_upload_link_used) expect(@analytics).to have_received(:track_event).ordered.with( - 'IdV: ' + "#{Analytics::DOC_AUTH} capture_complete visited".downcase, + 'IdV: doc auth capture_complete visited', hash_including(step: 'capture_complete', step_count: 1), ) expect(@analytics).to have_received(:track_event).ordered.with( - 'IdV: ' + "#{Analytics::DOC_AUTH} capture_complete visited".downcase, + 'IdV: doc auth capture_complete visited', hash_including(step: 'capture_complete', step_count: 2), ) end diff --git a/spec/controllers/idv/doc_auth_controller_spec.rb b/spec/controllers/idv/doc_auth_controller_spec.rb index b0ec321c482..eca13bfbc74 100644 --- a/spec/controllers/idv/doc_auth_controller_spec.rb +++ b/spec/controllers/idv/doc_auth_controller_spec.rb @@ -95,23 +95,28 @@ end it 'tracks analytics' do - result = { step: 'welcome', flow_path: 'standard', step_count: 1 } + result = { step: 'welcome', flow_path: 'standard', step_count: 1, analytics_id: 'Doc Auth' } get :show, params: { step: 'welcome' } expect(@analytics).to have_received(:track_event).with( - 'IdV: ' + "#{Analytics::DOC_AUTH} welcome visited".downcase, result + 'IdV: doc auth welcome visited', result ) end it 'tracks analytics for the optional step' do mock_next_step(:verify_wait) - result = { errors: {}, step: 'verify_wait_step_show', success: true } + result = { + errors: {}, + step: 'verify_wait_step_show', + success: true, + analytics_id: 'Doc Auth', + } get :show, params: { step: 'verify_wait' } expect(@analytics).to have_received(:track_event).with( - 'IdV: ' + "#{Analytics::DOC_AUTH} optional verify_wait submitted".downcase, result + 'IdV: doc auth optional verify_wait submitted', result ) end @@ -120,11 +125,11 @@ get :show, params: { step: 'welcome' } expect(@analytics).to have_received(:track_event).ordered.with( - 'IdV: ' + "#{Analytics::DOC_AUTH} welcome visited".downcase, + 'IdV: doc auth welcome visited', hash_including(step: 'welcome', step_count: 1), ) expect(@analytics).to have_received(:track_event).ordered.with( - 'IdV: ' + "#{Analytics::DOC_AUTH} welcome visited".downcase, + 'IdV: doc auth welcome visited', hash_including(step: 'welcome', step_count: 2), ) end @@ -160,12 +165,13 @@ flow_path: 'standard', step_count: 1, pii_like_keypaths: [[:errors, :ssn], [:error_details, :ssn]], + analytics_id: 'Doc Auth', } put :update, params: { step: 'ssn', doc_auth: { step: 'ssn', ssn: '111-11-1111' } } expect(@analytics).to have_received(:track_event).with( - 'IdV: ' + "#{Analytics::DOC_AUTH} ssn submitted".downcase, result + 'IdV: doc auth ssn submitted', result ) end @@ -178,11 +184,11 @@ put :update, params: { step: 'ssn', doc_auth: { step: 'ssn', ssn: '111-11-1111' } } expect(@analytics).to have_received(:track_event).with( - 'IdV: ' + "#{Analytics::DOC_AUTH} ssn submitted".downcase, + 'IdV: doc auth ssn submitted', hash_including(step: 'ssn', step_count: 1), ) expect(@analytics).to have_received(:track_event).with( - 'IdV: ' + "#{Analytics::DOC_AUTH} ssn submitted".downcase, + 'IdV: doc auth ssn submitted', hash_including(step: 'ssn', step_count: 2), ) end @@ -196,6 +202,7 @@ step: 'welcome', flow_path: 'standard', step_count: 1, + analytics_id: 'Doc Auth', } put :update, params: { @@ -206,7 +213,7 @@ expect(response).to redirect_to idv_doc_auth_errors_no_camera_url expect(@analytics).to have_received(:track_event).with( - 'IdV: ' + "#{Analytics::DOC_AUTH} welcome submitted".downcase, result + 'IdV: doc auth welcome submitted', result ) end @@ -382,7 +389,7 @@ ) expect(@analytics).to receive(:track_event).with( - "IdV: #{Analytics::DOC_AUTH.downcase} image upload vendor pii validation", include( + 'IdV: doc auth image upload vendor pii validation', include( errors: include( pii: [I18n.t('doc_auth.errors.general.no_liveness')], ), @@ -397,7 +404,7 @@ ) expect(@analytics).to receive(:track_event).with( - "IdV: #{Analytics::DOC_AUTH.downcase} verify_document_status submitted", include( + 'IdV: doc auth verify_document_status submitted', include( errors: include( pii: [I18n.t('doc_auth.errors.general.no_liveness')], ), diff --git a/spec/features/idv/analytics_spec.rb b/spec/features/idv/analytics_spec.rb index 8536c0351fd..043e429b030 100644 --- a/spec/features/idv/analytics_spec.rb +++ b/spec/features/idv/analytics_spec.rb @@ -108,12 +108,12 @@ 'IdV: in person proofing state_id submitted' => { success: true, flow_path: 'standard', step: 'state_id', step_count: 1 }, 'IdV: in person proofing address visited' => { step: 'address', flow_path: 'standard', step_count: 1 }, 'IdV: in person proofing address submitted' => { success: true, step: 'address', flow_path: 'standard', step_count: 1 }, - 'IdV: in person proofing ssn visited' => { step: 'ssn', flow_path: 'standard', step_count: 1 }, - 'IdV: in person proofing ssn submitted' => { success: true, step: 'ssn', flow_path: 'standard', step_count: 1 }, - 'IdV: in person proofing verify visited' => { step: 'verify', flow_path: 'standard', step_count: 1 }, - 'IdV: in person proofing verify submitted' => { success: true, step: 'verify', flow_path: 'standard', step_count: 1 }, - 'IdV: in person proofing verify_wait visited' => { flow_path: 'standard', step: 'verify_wait', step_count: 1 }, - 'IdV: in person proofing optional verify_wait submitted' => { success: true, step: 'verify_wait_step_show', address_edited: false, ssn_is_unique: true }, + 'IdV: doc auth ssn visited' => { analytics_id: 'In Person Proofing', step: 'ssn', flow_path: 'standard', step_count: 1 }, + 'IdV: doc auth ssn submitted' => { analytics_id: 'In Person Proofing', success: true, step: 'ssn', flow_path: 'standard', step_count: 1 }, + 'IdV: doc auth verify visited' => { analytics_id: 'In Person Proofing', step: 'verify', flow_path: 'standard', step_count: 1 }, + 'IdV: doc auth verify submitted' => { analytics_id: 'In Person Proofing', success: true, step: 'verify', flow_path: 'standard', step_count: 1 }, + 'IdV: doc auth verify_wait visited' => { analytics_id: 'In Person Proofing', flow_path: 'standard', step: 'verify_wait', step_count: 1 }, + 'IdV: doc auth optional verify_wait submitted' => { analytics_id: 'In Person Proofing', success: true, step: 'verify_wait_step_show', address_edited: false, ssn_is_unique: true }, 'IdV: phone of record visited' => { proofing_components: { document_check: 'usps', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis' } }, 'IdV: phone confirmation form' => { success: true, errors: {}, phone_type: :mobile, types: [:fixed_or_mobile], carrier: 'Test Mobile Carrier', country_code: 'US', area_code: '202', proofing_components: { document_check: 'usps', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis' } }, 'IdV: phone confirmation vendor' => { success: true, errors: {}, vendor: { exception: nil, vendor_name: 'AddressMock', transaction_id: 'address-mock-transaction-id-123', timed_out: false, reference: '' }, new_phone_added: false, proofing_components: { document_check: 'usps', document_type: 'state_id', source_check: 'aamva', resolution_check: 'lexis_nexis', address_check: 'lexis_nexis_address' } }, diff --git a/spec/features/idv/doc_auth/agreement_step_spec.rb b/spec/features/idv/doc_auth/agreement_step_spec.rb index 0d0f5e16cac..356ec5a8c66 100644 --- a/spec/features/idv/doc_auth/agreement_step_spec.rb +++ b/spec/features/idv/doc_auth/agreement_step_spec.rb @@ -76,10 +76,10 @@ def expect_doc_auth_first_step expect(log.upload_view_at).not_to be_nil expect(fake_analytics).to have_logged_event( - 'IdV: ' + "#{Analytics::DOC_AUTH} upload visited".downcase, step: 'upload', step_count: 1 + 'IdV: doc auth upload visited', step: 'upload', step_count: 1 ) expect(fake_analytics).to have_logged_event( - 'IdV: ' + "#{Analytics::DOC_AUTH} upload submitted".downcase, + 'IdV: doc auth upload submitted', step: 'upload', step_count: 2, success: true, ) end diff --git a/spec/features/idv/doc_auth/upload_step_spec.rb b/spec/features/idv/doc_auth/upload_step_spec.rb index 5b84e3cb39d..d311949ef01 100644 --- a/spec/features/idv/doc_auth/upload_step_spec.rb +++ b/spec/features/idv/doc_auth/upload_step_spec.rb @@ -35,7 +35,7 @@ expect(page).to have_current_path(idv_doc_auth_email_sent_step) expect(fake_analytics).to have_logged_event( - "IdV: #{Analytics::DOC_AUTH.downcase} upload submitted", + 'IdV: doc auth upload submitted', hash_including(step: 'upload', destination: :email_sent), ) end @@ -49,7 +49,7 @@ expect(page).to have_current_path(idv_doc_auth_document_capture_step) expect(fake_analytics).to have_logged_event( - "IdV: #{Analytics::DOC_AUTH.downcase} upload submitted", + 'IdV: doc auth upload submitted', hash_including(step: 'upload', destination: :document_capture), ) end @@ -74,7 +74,7 @@ expect(page).to have_current_path(idv_doc_auth_document_capture_step) expect(fake_analytics).to have_logged_event( - "IdV: #{Analytics::DOC_AUTH.downcase} upload submitted", + 'IdV: doc auth upload submitted', hash_including(step: 'upload', destination: :document_capture), ) end @@ -88,7 +88,7 @@ expect(page).to have_current_path(idv_doc_auth_send_link_step) expect(fake_analytics).to have_logged_event( - "IdV: #{Analytics::DOC_AUTH.downcase} upload submitted", + 'IdV: doc auth upload submitted', hash_including(step: 'upload', destination: :send_link), ) end diff --git a/spec/features/idv/doc_capture/document_capture_step_spec.rb b/spec/features/idv/doc_capture/document_capture_step_spec.rb index ca6db7adb82..7a732592d1a 100644 --- a/spec/features/idv/doc_capture/document_capture_step_spec.rb +++ b/spec/features/idv/doc_capture/document_capture_step_spec.rb @@ -79,7 +79,7 @@ click_idv_continue expect(page).to have_current_path(idv_doc_auth_ssn_step) expect(fake_analytics).to have_logged_event( - "IdV: #{Analytics::DOC_AUTH.downcase} document_capture submitted", + 'IdV: doc auth document_capture submitted', step: 'document_capture', flow_path: 'hybrid', ) @@ -188,10 +188,7 @@ it 'logs events as an anonymous user' do visit request_uri - expect(fake_analytics).to have_logged_event( - Analytics::DOC_AUTH, - success: false, - ) + expect(fake_analytics).to have_logged_event('Doc Auth', success: false) end end @@ -199,7 +196,7 @@ it 'logs events as the inherited user' do complete_doc_capture_steps_before_first_step(user) expect(fake_analytics).to have_logged_event( - 'IdV: ' + "#{Analytics::DOC_AUTH} document_capture visited".downcase, + 'IdV: doc auth document_capture visited', step: 'document_capture', flow_path: 'hybrid', )