Skip to content
2 changes: 2 additions & 0 deletions app/controllers/frontend_log_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ class FrontendLogController < ApplicationController
'Multi-Factor Authentication: download backup code' => :multi_factor_auth_backup_code_download,
'Show Password button clicked' => :show_password_button_clicked,
'IdV: personal key acknowledgment toggled' => :idv_personal_key_acknowledgment_toggled,
'IdV: user clicked sp link on ready to verify page' => :idv_in_person_ready_to_verify_sp_link_clicked,
'IdV: user clicked what to bring link on ready to verify page' => :idv_in_person_ready_to_verify_what_to_bring_link_clicked,
}.transform_values { |method| AnalyticsEvents.instance_method(method) }.freeze
# rubocop:enable Layout/LineLength

Expand Down
16 changes: 16 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -707,6 +707,22 @@ def idv_in_person_ready_to_verify_visit(proofing_components: nil, **extra)
)
end

# The user clicked the sp link on the "ready to verify" page
def idv_in_person_ready_to_verify_sp_link_clicked(**extra)
track_event(
'IdV: user clicked sp link on ready to verify page',
**extra,
)
end

# The user clicked the what to bring link on the "ready to verify" page
def idv_in_person_ready_to_verify_what_to_bring_link_clicked(**extra)
track_event(
'IdV: user clicked what to bring link on ready to verify page',
**extra,
)
end

# User has consented to share information with document upload and may
# view the "hybrid handoff" step next unless "skip_upload" param is true
def idv_doc_auth_agreement_submitted(**extra)
Expand Down
36 changes: 20 additions & 16 deletions app/views/idv/in_person/ready_to_verify/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,18 @@

<p class="margin-top-3 margin-bottom-4">
<% if @presenter.service_provider_homepage_url.present? %>
<%= t(
'in_person_proofing.body.barcode.return_to_partner_html',
link: link_to(
t(
'in_person_proofing.body.barcode.return_to_partner_link',
sp_name: @presenter.sp_name,
<%= render ClickObserverComponent.new(event_name: 'IdV: user clicked sp link on ready to verify page') do %>
<%= t(
'in_person_proofing.body.barcode.return_to_partner_html',
link: link_to(
t(
'in_person_proofing.body.barcode.return_to_partner_link',
sp_name: @presenter.sp_name,
),
@presenter.service_provider_homepage_url,
),
@presenter.service_provider_homepage_url,
),
) %>
) %>
<% end %>
<% else %>
<%= t('in_person_proofing.body.barcode.close_window') %>
<% end %>
Expand Down Expand Up @@ -80,13 +82,15 @@
<% end %>
<p class="margin-bottom-0">
<%= t('in_person_proofing.body.barcode.questions') %>
<%= new_window_link_to(
t('in_person_proofing.body.barcode.learn_more'),
MarketingSite.help_center_article_url(
category: 'verify-your-identity',
article: 'verify-your-identity-in-person',
),
) %>
<%= render ClickObserverComponent.new(event_name: 'IdV: user clicked what to bring link on ready to verify page') do %>
<%= new_window_link_to(
t('in_person_proofing.body.barcode.learn_more'),
MarketingSite.help_center_article_url(
category: 'verify-your-identity',
article: 'verify-your-identity-in-person',
),
) %>
<% end %>
</p>
</section>

Expand Down
25 changes: 25 additions & 0 deletions spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
'IdV: personal key acknowledgment toggled' => { checked: true, proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', address_check: 'lexis_nexis_address' } },
'IdV: personal key submitted' => { proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', address_check: 'lexis_nexis_address' }, address_verification_method: 'phone', deactivation_reason: 'in_person_verification_pending' },
'IdV: in person ready to verify visited' => { proofing_components: { document_check: 'usps', source_check: 'aamva', resolution_check: 'lexis_nexis', address_check: 'lexis_nexis_address' } },
'IdV: user clicked what to bring link on ready to verify page' => {},
'IdV: user clicked sp link on ready to verify page' => {},
}
end
# rubocop:enable Layout/LineLength
Expand Down Expand Up @@ -182,21 +184,44 @@
end

context 'in person path' do
let(:return_sp_url) { 'https://example.com/some/idv/ipp/url' }

before do
allow(IdentityConfig.store).to receive(:in_person_proofing_enabled).and_return(true)
allow(Idv::InPersonConfig).to receive(:enabled_for_issuer?).and_return(true)
ServiceProvider.find_by(issuer: sp1_issuer).update(return_to_sp_url: return_sp_url)

start_idv_from_sp(:saml)
sign_in_and_2fa_user(user)
begin_in_person_proofing(user)
complete_all_in_person_proofing_steps(user)
complete_phone_step(user)
complete_review_step(user)
acknowledge_and_confirm_personal_key
visit_help_center
visit_sp
end

it 'records all of the events', allow_browser_log: true do
max_wait = Time.zone.now + 5.seconds
wait_for_event('IdV: user clicked what to bring link on ready to verify page', max_wait)
wait_for_event('IdV: user clicked sp link on ready to verify page', max_wait)
in_person_path_events.each do |event, attributes|
expect(fake_analytics).to have_logged_event(event, attributes)
end
end

# wait for event to happen
def wait_for_event(event, wait)
frequency = 0.1.seconds
loop do
expect(fake_analytics).to have_logged_event(event)
return
rescue RSpec::Expectations::ExpectationNotMetError => err
raise err if wait - Time.zone.now < frequency
sleep frequency
next
end
end
end
end
23 changes: 23 additions & 0 deletions spec/support/features/idv_step_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,29 @@ def complete_idv_steps_with_phone_before_review_step(user = user_with_2fa)
complete_phone_step(user)
end

def visit_help_center
click_what_to_bring_link
end

def click_what_to_bring_link
expect(page).to have_content(t('in_person_proofing.headings.barcode'))
click_link t('in_person_proofing.body.barcode.learn_more')
end

def visit_sp
click_sp_link
end

def click_sp_link
expect(page).to have_content(sp_text)
click_link('return to Test SP')
end

def sp_text
'You may now close this window or return to Test SP to complete any next steps' \
' you can access until your identity has been verified.'
end

def complete_review_step(user = user_with_2fa)
password = user.password || user_password
fill_in 'Password', with: password
Expand Down
1 change: 0 additions & 1 deletion spec/support/features/in_person_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ def begin_in_person_proofing(_user = nil)
complete_doc_auth_steps_before_document_capture_step
mock_doc_auth_attention_with_barcode
attach_and_submit_images

click_link t('in_person_proofing.body.cta.button')
end

Expand Down
10 changes: 10 additions & 0 deletions spec/views/idv/in_person/ready_to_verify/show.html.erb_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@
end
let(:presenter) { Idv::InPerson::ReadyToVerifyPresenter.new(enrollment: enrollment) }
let(:step_indicator_steps) { Idv::Flows::InPersonFlow::STEP_INDICATOR_STEPS }
let(:sp_event_name) { 'IdV: user clicked sp link on ready to verify page' }
let(:help_event_name) { 'IdV: user clicked what to bring link on ready to verify page' }

before do
assign(:presenter, presenter)
Expand All @@ -34,6 +36,14 @@
render

expect(rendered).to have_content(service_provider.friendly_name)
expect(rendered).to have_css("lg-click-observer[event-name='#{sp_event_name}']")
end

it 'displays a link back to the help center' do
render

expect(rendered).to have_link(t('in_person_proofing.body.barcode.learn_more'))
expect(rendered).to have_css("lg-click-observer[event-name='#{help_event_name}']")
end

context 'when the user is not coming from a service provider' do
Expand Down