Bug 1075232 - Record which suggestion of the search screen was tapped in telemetry. r=mfinkle, a=lmandel
authorMargaret Leibovic <margaret.leibovic@gmail.com>
Fri, 03 Oct 2014 14:37:19 -0400
changeset 225814 a627934a0123
parent 225813 043c91e3aaeb
child 225815 85e56f19a5a1
push id4026
push userryanvm@gmail.com
push date2014-10-26 22:32 +0000
treeherdermozilla-beta@410afcc51b13 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmfinkle, lmandel
bugs1075232
milestone34.0
Bug 1075232 - Record which suggestion of the search screen was tapped in telemetry. r=mfinkle, a=lmandel
mobile/android/base/home/SearchEngineRow.java
--- a/mobile/android/base/home/SearchEngineRow.java
+++ b/mobile/android/base/home/SearchEngineRow.java
@@ -84,17 +84,18 @@ class SearchEngineRow extends AnimatedHe
                         Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.SUGGESTION, "url");
 
                         mUrlOpenListener.onUrlOpen(suggestion, EnumSet.noneOf(OnUrlOpenListener.Flags.class));
                     }
                 } else if (mSearchListener != null) {
                     if (v == mUserEnteredView) {
                         Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.SUGGESTION, "user");
                     } else {
-                        Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.SUGGESTION, "engine");
+                        final String extras = "engine." + (String) v.getTag();
+                        Telemetry.sendUIEvent(TelemetryContract.Event.LOAD_URL, TelemetryContract.Method.SUGGESTION, extras);
                     }
                     mSearchListener.onSearch(mSearchEngine, suggestion);
                 }
             }
         };
 
         mLongClickListener = new OnLongClickListener() {
             @Override
@@ -193,16 +194,19 @@ class SearchEngineRow extends AnimatedHe
                 suggestionItem = mSuggestionView.getChildAt(suggestionCounter + 1);
                 suggestionItem.setVisibility(View.VISIBLE);
             } else {
                 suggestionItem = mInflater.inflate(R.layout.suggestion_item, null);
 
                 suggestionItem.setOnClickListener(mClickListener);
                 suggestionItem.setOnLongClickListener(mLongClickListener);
 
+                // Store the position of the suggestion for telemetry.
+                suggestionItem.setTag(String.valueOf(suggestionCounter));
+
                 final ImageView magnifier =
                         (ImageView) suggestionItem.findViewById(R.id.suggestion_magnifier);
                 magnifier.setVisibility(View.GONE);
 
                 mSuggestionView.addView(suggestionItem);
             }
 
             setSuggestionOnView(suggestionItem, suggestion);