Skip to content

Conversation

@CDRussell
Copy link
Member

@CDRussell CDRussell commented Oct 27, 2025

Task/Issue URL: https://app.asana.com/1/137249556945/project/488551667048375/task/1211724585727142?focus=true

Description

Adds observability around bookmark import flow and pre-import dialog.

Steps to test this PR

Logcat filter: package:mine message~:"Bookmark-import: |Pixel sent: bookmark_import_from_google"

Import flow (success)

  • Fresh install, and visit Saved Site Dev Settings
  • Tap on Launch Google Takeout import flow
  • Verify you see bookmark_import_from_google_flow_started in the logs, params should match spec
  • Successfully import, and verify you see bookmark_import_from_google_flow_success, params should match spec (e.g., correct duration buckets)

Import flow (cancellation)

  • Start the import again, and this time cancel.
  • Verify you see bookmark_import_from_google_flow_cancelled in the logs and it includes the stepReached alongside durations.

Import flow (simulate error)

  • Apply patch from below
  • Start the import flow, and wait 2 seconds
  • Verify you see bookmark_import_from_google_flow_error and errorReason starts with webView- then has the step. (e.g., webView-takeout-first)

Pre-import dialogs

Screenshot 2025-10-28 at 13 07 14
  • Visit Bookmarks activity, and tap on Import (from empty state or overflow; doesn't matter)
  • Verify bookmark_import_from_google_dialog_shown appears
  • Tap the ✖️ to cancel the dialog; verify bookmark_import_from_google_dialog_dismissed appears
  • Tap to show it again, and this time use the back button to dismiss; verifying same log appears
  • Tap to show it again, and this time tap outside of the dialog to dismiss; verifying same log appears
  • Tap to show it again, and this time choose Select Bookmarks File; verify bookmark_import_from_google_dialog_fromfile appeas
  • Finally, choose Import From Google button and verify bookmark_import_from_google_dialog_startflow

Patch to force a crash during import

Index: autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/importing/takeout/webflow/ImportGoogleBookmarksWebFlowFragment.kt IDEA additional info: Subsystem: com.intellij.openapi.diff.impl.patch.CharsetEP <+>UTF-8 =================================================================== diff --git a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/importing/takeout/webflow/ImportGoogleBookmarksWebFlowFragment.kt b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/importing/takeout/webflow/ImportGoogleBookmarksWebFlowFragment.kt --- a/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/importing/takeout/webflow/ImportGoogleBookmarksWebFlowFragment.kt	(revision Staged) +++ b/autofill/autofill-impl/src/main/java/com/duckduckgo/autofill/impl/importing/takeout/webflow/ImportGoogleBookmarksWebFlowFragment.kt	(date 1761651295473) @@ -76,6 +76,7 @@ import com.duckduckgo.common.utils.plugins.PluginPoint import com.duckduckgo.di.scopes.FragmentScope import com.duckduckgo.user.agent.api.UserAgentProvider +import kotlinx.coroutines.delay import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.onEach import kotlinx.coroutines.launch @@ -163,6 +164,13 @@ viewModel.firstPageLoading() } } + + // force a deliberate crash to test + lifecycleScope.launch { + delay(2000) + binding?.webView?.loadUrl("chrome://crash") + } + } private fun observeViewState() { 
Copy link
Member Author

CDRussell commented Oct 27, 2025

@CDRussell CDRussell force-pushed the feature/craig/bookmark_import_flow_observability branch 2 times, most recently from 53a9493 to 4b6121a Compare October 28, 2025 11:09
Comment on lines +35 to +45
return when (seconds) {
in 0..19 -> "20"
in 20..39 -> "40"
in 40..59 -> "60"
in 60..89 -> "90"
in 90..119 -> "120"
in 120..149 -> "150"
in 150..179 -> "180"
in 180..239 -> "240"
in 240..299 -> "300"
else -> "longer"
Copy link
Member Author

Choose a reason for hiding this comment

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

the bucket values indicates the time it was completed within. e.g., 20 means it completed in less than 20s. 60 means it completed in less than 60s and so on.


val chromeHtmlFiles = mutableListOf<String>()

// First pass: collect Chrome HTML files and look for Bookmarks.html
Copy link
Member Author

Choose a reason for hiding this comment

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

Need to update this so that it doesn't return early upon finding an exact match on the Takeout/Chrome/Bookmarks.html file since if there are more files in there, it is pixelled

@CDRussell CDRussell marked this pull request as ready for review October 30, 2025 13:47
@CDRussell CDRussell requested a review from malmstein as a code owner October 30, 2025 13:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds comprehensive pixel tracking for the Google bookmarks import flow to measure user engagement and diagnose issues. The implementation tracks the full import journey from dialog interactions through flow completion or errors.

  • Adds pixel tracking for pre-import dialog events (shown, dismissed, user actions)
  • Implements journey tracking with duration bucketing for flow performance metrics
  • Adds pixel for detecting multiple Chrome export files in Google Takeout
  • Refactors error handling to include step information for better debugging

Reviewed Changes

Copilot reviewed 16 out of 16 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
ImportFromGoogleBookmarksPreImportDialog.kt Added pixel tracking for dialog shown/dismissed and user action events; removed onCreate lifecycle override
SavedSitesPixelName.kt Added 4 new pixel names for pre-import dialog tracking and configured ATB parameter removal
AutofillPixelNames.kt Added 5 new pixel names for flow journey tracking (started, success, error, cancelled, extra Chrome export)
ImportGoogleBookmarksJourney.kt New file implementing journey tracking with duration measurement and pixel firing
ImportGoogleBookmarksDurationBucketing.kt New file implementing time bucketing logic for duration metrics
TakeoutBookmarkExtractor.kt Refactored extraction logic to detect multiple Chrome files and fire pixel; improved code structure
ImportGoogleBookmarksWebFlowActivity.kt Changed launch parameter from data object to data class with launchSource; integrated journey tracking
ImportGoogleBookmarkResult.kt Changed WebViewError from data object to data class to include step information
ImportGoogleBookmarksWebFlowViewModel.kt Added onFatalWebViewError method to handle WebView errors with step tracking
ImportGoogleBookmarksWebFlowFragment.kt Updated to use new ViewModel method for WebView errors; removed unused error mapping function
ImportFromGoogleImpl.kt Added getLaunchSource method to provide source for journey tracking
RealImportGoogleBookmarksJourneyTest.kt New comprehensive test file for journey tracking functionality
RealImportGoogleBookmarksDurationBucketingTest.kt New test file for duration bucketing logic
ImportGoogleBookmarksWebFlowViewModelTest.kt Added test for WebView error handling; reformatted existing tests
TakeoutZipBookmarkExtractorTest.kt Added tests for multiple Chrome file detection and pixel firing
ImportFromGoogleImplTest.kt Updated mock setup to match new data class parameter type
Copy link
Contributor

@cmonfortep cmonfortep left a comment

Choose a reason for hiding this comment

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

All good! Tested and works as described.

Copy link
Member Author

CDRussell commented Oct 30, 2025

Merge activity

  • Oct 30, 11:10 PM UTC: A user started a stack merge that includes this pull request via Graphite.
  • Oct 30, 11:11 PM UTC: @CDRussell merged this pull request with Graphite.
@CDRussell CDRussell merged commit abe79c5 into develop Oct 30, 2025
26 checks passed
@CDRussell CDRussell deleted the feature/craig/bookmark_import_flow_observability branch October 30, 2025 23:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants