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 void SetState(State state); | |
95 | |
96 // The number of experiment groups (including the holdback group). | |
97 static constexpr int kNumGroups = 16; | |
98 | |
99 // Unix epoch of time from when time bucket for experiment is started. | |
100 // This will be subtracted from the day the toast was shown to bucket user | |
101 // into cohorts for analysing retention. (25 May 2017 00:00:00 PST) | |
grt (UTC plus 2)
2017/05/31 12:24:09
PST -> UTC? base::Time is in UTC
nikunjb
2017/06/02 05:11:23
The value is used to create TimeDelta which is tz
grt (UTC plus 2)
2017/06/02 11:30:45
Groovy. Since it's an offset from the Unix epoch (
| |
102 static constexpr int64_t kExperimentStartSeconds = 1495695600L; | |
grt (UTC plus 2)
2017/05/31 12:24:09
nit: remove 'L'
nikunjb
2017/06/02 05:11:23
Done.
| |
103 | |
104 // Maximum number of time toast should be displayed (3 bits). | |
105 static constexpr int kMaxToastCount = 7; | |
106 | |
107 // Maximum value of first toast offset. (10 bits). | |
108 static constexpr int kMaxFirstToastOffset = 1023; | |
109 | |
110 // Maximum value of last used bucket. (7 bits, log scale). | |
111 static constexpr int kMaxLastUsed = 1825; // 5 yr in days. | |
112 | |
113 // Maximum value of user session length. (6 bits, in minutes and log scale). | |
114 static constexpr int kMaxSessionLength = 40320; // 28 days in minutes. | |
115 | |
116 // Maximum value of user session length. (5 bits, in seconds and log scale). | |
117 static constexpr int kMaxDisplayTime = 604800; // 7 days in seconds. | |
118 | |
119 static constexpr int kSessionLengthBits = 6; | |
120 | |
121 static constexpr int kDisplayTimeBucketBits = 5; | |
122 | |
123 static constexpr int kLastUsedBucketBits = 7; | |
124 | |
125 static constexpr int kToastHourBits = 5; | |
126 | |
127 static constexpr int kFirstToastOffsetBits = 10; | |
128 | |
129 static constexpr int kToastCountBits = 3; | |
130 | |
131 static constexpr int kToastLocationBits = 1; | |
132 | |
133 static constexpr int kStateBits = 4; | |
134 | |
135 static constexpr int kGroupBits = 4; | |
136 | |
137 // The group to which this install has been assigned. | |
138 int group = 0; | |
139 | |
140 State state = kUninitialized; | |
141 ToastLocation toast_location = kOverTaskbarPin; | |
142 | |
143 // The number of times the toast has been presented. | |
144 int toast_count = 0; | |
145 | |
146 // The number of days that have passed since 2017-05-20 on the first day the | |
grt (UTC plus 2)
2017/05/31 12:24:09
20 -> 25
nikunjb
2017/06/02 05:11:23
Done.
| |
147 // toast was presented. | |
148 int first_toast_offset = 0; | |
149 | |
150 // The local (wall clock) hour in which the toast was presented. | |
151 int toast_hour = 0; | |
152 | |
153 // Days since the last time Chrome was used in the range [1-1825) in a | |
154 // 128-bucket log scale. | |
155 int last_used_bucket = 0; | |
156 | |
157 // Time delta (in seconds) between presentation and action in the range | |
158 // [1-604800) in a 32-bucket log scale. | |
159 int display_time_bucket = 0; | |
160 | |
161 // Time delta (in minutes) between user session start and presentation in the | |
162 // range [1-40320) in a 64-bucket log scale. | |
163 int session_length_bucket = 0; | |
164 }; | |
165 | |
166 } // namespace installer | |
167 | |
168 #endif // CHROME_INSTALLER_UTIL_EXPERIMENT_METRICS_H_ | |
OLD | NEW |