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
16 changes: 13 additions & 3 deletions app/forms/idv/api_image_upload_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ def extra_attributes
Digest::SHA256.urlsafe_base64digest(back_image_bytes)
end

@extra_attributes
@extra_attributes.merge!(getting_started_ab_test_analytics_bucket)
end

def remaining_attempts
Expand Down Expand Up @@ -216,7 +216,9 @@ def document_capture_session_uuid
def doc_auth_client
@doc_auth_client ||= DocAuthRouter.client(
vendor_discriminator: document_capture_session_uuid,
warn_notifier: proc { |attrs| analytics&.doc_auth_warning(**attrs) },
warn_notifier: proc do |attrs|
analytics&.doc_auth_warning(**attrs.merge(getting_started_ab_test_analytics_bucket))
end,
)
end

Expand Down Expand Up @@ -248,7 +250,8 @@ def update_analytics(client_response:, vendor_request_time_in_ms:)
async: false,
flow_path: params[:flow_path],
vendor_request_time_in_ms: vendor_request_time_in_ms,
).merge(acuant_sdk_upgrade_ab_test_data),
).merge(acuant_sdk_upgrade_ab_test_data).
merge(getting_started_ab_test_analytics_bucket),
)
end

Expand Down Expand Up @@ -279,6 +282,13 @@ def acuant_sdk_upgrade_ab_test_data
}
end

def getting_started_ab_test_analytics_bucket
{
getting_started_ab_test_bucket:
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.

can we document these in analytics_events.rb?

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.

Added, even though these are intended to be temporary.

AbTests::IDV_GETTING_STARTED.bucket(user_uuid),
}
end

def acuant_sdk_capture?
image_metadata.dig(:front, :source) == Idp::Constants::Vendors::ACUANT &&
image_metadata.dig(:back, :source) == Idp::Constants::Vendors::ACUANT
Expand Down
21 changes: 18 additions & 3 deletions app/services/analytics_events.rb
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,17 @@ def doc_auth_async(error: nil, uuid: nil, result_id: nil, **extra)
track_event('Doc Auth Async', error: error, uuid: uuid, result_id: result_id, **extra)
end

# @param [String] message the warining
# @param [String] message the warning
# @param [String] getting_started_ab_test_bucket Which initial IdV screen the user saw
# Logged when there is a non-user-facing error in the doc auth process, such as an unrecognized
# field from a vendor
def doc_auth_warning(message: nil, **extra)
track_event('Doc Auth Warning', message: message, **extra)
def doc_auth_warning(message: nil, getting_started_ab_test_bucket: nil, **extra)
track_event(
'Doc Auth Warning',
message: message,
getting_started_ab_test_bucket: getting_started_ab_test_bucket,
**extra,
)
end

