Chromium Code Reviews| Index: ui/file_manager/file_manager/common/js/importer_common.js |
| diff --git a/ui/file_manager/file_manager/common/js/importer_common.js b/ui/file_manager/file_manager/common/js/importer_common.js |
| index 3f6d302eb6ed793bf6cdfce570150b7771f4778f..a014d4832d3e6cc08a3ac338a5f8f1d5326c422a 100644 |
| --- a/ui/file_manager/file_manager/common/js/importer_common.js |
| +++ b/ui/file_manager/file_manager/common/js/importer_common.js |
| @@ -673,3 +673,133 @@ importer.getLogger = function() { |
| } |
| return importer.logger_; |
| }; |
| + |
| +// namespace |
| +importer.metrics = importer.metrics || {}; |
| + |
| +/** @const {string} */ |
| +importer.metrics.CATEGORY = "Import"; |
| + |
| +/** |
| + * The values of these enums come from the analytics console. |
| + * @private @enum {number} |
| + */ |
| +importer.metrics.Dimension_ = { |
|
Steve McKay
2015/02/12 17:59:14
Custom dimensions are app Files.app wide, not impo
Ben Kwa
2015/02/17 23:01:29
Done:
- removed the extra dimensions, replacing th
|
| + USER_TYPE: 1, |
| + SESSION_TYPE: 2, |
| + DEDUPE_TYPE: 3, |
| + IMPORT_RESULT: 4 |
| +}; |
| + |
| +/** |
| + * @enum {!analytics.EventBuilder.Dimension} |
| + */ |
| +importer.metrics.Dimensions = { |
| + USER_TYPE_GENERAL: { |
|
Steve McKay
2015/02/12 18:16:35
We should double check with the GA folks about thi
Ben Kwa
2015/02/17 23:01:29
The GA folks indicated that
1) all traffic we car
|
| + index: importer.metrics.Dimension_.USER_TYPE, |
| + value: 'General' |
| + }, |
| + USER_TYPE_IMPORT: { |
| + index: importer.metrics.Dimension_.USER_TYPE, |
| + value: 'Import' |
| + }, |
| + SESSION_TYPE_GENERAL: { |
| + index: importer.metrics.Dimension_.SESSION_TYPE, |
| + value: 'General' |
| + }, |
| + SESSION_TYPE_IMPORT: { |
| + index: importer.metrics.Dimension_.SESSION_TYPE, |
| + value: 'Import' |
| + }, |
| + DEDUPE_TYPE_HISTORY: { |
|
Steve McKay
2015/02/12 17:59:14
I don't think we need any of the custom dimensions
Steve McKay
2015/02/12 18:16:35
Basically, dimensions are best used to create larg
Ben Kwa
2015/02/17 23:01:29
Done.
Ben Kwa
2015/02/17 23:01:29
I changed them to just be different actions.
|
| + index: importer.metrics.Dimension_.DEDUPE_TYPE, |
| + value: 'History' |
| + }, |
| + DEDUPE_TYPE_CONTENT: { |
| + index: importer.metrics.Dimension_.DEDUPE_TYPE, |
| + value: 'Content' |
| + }, |
| + IMPORT_SUCCESS: { |
| + index: importer.metrics.Dimension_.IMPORT_RESULT, |
| + value: 'Success' |
| + }, |
| + IMPORT_ERROR: { |
| + index: importer.metrics.Dimension_.IMPORT_RESULT, |
| + value: 'Error' |
| + }, |
| + IMPORT_CANCELLED: { |
| + index: importer.metrics.Dimension_.IMPORT_RESULT, |
| + value: 'Cancelled' |
| + } |
| +}; |
| + |
| +// namespace |
| +importer.metrics.event = importer.metrics.event || {}; |
| + |
| +/** |
| + * @enum {string} |
| + */ |
| +importer.metrics.event.Action = { |
| + IMPORT_START: 'ImportStart', |
| + IMPORT_END: 'ImportEnd', |
| + DEVICE_YANKED: 'DeviceYanked', |
| + IMPORT_FILE_COUNT: 'ImportFileCount', |
| + IMPORT_BYTE_COUNT: 'ImportByteCount', |
| + DEDUPE_COUNT: 'DedupeCount' |
| + |
|
mtomasz
2015/02/12 01:51:03
nit: Remove \n.
Ben Kwa
2015/02/17 23:01:29
Done.
|
| +}; |
| + |
| +/** |
| + * Base event builder for all import-related events. |
| + * @private {analytics.EventBuilder} |
| + */ |
| +importer.metrics.event.BaseEvent_ = analytics.EventBuilder.builder() |
| + .category(importer.metrics.CATEGORY); |
|
Steve McKay
2015/02/12 18:16:35
inline the category here, then just:
importer.met
Ben Kwa
2015/02/17 23:01:29
I renamed the BaseEvent to Import_, but I couldn't
|
| + |
| +/** |
| + * @enum {!analytics.EventBuilder} |
| + */ |
| +importer.metrics.Events = { |
| + IMPORT_STARTED: importer.metrics.event.BaseEvent_ |
| + .action(importer.metrics.event.Action.IMPORT_START) |
| + .dimension(importer.metrics.Dimensions.SESSION_TYPE_IMPORT) |
| + .dimension(importer.metrics.Dimensions.USER_TYPE_IMPORT), |
| + |
| + IMPORT_ENDED: importer.metrics.event.BaseEvent_ |
| + .action(importer.metrics.event.Action.IMPORT_END) |
| + .dimension(importer.metrics.Dimensions.IMPORT_SUCCESS), |
| + |
| + IMPORT_CANCELLED: importer.metrics.event.BaseEvent_ |
| + .action(importer.metrics.event.Action.IMPORT_END) |
| + .dimension(importer.metrics.Dimensions.IMPORT_CANCELLED), |
| + |
| + IMPORT_ERROR: importer.metrics.event.BaseEvent_ |
| + .action(importer.metrics.event.Action.IMPORT_END) |
| + .dimension(importer.metrics.Dimensions.IMPORT_ERROR), |
| + |
| + IMPORT_FILE_COUNT: importer.metrics.event.BaseEvent_ |
| + .action(importer.metrics.event.Action.IMPORT_FILE_COUNT), |
| + |
| + IMPORT_BYTE_COUNT: importer.metrics.event.BaseEvent_ |
| + .action(importer.metrics.event.Action.IMPORT_BYTE_COUNT), |
| + |
| + DEVICE_YANKED: importer.metrics.event.BaseEvent_ |
| + .action(importer.metrics.event.Action.DEVICE_YANKED), |
| + |
| + HISTORY_DEDUPE_COUNT: importer.metrics.event.BaseEvent_ |
| + .action(importer.metrics.event.Action.DEDUPE_COUNT) |
| + .dimension(importer.metrics.Dimensions.DEDUPE_TYPE_HISTORY), |
| + |
| + CONTENT_DEDUPE_COUNT: importer.metrics.event.BaseEvent_ |
| + .action(importer.metrics.event.Action.DEDUPE_COUNT) |
| + .dimension(importer.metrics.Dimensions.DEDUPE_TYPE_CONTENT) |
| +}; |
| + |
| +// namespace |
| +importer.metrics.timing = importer.metrics.timing || {}; |
| + |
| +/** @enum {string} */ |
| +importer.metrics.timing.Variables = { |
| + COMPUTE_HASH: 'ComputeHash', |
| + SEARCH_BY_HASH: 'SearchByHash' |
| +}; |