Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROME_INSTALLER_UTIL_EXPERIMENT_METRICS_H_ | |
| 6 #define CHROME_INSTALLER_UTIL_EXPERIMENT_METRICS_H_ | |
| 7 | |
| 8 #include <stdint.h> | |
| 9 | |
| 10 namespace installer { | |
| 11 | |
| 12 // The various metrics reported for the status of the inactive user toast. This | |
| 13 // struct contains the information necessary to evaluate the efficacy of the | |
| 14 // toast on Chrome usage. | |
| 15 struct ExperimentMetrics { | |
| 16 public: | |
| 17 // The state of this install's participation in the experiment. | |
| 18 enum State { | |
| 19 kUninitialized = -1, | |
| 20 | |
| 21 // Relaunching setup.exe for a per-user install failed. Will retry on next | |
| 22 // update. | |
| 23 kRelaunchFailed = 0, | |
| 24 | |
| 25 // No user on console for per-machine install; waiting for invocation at | |
| 26 // next logon via Active Setup. | |
| 27 kWaitingForUserLogon = 1, | |
| 28 | |
| 29 // Waiting in user context for the setup singleton. | |
| 30 kWaitingForSingleton = 2, | |
| 31 | |
| 32 // Timed out waiting for the setup singleton. Will retry on next update. | |
| 33 kSingletonWaitTimeout = 3, | |
| 34 | |
| 35 // A group has been assigned. The experiment has moved out of the initial | |
| 36 // state at this point. This state is reached under the setup singleton. | |
| 37 kGroupAssigned = 4, | |
| 38 | |
| 39 // The user is not participating on account of using a tablet-like device. | |
| 40 kIsTabletDevice = 5, | |
| 41 | |
| 42 // Chrome has been run within the last 28 days. | |
| 43 kIsActive = 6, | |
| 44 | |
| 45 // The user has not been active on the machine much in the last 28 days. | |
| 46 kIsDormant = 7, | |
| 47 | |
| 48 // Deferring presentation until it's okay to show the toast. | |
| 49 kDeferringPresentation = 8, | |
| 50 | |
| 51 // Deferral was aborted on account of another process requiring the setup | |
| 52 // singleton. | |
| 53 kDeferredPresentationAborted = 9, | |
| 54 | |
| 55 // Launching Chrome for presentation. | |
| 56 kLaunchingChrome = 10, | |
| 57 | |
| 58 // User selected 'No Thanks' button from UI after toast was shown. | |
| 59 kSelectedNoThanks = 11, | |
| 60 | |
| 61 // User selected 'Open Chrome' button from UI after toast was shown but | |
| 62 // Chrome crashed after opening. | |
| 63 kSelectedOpenChromeAndCrash = 12, | |
| 64 | |
| 65 // User selected 'No Thanks' button from UI after toast was shown and | |
| 66 // user successfully opened chrome. | |
| 67 kSelectedOpenChromeAndNoCrash = 13, | |
| 68 | |
| 69 // User selected [x] button from display. | |
| 70 kSelectedClose = 14, | |
| 71 | |
| 72 // User logged off (gracefully) without interacting with toast. | |
| 73 kUserLogOff = 15, | |
| 74 | |
| 75 NUM_STATES | |
| 76 }; | |
| 77 | |
| 78 // The location of the toast for those clients for which it was presented. | |
| 79 enum ToastLocation { | |
| 80 // The toast was shown positioned over Chrome's taskbar pin. | |
| 81 kOverTaskbarPin = 0, | |
| 82 | |
| 83 // The toast was shown over the notification area. | |
| 84 kOverNotificationArea = 1, | |
| 85 }; | |
| 86 | |
| 87 // Returns true if the install is in any of the states that precede group | |
| 88 // assignment. | |
| 89 bool InInitialState() const; | |
| 90 | |
| 91 // Returns true if the install is in a terminal state and should no longer | |
| 92 // participate in the experiment. | |
| 93 bool InTerminalState() const; | |
| 94 | |
| 95 bool operator==(const ExperimentMetrics& other) const; | |
| 96 | |
| 97 // The number of experiment groups (including the holdback group). | |
| 98 static constexpr int kNumGroups = 16; | |
| 99 | |
| 100 // Unix epoch of time from when time bucket for experiment is started. | |
| 101 // This will be subtracted from the day the toast was shown to bucket user | |
| 102 // into cohorts for analysing retention. (13 Jun 2017 00:00:00 PST) | |
| 103 static constexpr int64_t kExperimentStartSeconds = 1497337200; | |
| 104 | |
| 105 // Maximum number of time toast should be displayed (3 bits). | |
| 106 static constexpr int kMaxToastCount = 7; | |
| 107 | |
| 108 // Maximum value of first toast offset. (10 bits). | |
| 109 static constexpr int kMaxFirstToastOffsetDays = 1023; | |
| 110 | |
| 111 // Maximum value of last used bucket. (7 bits, in days and log scale). | |
| 112 static constexpr int kMaxLastUsed = 1825; // 5 yr in days. | |
| 113 | |
| 114 // Maximum value of user session length. (6 bits, in minutes and log scale). | |
| 115 static constexpr int kMaxSessionLength = 40320; // 28 days in minutes. | |
| 116 | |
| 117 // Maximum value of user session length. (5 bits, in seconds and log scale). | |
| 118 static constexpr int kMaxActionDelay = 604800; // 7 days in seconds. | |
| 119 | |
| 120 static constexpr int kSessionLengthBucketBits = 6; | |
| 121 | |
| 122 static constexpr int kActionDelayBucketBits = 5; | |
| 123 | |
| 124 static constexpr int kLastUsedBucketBits = 7; | |
| 125 | |
| 126 static constexpr int kToastHourBits = 5; | |
| 127 | |
| 128 static constexpr int kFirstToastOffsetBits = 10; | |
| 129 | |
| 130 static constexpr int kToastCountBits = 3; | |
| 131 | |
| 132 static constexpr int kToastLocationBits = 1; | |
| 133 | |
| 134 static constexpr int kStateBits = 4; | |
| 135 | |
| 136 static constexpr int kGroupBits = 4; | |
| 137 | |
| 138 // The group to which this install has been assigned. | |
| 139 int group = 0; | |
| 140 | |
| 141 State state = kUninitialized; | |
| 142 ToastLocation toast_location = kOverTaskbarPin; | |
| 143 | |
| 144 // The number of times the toast has been presented. | |
| 145 int toast_count = 0; | |
| 146 | |
| 147 // The number of days that have passed since (25 May 2017 00:00:00 PST) on | |
|
grt (UTC plus 2)
2017/06/13 12:24:48
13 Jun
nikunjb
2017/06/13 21:27:53
Done.
| |
| 148 // the first day the toast was presented. | |
| 149 int first_toast_offset_days = 0; | |
| 150 | |
| 151 // The local (wall clock) hour in which the toast was presented. | |
| 152 int toast_hour = 0; | |
| 153 | |
| 154 // Days since the last time Chrome was used in the range [1-1825) in a | |
| 155 // 128-bucket log scale. | |
| 156 int last_used_bucket = 0; | |
| 157 | |
| 158 // Time delta (in seconds) between presentation and action in the range | |
| 159 // [1-604800) in a 32-bucket log scale. | |
| 160 int action_delay_bucket = 0; | |
| 161 | |
| 162 // Time delta (in minutes) between user session start and presentation in the | |
| 163 // range [1-40320) in a 64-bucket log scale. | |
| 164 int session_length_bucket = 0; | |
| 165 }; | |
| 166 | |
| 167 } // namespace installer | |
| 168 | |
| 169 #endif // CHROME_INSTALLER_UTIL_EXPERIMENT_METRICS_H_ | |
| OLD | NEW |