Index: ui/file_manager/file_manager/common/js/metrics_events.js |
diff --git a/ui/file_manager/file_manager/common/js/metrics_events.js b/ui/file_manager/file_manager/common/js/metrics_events.js |
new file mode 100644 |
index 0000000000000000000000000000000000000000..67d11f9de9170f02b1c82f9cc5476c3279d08267 |
--- /dev/null |
+++ b/ui/file_manager/file_manager/common/js/metrics_events.js |
@@ -0,0 +1,97 @@ |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+// namespace |
+var metrics = metrics || metricsBase; |
+ |
+/** @enum {string} */ |
+metrics.Categories = { |
Steve McKay
2015/02/17 23:47:51
No need for string constants. Just inline the valu
Ben Kwa
2015/02/17 23:54:24
I'd agree if this value was only used in the metri
|
+ IMPORT: 'Import' |
+}; |
+ |
+/** |
+ * The values of these enums come from the analytics console. |
+ * @private @enum {number} |
+ */ |
+metrics.Dimension_ = { |
+ USER_TYPE: 1, |
+ SESSION_TYPE: 2, |
+ DEDUPE_TYPE: 3, |
Steve McKay
2015/02/17 23:47:50
Remove DEDUPE_TYPE and IMPORT_RESULT
Ben Kwa
2015/02/18 22:23:02
Done.
|
+ IMPORT_RESULT: 4 |
+}; |
+ |
+/** |
+ * @enum {!analytics.EventBuilder.Dimension} |
+ */ |
+metrics.Dimensions = { |
+ USER_TYPE_NON_IMPORT: { |
+ index: metrics.Dimension_.USER_TYPE, |
+ value: 'Non-import' |
+ }, |
+ USER_TYPE_IMPORT: { |
+ index: metrics.Dimension_.USER_TYPE, |
+ value: 'Import' |
+ }, |
+ SESSION_TYPE_NON_IMPORT: { |
+ index: metrics.Dimension_.SESSION_TYPE, |
+ value: 'Non-import' |
+ }, |
+ SESSION_TYPE_IMPORT: { |
+ index: metrics.Dimension_.SESSION_TYPE, |
+ value: 'Import' |
+ } |
+}; |
+ |
+// namespace |
+metrics.event = metrics.event || {}; |
+ |
+/** |
+ * Base event builder for all import-related events. |
+ * @private {analytics.EventBuilder} |
+ */ |
+metrics.event.Import_ = analytics.EventBuilder.builder() |
Steve McKay
2015/02/17 23:47:50
Make this an enum:
@private @enum {analytics.Eve
Ben Kwa
2015/02/18 22:23:02
Done.
|
+ .category(metrics.Categories.IMPORT); |
Steve McKay
2015/02/17 23:47:50
IMPORT > Acquisition, because we may want to track
Ben Kwa
2015/02/18 22:23:02
Done.
|
+ |
+/** |
+ * @enum {!analytics.EventBuilder} |
+ */ |
+metrics.Events = { |
Steve McKay
2015/02/17 23:47:50
metrics.ImportEvents, then you can remove the IMPO
Ben Kwa
2015/02/18 22:23:02
Done.
|
+ IMPORT_STARTED: metrics.event.Import_ |
+ .action('ImportStart') |
Steve McKay
2015/02/17 23:47:50
Prefer regular phrases in your strings...
"Import
Ben Kwa
2015/02/18 22:23:02
Done.
|
+ .dimension(metrics.Dimensions.SESSION_TYPE_IMPORT) |
+ .dimension(metrics.Dimensions.USER_TYPE_IMPORT), |
+ |
+ IMPORT_ENDED: metrics.event.Import_ |
+ .action('ImportSuccess'), |
Steve McKay
2015/02/17 23:47:50
Import Completed
you get the idea
Ben Kwa
2015/02/18 22:23:01
Done.
|
+ |
+ IMPORT_CANCELLED: metrics.event.Import_ |
+ .action('importCancelled'), |
+ |
+ IMPORT_ERROR: metrics.event.Import_ |
+ .action('importError'), |
+ |
+ IMPORT_FILE_COUNT: metrics.event.Import_ |
+ .action('importFileCount'), |
Steve McKay
2015/02/17 23:47:50
Files Imported
Ben Kwa
2015/02/18 22:23:01
Done.
|
+ |
+ IMPORT_BYTE_COUNT: metrics.event.Import_ |
+ .action('importByteCount'), |
Steve McKay
2015/02/17 23:47:50
Total Bytes Imported
Ben Kwa
2015/02/18 22:23:01
Done.
|
+ |
+ DEVICE_YANKED: metrics.event.Import_ |
+ .action('deviceYanked'), |
+ |
+ HISTORY_DEDUPE_COUNT: metrics.event.Import_ |
+ .action('historyDedupeCount'), |
Steve McKay
2015/02/17 23:47:50
Num. Files History Deduped
Num. Files Content Dedu
Ben Kwa
2015/02/18 22:23:01
Done.
|
+ |
+ CONTENT_DEDUPE_COUNT: metrics.event.Import_ |
+ .action('contentDedupeCount') |
+}; |
+ |
+// namespace |
+metrics.timing = metrics.timing || {}; |
+ |
+/** @enum {string} */ |
+metrics.timing.Variables = { |
+ COMPUTE_HASH: 'ComputeHash', |
Steve McKay
2015/02/17 23:47:50
Any reason we need to qualify this? We're computin
Ben Kwa
2015/02/18 22:23:01
I'll use a label.
|
+ SEARCH_BY_HASH: 'SearchByHash' |
+}; |