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
1 change: 1 addition & 0 deletions app/controllers/idv/setup_errors_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ class SetupErrorsController < ApplicationController
before_action :confirm_two_factor_authenticated

def show
analytics.idv_setup_errors_visited
end
end
end
10 changes: 10 additions & 0 deletions app/controllers/redirect/contact_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
module Redirect
class ContactController < RedirectController
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Would this be adding an unnecessary extra step to track redirects? I'm unsure about this.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

well, we do this in other places to ensure we have good tracking, so it's not completely unnecessary? but yes it is an extra step

def show
redirect_to_and_log(
IdentityConfig.store.idv_contact_url,
tracker_method: analytics.method(:contact_redirect),
)
end
end
end
21 changes: 21 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2567,5 +2567,26 @@ def account_reset_recovery_options_visit
def cancel_account_reset_recovery
track_event('Account Reset: Cancel Account Recovery Options')
end

# Tracks when the user reaches the verify setup errors page after failing proofing
def idv_setup_errors_visited
track_event('IdV: Verify setup errors visited')
end

# @param [String] redirect_url URL user was directed to
# @param [String, nil] step which step
# @param [String, nil] location which part of a step, if applicable
# @param ["idv", String, nil] flow which flow
# User was redirected to the login.gov contact page
def contact_redirect(redirect_url:, step: nil, location: nil, flow: nil, **extra)
track_event(
'Contact Page Redirect',
redirect_url: redirect_url,
step: step,
location: location,
flow: flow,
**extra,
)
end
end
# rubocop:enable Metrics/ModuleLength
2 changes: 1 addition & 1 deletion app/views/idv/setup_errors/show.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
heading: t('idv.failure.setup.heading'),
) do %>
<p>
<%= t('idv.failure.setup.fail_html', contact_form_link: link_to(t('idv.failure.setup.link_text'), IdentityConfig.store.idv_contact_url), support_code: IdentityConfig.store.lexisnexis_threatmetrix_support_code) %>
<%= t('idv.failure.setup.fail_html', contact_form_link: link_to(t('idv.failure.setup.link_text'), contact_redirect_url(flow: :idv, step: :secure_account)), support_code: IdentityConfig.store.lexisnexis_threatmetrix_support_code) %>
</p>
<% end %>
1 change: 1 addition & 0 deletions config/routes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,7 @@
get '/redirect/return_to_sp/cancel' => 'redirect/return_to_sp#cancel', as: :return_to_sp_cancel
get '/redirect/return_to_sp/failure_to_proof' => 'redirect/return_to_sp#failure_to_proof', as: :return_to_sp_failure_to_proof
get '/redirect/help_center' => 'redirect/help_center#show', as: :help_center_redirect
get '/redirect/contact/' => 'redirect/contact#show', as: :contact_redirect

match '/sign_out' => 'sign_out#destroy', via: %i[get post delete]

Expand Down
19 changes: 19 additions & 0 deletions spec/controllers/idv/setup_errors_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
require 'rails_helper'

describe Idv::SetupErrorsController do
let(:user) { build_stubbed(:user, :signed_up) }

before do
stub_sign_in(user)
end

it 'renders the show template' do
stub_analytics

expect(@analytics).to receive(:track_event).with('IdV: Verify setup errors visited')

get :show

expect(response).to render_template :show
end
end
24 changes: 24 additions & 0 deletions spec/controllers/redirect/contact_controller_spec.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
require 'rails_helper'

describe Redirect::ContactController do
before do
stub_analytics
end

describe '#show' do
let(:location_params) { { flow: 'flow', step: 'step', location: 'location', foo: 'bar' } }
it 'redirects to contact page' do
redirect_url = IdentityConfig.store.idv_contact_url

get :show, params: { **location_params }

expect(response).to redirect_to redirect_url
expect(@analytics).to have_logged_event(
'Contact Page Redirect',
redirect_url: redirect_url,
flow: 'flow',
step: 'step',
)
end
end
end