# When a user views the edit password page
Expand Down Expand Up @@ -759,6 +765,7 @@ def idv_doc_auth_ssn_visited(**extra)
# @param [String] flow_path
# @param [String] front_image_fingerprint Fingerprint of front image data
# @param [String] back_image_fingerprint Fingerprint of back image data
# @param [String] getting_started_ab_test_bucket Which initial IdV screen the user saw
# The document capture image uploaded was locally validated during the IDV process
def idv_doc_auth_submitted_image_upload_form(
success:,
Expand All @@ -769,6 +776,7 @@ def idv_doc_auth_submitted_image_upload_form(
user_id: nil,
front_image_fingerprint: nil,
back_image_fingerprint: nil,
getting_started_ab_test_bucket: nil,
**extra
)
track_event(
Expand All @@ -781,6 +789,7 @@ def idv_doc_auth_submitted_image_upload_form(
flow_path: flow_path,
front_image_fingerprint: front_image_fingerprint,
back_image_fingerprint: back_image_fingerprint,
getting_started_ab_test_bucket: getting_started_ab_test_bucket,
**extra,
)
end
Expand All @@ -800,6 +809,7 @@ def idv_doc_auth_submitted_image_upload_form(
# @param [Float] vendor_request_time_in_ms Time it took to upload images & get a response.
# @param [String] front_image_fingerprint Fingerprint of front image data
# @param [String] back_image_fingerprint Fingerprint of back image data
# @param [String] getting_started_ab_test_bucket Which initial IdV screen the user saw
# The document capture image was uploaded to vendor during the IDV process
def idv_doc_auth_submitted_image_upload_vendor(
success:,
Expand All @@ -816,6 +826,7 @@ def idv_doc_auth_submitted_image_upload_vendor(
vendor_request_time_in_ms: nil,
front_image_fingerprint: nil,
back_image_fingerprint: nil,
getting_started_ab_test_bucket: nil,
**extra
)
track_event(
Expand All @@ -835,6 +846,7 @@ def idv_doc_auth_submitted_image_upload_vendor(
vendor_request_time_in_ms: vendor_request_time_in_ms,
front_image_fingerprint: front_image_fingerprint,
back_image_fingerprint: back_image_fingerprint,
getting_started_ab_test_bucket: getting_started_ab_test_bucket,
**extra,
)
end
Expand All @@ -847,6 +859,7 @@ def idv_doc_auth_submitted_image_upload_vendor(
# @param [String] flow_path
# @param [String] front_image_fingerprint Fingerprint of front image data
# @param [String] back_image_fingerprint Fingerprint of back image data
# @param [String] getting_started_ab_test_bucket Which initial IdV screen the user saw
# The PII that came back from the document capture vendor was validated
def idv_doc_auth_submitted_pii_validation(
success:,
Expand All @@ -857,6 +870,7 @@ def idv_doc_auth_submitted_pii_validation(
user_id: nil,
front_image_fingerprint: nil,
back_image_fingerprint: nil,
getting_started_ab_test_bucket: nil,
**extra
)
track_event(
Expand All @@ -869,6 +883,7 @@ def idv_doc_auth_submitted_pii_validation(
flow_path: flow_path,
front_image_fingerprint: front_image_fingerprint,
back_image_fingerprint: back_image_fingerprint,
getting_started_ab_test_bucket: getting_started_ab_test_bucket,
**extra,
)
end
Expand Down
18 changes: 18 additions & 0 deletions spec/controllers/idv/image_uploads_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@
flow_path: 'standard',
front_image_fingerprint: nil,
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@irs_attempts_api_tracker).to receive(:track_event).with(
Expand Down Expand Up @@ -263,6 +264,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@irs_attempts_api_tracker).to receive(:track_event).with(
Expand Down Expand Up @@ -323,6 +325,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@analytics).to receive(:track_event).with(
Expand All @@ -348,6 +351,7 @@
vendor_request_time_in_ms: a_kind_of(Float),
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
doc_type_supported: boolean,
)

Expand All @@ -363,6 +367,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@irs_attempts_api_tracker).to receive(:track_event).with(
Expand Down Expand Up @@ -480,6 +485,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@analytics).to receive(:track_event).with(
Expand All @@ -505,6 +511,7 @@
vendor_request_time_in_ms: a_kind_of(Float),
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
doc_type_supported: boolean,
)

Expand All @@ -525,6 +532,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@irs_attempts_api_tracker).to receive(:track_event).with(
Expand Down Expand Up @@ -567,6 +575,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@analytics).to receive(:track_event).with(
Expand All @@ -592,6 +601,7 @@
vendor_request_time_in_ms: a_kind_of(Float),
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
doc_type_supported: boolean,
)

Expand All @@ -612,6 +622,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@irs_attempts_api_tracker).to receive(:track_event).with(
Expand Down Expand Up @@ -654,6 +665,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@analytics).to receive(:track_event).with(
Expand All @@ -679,6 +691,7 @@
vendor_request_time_in_ms: a_kind_of(Float),
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
doc_type_supported: boolean,
)

Expand All @@ -699,6 +712,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@irs_attempts_api_tracker).to receive(:track_event).with(
Expand Down Expand Up @@ -764,6 +778,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@analytics).to receive(:track_event).with(
Expand Down Expand Up @@ -791,6 +806,7 @@
vendor_request_time_in_ms: a_kind_of(Float),
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
doc_type_supported: boolean,
)

Expand Down Expand Up @@ -832,6 +848,7 @@
flow_path: 'standard',
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(@analytics).to receive(:track_event).with(
Expand Down Expand Up @@ -861,6 +878,7 @@
vendor_request_time_in_ms: a_kind_of(Float),
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
doc_type_supported: boolean,
)

Expand Down
10 changes: 5 additions & 5 deletions spec/features/idv/analytics_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything, 'acuantCaptureMode' => 'AUTO'
},
'IdV: doc auth image upload form submitted' => {
success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String)
success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String), getting_started_ab_test_bucket: :welcome_default
},
'IdV: doc auth image upload vendor pii validation' => {
success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false, front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String)
success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false, front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String), getting_started_ab_test_bucket: :welcome_default
},
'IdV: doc auth document_capture submitted' => {
success: true, errors: {}, flow_path: 'standard', step: 'document_capture', redo_document_capture: nil, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome_default, analytics_id: 'Doc Auth', skip_hybrid_handoff: nil, irs_reproofing: false
Expand Down Expand Up @@ -174,10 +174,10 @@
'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything, 'acuantCaptureMode' => 'AUTO'
},
'IdV: doc auth image upload form submitted' => {
success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String)
success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String), getting_started_ab_test_bucket: :welcome_default
},
'IdV: doc auth image upload vendor pii validation' => {
success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false, front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String)
success: true, errors: {}, user_id: user.uuid, attempts: 1, remaining_attempts: 3, flow_path: 'standard', attention_with_barcode: false, front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String), getting_started_ab_test_bucket: :welcome_default
},
'IdV: doc auth document_capture submitted' => {
success: true, errors: {}, flow_path: 'standard', step: 'document_capture', redo_document_capture: nil, acuant_sdk_upgrade_ab_test_bucket: :default, getting_started_ab_test_bucket: :welcome_default, skip_hybrid_handoff: nil, analytics_id: 'Doc Auth', irs_reproofing: false
Expand Down Expand Up @@ -258,7 +258,7 @@
'width' => 284, 'height' => 38, 'mimeType' => 'image/png', 'source' => 'upload', 'size' => 3694, 'attempt' => 1, 'flow_path' => 'standard', 'acuant_sdk_upgrade_a_b_testing_enabled' => 'false', 'use_alternate_sdk' => anything, 'acuant_version' => anything, 'acuantCaptureMode' => 'AUTO'
},
'IdV: doc auth image upload form submitted' => {
success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String)
success: true, errors: {}, attempts: 1, remaining_attempts: 3, user_id: user.uuid, flow_path: 'standard', front_image_fingerprint: an_instance_of(String), back_image_fingerprint: an_instance_of(String), getting_started_ab_test_bucket: :welcome_default
},
'IdV: doc auth image upload vendor submitted' => hash_including(success: true, flow_path: 'standard', attention_with_barcode: true, doc_auth_result: 'Attention'),
'IdV: verify in person troubleshooting option clicked' => {
Expand Down
3 changes: 3 additions & 0 deletions spec/forms/idv/api_image_upload_form_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@
flow_path: anything,
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)

expect(fake_analytics).to have_logged_event(
Expand Down Expand Up @@ -141,6 +142,7 @@
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
doc_type_supported: boolean,
getting_started_ab_test_bucket: :welcome_default,
)
end

Expand Down Expand Up @@ -203,6 +205,7 @@
flow_path: anything,
front_image_fingerprint: an_instance_of(String),
back_image_fingerprint: an_instance_of(String),
getting_started_ab_test_bucket: :welcome_default,
)
end

Expand Down