• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// Copyright 2024 The Chromium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5syntax = "proto2";
6
7option optimize_for = LITE_RUNTIME;
8option java_package = "org.chromium.components.metrics";
9
10option java_outer_classname = "DeidentifiedWebAnalyticsProtos";
11
12package dwa;
13
14import "system_profile.proto";
15
16// A report containing deidentified web analytics data. One report is sent per
17// 5-30 minutes depending on the client.
18// Next tag: 6
19message DeidentifiedWebAnalyticsReport {
20  optional CoarseSystemInfo coarse_system_info = 1;
21
22  // Temporary identifier that gets generated once a day.
23  optional fixed64 dwa_ephemeral_id = 2;
24
25  // A list of page load events, one entry per page load.
26  // This field should be cleared when a report is sent, its content should be
27  // encrypted and placed in encrypted_page_load_events.
28  repeated PageLoadEvents page_load_events = 3;
29
30  // A list of encrypted page load events, one entry per page load.
31  repeated EncryptedPageLoadEvents encrypted_page_load_events = 4;
32
33  // Unix timestamp of when the report was generated and sent.
34  optional int64 timestamp = 5;
35}
36
37// All fields in this message should be populated by the client before sending
38// the report to comply with the entropy requirements (an unset field
39// essentially increases entropy).
40// Next tag: 7
41message CoarseSystemInfo {
42  // Stable or not-stable channel, 1 bit allocated.
43  // CHANNEL_INVALID is an invalid value and should never used. The client
44  // should check the value before sending the report.
45  enum Channel {
46    CHANNEL_INVALID = 0;
47    CHANNEL_STABLE = 1;
48    CHANNEL_NOT_STABLE = 2;
49  }
50  optional Channel channel = 1;
51
52  // Platform and activity type, 4 bits allocated.
53  // PLATFORM_INVALID is an invalid value and should never used. The client
54  // should check the value before sending the report.
55  enum Platform {
56    PLATFORM_INVALID = 0;
57    PLATFORM_OTHER = 1;
58    PLATFORM_ANDROID_WEBVIEW = 2;
59    PLATFORM_ANDROID_BROWSER_APP = 3;
60    PLATFORM_ANDROID_CCT = 4;
61    PLATFORM_ANDROID_PWA = 5;
62    PLATFORM_ANDROID_TWA = 6;
63    PLATFORM_IOS = 7;
64    PLATFORM_WINDOWS = 8;
65    PLATFORM_MACOS = 9;
66    PLATFORM_LINUX = 10;
67    PLATFORM_CHROMEOS = 11;
68    PLATFORM_ANDROID = 12;
69  }
70  optional Platform platform = 2;
71
72  // Geo designation, 1 bit allocated.
73  // GEO_DESIGNATION_INVALID is an invalid value and should never used. The
74  // client should check the value before sending the report.
75  enum GeoDesignation {
76    GEO_DESIGNATION_INVALID = 0;
77    GEO_DESIGNATION_EEA = 1;  // Countries under the European Economic Area.
78    GEO_DESIGNATION_ROW = 2;  // Rest of the world.
79  }
80  optional GeoDesignation geo_designation = 3;
81
82  // An indicator of whether this is a recent (week old) client install or
83  // not, 1 bit allocated.
84  // Note that what "recent" means could potentially change in the future
85  // without changing the enum value as that would increase entropy.
86  // When analyzing data, always check for changes in what recent means for
87  // each milestone.
88  // CLIENT_AGE_INVALID is an invalid value and should never used. The client
89  // should check the value before sending the report.
90  enum ClientAge {
91    CLIENT_AGE_INVALID = 0;
92    CLIENT_AGE_RECENT = 1;
93    CLIENT_AGE_NOT_RECENT = 2;
94  }
95  optional ClientAge client_age = 4;
96
97  // First 3 digits of the milestone mod (%) 16, 4 bits allocated.
98  optional int32 milestone_prefix_trimmed = 5;
99
100  // Whether UKM logging is enabled, 1 bit allocated.
101  optional bool is_ukm_enabled = 6;
102}
103
104// Events that occurred in a single page load.
105message PageLoadEvents {
106  repeated DeidentifiedWebAnalyticsEvent events = 1;
107}
108
109// A container for a list of encrypted page load events.
110message EncryptedPageLoadEvents {
111  // A container for an encrypted page load event.
112  message EncryptedPageLoadEvent {
113    // A container for an encrypted deidentified web analytics event, each
114    // container corresponds to a single deidentified web analytics event and a
115    // hash of the field trials associated with that event.
116    message EncryptedDeidentifiedWebAnalyticsEvent {
117      optional bytes encrypted_event = 1;
118      optional fixed64 field_trials_hash = 2;
119      // Same as DeidentifiedWebAnalyticsEvent.event_hash.
120      optional fixed64 event_hash = 3;
121    }
122    repeated EncryptedDeidentifiedWebAnalyticsEvent
123        encrypted_deidentified_web_analytics_events = 1;
124  }
125  repeated EncryptedPageLoadEvent encrypted_page_load_events = 1;
126}
127
128message DeidentifiedWebAnalyticsEvent {
129  // A hash of the event name/type (such as "ReportingAPIUsage").
130  // Uses the same hash function as UMA.
131  // http://cs.chromium.org/chromium/src/base/metrics/metrics_hashes.cc?q=HashMetricName
132  optional fixed64 event_hash = 1;
133
134  // The type of content that the event is associated with.
135  // CONTENT_TYPE_INVALID is an invalid value and should never used. The
136  // client should check the value before sending the report.
137  message ContentMetric {
138    enum ContentType {
139      CONTENT_TYPE_INVALID = 0;
140
141      // The content is a URL.
142      CONTENT_TYPE_URL = 1;
143    }
144    optional ContentType content_type = 1;
145
146    // A hash of the content (e.g. hash("example.com")).
147    // Uses the same hash function as UMA.
148    // http://cs.chromium.org/chromium/src/base/metrics/metrics_hashes.cc?q=HashMetricName
149    optional fixed64 content_hash = 2;
150
151    // A set of metrics collected as part of a single entry. A single entry
152    // defines a series of metrics collected in one instance.
153    // https://source.chromium.org/chromium/chromium/src/+/main:components/metrics/dwa/mojom/dwa_interface.mojom
154    message EntryMetrics {
155      // A single metric, which is defined by a name hash and a value.
156      message Metric {
157        optional fixed64 name_hash = 1;
158        optional int64 value = 2;
159      }
160
161      repeated Metric metric = 1;
162    }
163
164    // Metrics associated with the content.
165    repeated EntryMetrics metrics = 3;
166  }
167  repeated ContentMetric content_metrics = 2;
168
169  // Field trials that we want to associate with this event, name id and
170  // group id behave the same as in UMA.
171  repeated metrics.SystemProfileProto.FieldTrial field_trials = 3;
172}
173