Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/idv/capture_doc_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/doc_auth_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/inherited_proofing_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions app/services/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Contributor Author

Choose a reason for hiding this comment

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

LOL... so much more than "visited" or "submitted" were added to these 😭

end
160 changes: 160 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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)
Expand Down
47 changes: 22 additions & 25 deletions app/services/flow/flow_state_machine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
4 changes: 4 additions & 0 deletions app/services/idv/actions/cancel_link_sent_action.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/services/idv/actions/cancel_send_link_action.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/services/idv/actions/cancel_update_ssn_action.rb
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 4 additions & 0 deletions app/services/idv/actions/in_person/redo_address_action.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Loading