Skip to content
Closed
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/openid_connect/authorization_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def check_sp_active

def check_sp_handoff_bounced
return unless SpHandoffBounce::IsBounced.call(sp_session)
analytics.track_event(Analytics::SP_HANDOFF_BOUNCED_DETECTED)
analytics.sp_handoff_bounced_detected()
redirect_to bounced_url
true
end
Expand Down
3 changes: 1 addition & 2 deletions app/controllers/users/backup_code_setup_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,7 @@ def delete
private

def track_backup_codes_created
analytics.track_event(
Analytics::BACKUP_CODE_CREATED,
analytics.backup_code_created(
enabled_mfa_methods_count: mfa_user.enabled_mfa_methods_count,
)
Funnel::Registration::AddMfa.call(current_user.id, 'backup_codes')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ class ServiceProviderInactiveController < ApplicationController
include FullyAuthenticatable

def index
analytics.track_event(Analytics::SP_INACTIVE_VISIT)
analytics.sp_inactive_visit()
Copy link
Contributor

Choose a reason for hiding this comment

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

I'd drop the optional parens here:

Suggested change
analytics.sp_inactive_visit()
analytics.sp_inactive_visit


@sp_name = sp_from_sp_session&.friendly_name ||
I18n.t('service_providers.errors.generic_sp_name')
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/users/sp_handoff_bounced_controller.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Users
class SpHandoffBouncedController < Devise::SessionsController
def bounced
analytics.track_event(Analytics::SP_HANDOFF_BOUNCED_VISIT)
analytics.sp_handoff_bounced_visit()
Copy link
Contributor

Choose a reason for hiding this comment

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

ditto, no empty parens

Suggested change
analytics.sp_handoff_bounced_visit()
analytics.sp_handoff_bounced_visit

@sp_name = I18n.t('instructions.sp_handoff_bounced_with_no_sp')
update_sp_info
end
Expand Down
4 changes: 0 additions & 4 deletions app/services/analytics.rb
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,6 @@ def session_started_at

# rubocop:disable Layout/LineLength
DOC_AUTH = 'Doc Auth' # visited or submitted is appended
SP_HANDOFF_BOUNCED_DETECTED = 'SP handoff bounced detected'
SP_HANDOFF_BOUNCED_VISIT = 'SP handoff bounced visited'
SP_INACTIVE_VISIT = 'SP inactive visited'
BACKUP_CODE_CREATED = 'Backup Code Created'
BACKUP_CODE_DELETED = 'Backup Code Delete'
BACKUP_CODE_SETUP_VISIT = 'Backup Code Setup Visited'
BACKUP_CODE_SETUP_SUBMITTED = 'Backup Code Setup submitted'
Expand Down
25 changes: 25 additions & 0 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,16 @@ def authentication_confirmation_reset
track_event('Authentication Confirmation: Reset selected')
end

# Tracks when the user creates a set of backup mfa codes.
# @param [Integer] enabled_mfa_methods_count number of registered mfa methods for the user
def backup_code_created(enabled_mfa_methods_count:, **extra)
track_event(
'Backup Code Created',
enabled_mfa_methods_count: enabled_mfa_methods_count,
**extra
)
end

# A user that has been banned from an SP has authenticated, they are redirected
# to a page showing them that they have been banned
def banned_user_redirect
Expand Down Expand Up @@ -1790,6 +1800,21 @@ def security_event_received(
)
end

# Tracks when a user is bounced back from the service provider due to an integration issue.
def sp_handoff_bounced_detected
track_event('SP handoff bounced detected')
end

# Tracks when a user visits the bounced page.
def sp_handoff_bounced_visit
track_event('SP handoff bounced visited')
end

# Tracks when a user vists the "This agency no longer uses Login.gov" page.
def sp_inactive_visit
track_event('SP inactive visited')
end

# Tracks when service provider consent is revoked
# @param [String] issuer issuer of the service provider consent to be revoked
def sp_revoke_consent_revoked(issuer:, **extra)
Expand Down