Commit 2df221e4 authored by smckay's avatar smckay Committed by Commit bot

Files.app: Analytics tweaks

1) Report total errors while reporting import task statistics.
2) Report addView when volume changes.
3) Send hit when history file changes.

BUG=420680
TEST=browser_test: FileManagerJsTest.*

Review URL: https://codereview.chromium.org/933553003

Cr-Commit-Position: refs/heads/master@{#317076}
parent e6141ebb
......@@ -200,6 +200,9 @@ importer.MediaImportHandler.ImportTask = function(
/** @private {number} Number of files deduped by content dedupe. */
this.dedupeCount_ = 0;
/** @private {number} */
this.errorCount_ = 0;
};
/** @struct */
......@@ -464,9 +467,7 @@ importer.MediaImportHandler.ImportTask.prototype.onSuccess_ = function() {
*/
importer.MediaImportHandler.ImportTask.prototype.onError_ = function(error) {
this.notify(importer.TaskQueue.UpdateType.ERROR);
// TODO(kenobi): Impedence mismatch: this gets called per-file, which is
// different from onSuccess, which reports overall import success.
this.tracker_.send(metrics.ImportEvents.ERROR);
this.errorCount_++;
};
/**
......@@ -483,6 +484,8 @@ importer.MediaImportHandler.ImportTask.prototype.sendImportStats_ = function() {
metrics.ImportEvents.FILE_COUNT
.value(importFileCount));
this.tracker_.send(metrics.ImportEvents.ERROR.value(this.errorCount_));
// Send aggregate deduplication timings, to avoid flooding analytics with one
// timing per file.
var deduplicatorStats = this.deduplicator_.getStatistics();
......
......@@ -84,7 +84,10 @@ metrics.ImportEvents = {
.action('Files Deduped By History'),
CONTENT_DEDUPE_COUNT: metrics.event.Builders_.IMPORT
.action('Files Deduped By Content')
.action('Files Deduped By Content'),
HISTORY_CHANGED: metrics.event.Builders_.IMPORT
.action('History Changed')
};
// namespace
......
......@@ -805,6 +805,8 @@ FileManager.prototype = /** @struct */ {
* @private
*/
FileManager.prototype.onHistoryChanged_ = function(event) {
this.tracker_.send(metrics.ImportEvents.HISTORY_CHANGED);
// Ignore any entry that isn't an immediate child of the
// current directory.
util.isChildEntry(event.entry, this.getCurrentDirectoryEntry())
......@@ -856,6 +858,19 @@ FileManager.prototype = /** @struct */ {
this.selectionHandler_.onFileSelectionChanged.bind(
this.selectionHandler_));
this.directoryModel_.addEventListener(
'directory-changed',
function(event) {
if (event.volumeChanged) {
var volumeInfo =
this.volumeManager_.getVolumeInfo(event.newDirEntry);
// NOTE: That dynamic values, like volume name MUST NOT
// be sent to GA as that value can contain PII.
// VolumeType is an enum.
this.tracker_.sendAppView(volumeInfo.volumeType());
}
}.bind(this));
// TODO(mtomasz, yoshiki): Create navigation list earlier, and here just
// attach the directory model.
this.initDirectoryTree_();
......
......@@ -235,7 +235,6 @@ importer.ImportController.prototype.onClick_ =
importer.ImportController.prototype.execute = function() {
console.assert(!this.activeImport_,
'Cannot execute while an import task is already active.');
// TODO(kenobi): Record import button clicked.
var scan = this.scanManager_.getActiveScan();
assert(scan != null);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment