Skip to main content

Events Tracking

The Lens SDK includes an analytics feature that automatically tracks and records various user interaction events with the Lens. This data is crucial for understanding user behavior and enhancing user experience.

How does tracking work

Upon integration, the SDK begins to monitor specified events within the Lens. These events can range from simple interactions, such as tapping a button, to more complex sequences like completing a task. The collected data provides insights into how users are engaging with the Lens.

How to enable this feature

Analytics tracking is enabled by default when you integrate the Lens SDK. There's no additional setup required to start collecting analytics data. Below, you will find a list of the specific events that the SDK can track

EVENTDESCRIPTIONPARAMS
lens_session_startA new session startedsource=[camera,gallery,browser]
lens_session_endCamera is closed
lens_screen_showScreen opentype=[submit,settings,gallery,crop]
lens_camera_showCamera is shownN/A
lens_camera_closeCamera is closedN/A
lens_camera_close_confirmationCancel capturing alertN/A
lens_camera_menu_openMore menu is openedN/A
lens_camera_menu_closeMore menu is closedN/A
lens_camera_document_type_selectedDocument type selected to scandocument_type=[receipt,long_receipt,bill,other,credit_card,business_card,check,code,w2,w9,barcode,bank_statements]
lens_camera_gallery_openThe gallery button is clickedsource=[gallery]
lens_camera_captureThe capture button is clickedsource=[capture_button]
lens_camera_flashThe flash button is clickedsource=[flashButton]
lens_camera_autocapture_startThe auto-capture mode startedN/A
lens_camera_autocapture_endThe auto-capture mode endedsource=[menu]
lens_stitching_startStitching started for long receiptsN/A
lens_stitching_endStitching ended for long receiptsN/A
lens_gallery_import_imageAn image was imported from the galleryN/A
lens_gallery_openThe gallery is openedtype=[gallery]
lens_gallery_closeThe gallery is closedN/A
lens_submit_document_closeThe confirm screen is closedsource=[btnSubmit]
lens_browser_openThe browse document is open from the menuN/A
lens_browser_closeThe browse document is closedN/A
lens_browse_import_documentA document was selected from the browserN/A
lens_submit_package_submittedThe user confirms the package to submitsource=[btnSubmit]
lens_submit_document_detection_statusStatus of the document capturedstatus=[detected,not_detected]
lens_submit_no_document_alert_showNo document detected alert is shownaction=[try_again,continue]
lens_submit_blur_alert_showBlur-detected alert is shownaction=[try_again,continue], status=[detected,not_detected]
lens_submit_glare_alert_showGlare-detected alert is shownaction=[try_again, continue]
lens_submit_add_documentThe stitch button is clicked to add a new documentdocument_queue=[(amount)], source=[buttonStitchMore]
lens_submit_back_checkThe user accepts to add the back side of the checkN/A
lens_submit_document_rotateThe user rotated the documentindex=[(position)]
lens_submit_document_scrolledThe document detected has been scrolledN/A
lens_submit_document_removeThe user wants to remove a documentindex=[(position)], action=[true, false]
lens_submit_document_cropThe user wants to crop the documentindex=[(position)]
lens_settings_doc_detection_changedThe option “Auto Doc Detec & Crop” from the menu was changedstatus=[true,false]
lens_settings_blur_detection_changedThe option “Auto Blur Detection” from the menu was changedstatus=[true,false]
lens_settings_glare_detection_changedThe option “Auto Torch (ambience detection)” from the menu was changedstatus=[true,false]
lens_settings_autotorch_changedThe option “Handsfree Document Capture” from the menu was changedstatus=[true,false]
lens_settings_autocapture_changedThe option “Auto Blur Detection” from the menu was changedstatus=[true,false]
lens_settings_backup_changedThe option “Backup Scans to Photo Gallery” from the menu was changedstatus=[true,false]
lens_settings_autoclose_changedThe option “After Scan Close Camera” from the menu was changedstatus=[true,false]
lens_crop_showThe Crop screen is openN/A
lens_crop_guide_showThe crop guide alert is shown
lens_crop_alert_showThe confirm crop alert is shownaction=[true,false]
lens_veryfi_lens_successThe document was processed successfullyN/A

JSON Model

This is an example of the json that you will receive in the different platforms for each event

If the event doesn't have params

{
event: "lens_veryfi_lens_success"
}

If the event have params

{
event: "lens_session_start",
params: {
"source": "camera"
}
}

Implementation

// Initialize the observer
NotificationCenter.default.addObserver(
self,
selector: #selector(logLensEvent(from:)),
name: NSNotification.Name.init(rawValue: "VeryfiLensAnalyticsEvent"),
object: nil
)

@objc private func logLensEvent(from notification: Notification) {
// Catch the event
}