Add ICU message format support
[chromium-blink-merge.git] / third_party / analytics / externs.js
blobd4bcce96a847127817dd8d5f57b9ff4c27f2b8fe
1 // Copyright (c) 2015 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.
5 var goog = {};
6 goog.async = {};
8 /**
9  * @constructor
10  * @template VALUE
11  */
12 goog.async.Deferred;
14 /**
15  * @param {!function(this:T,VALUE):?} cb
16  * @param {T=} opt_scope
17  * @return {!goog.async.Deferred}
18  * @template T
19  */
20 goog.async.Deferred.prototype.addCallback;
22 /** @param {VALUE=} opt_result */
23 goog.async.Deferred.prototype.callback;
25 /**
26  * @param {?(function(this:THIS, VALUE):
27  *             (RESULT|IThenable<RESULT>|Thenable))=} opt_onFulfilled
28  * @param {?(function(this:THIS, *): *)=} opt_onRejected
29  * @param {THIS=} opt_context
30  * @return {!Promise<RESULT>}
31  * @template RESULT,THIS
32  */
33 goog.async.Deferred.prototype.then;
35 var analytics = {};
37 /** @typedef {string} */
38 analytics.HitType;
40 /** @enum {analytics.HitType} */
41 analytics.HitTypes = {
42   APPVIEW: 'appview',
43   EVENT: 'event',
44   SOCIAL: 'social',
45   TRANSACTION: 'transaction',
46   ITEM: 'item',
47   TIMING: 'timing',
48   EXCEPTION: 'exception'
51 /**
52  * @typedef {{
53  *   id: string,
54  *   name: string,
55  *   valueType: analytics.ValueType,
56  *   maxLength: (number|undefined),
57  *   defaultValue: (string|undefined)
58  * }}
59  */
60 analytics.Parameter;
62 /** @typedef {string|number|boolean} */
63 analytics.Value;
65 /** @typedef {string} */
66 analytics.ValueType;
69 /**
70  * @param {string} appName
71  * @param {string=} opt_appVersion
72  * @return {!analytics.GoogleAnalytics}
73  */
74 analytics.getService;
77 /** @interface */
78 analytics.GoogleAnalytics;
80 /**
81  * @param {string} trackingId
82  * @return {!analytics.Tracker}
83  */
84 analytics.GoogleAnalytics.prototype.getTracker;
86 /** @return {!goog.async.Deferred.<!analytics.Config>} */
87 analytics.GoogleAnalytics.prototype.getConfig;
90 /** @interface */
91 analytics.Tracker;
93 /** @typedef {function(!analytics.Tracker.Hit)} */
94 analytics.Tracker.Filter;
96 /**
97  * @param {!analytics.HitType|!analytics.EventBuilder} hitType
98  * @param {(!analytics.ParameterMap|
99  *     !Object.<string, !analytics.Value>)=} opt_extraParams
100  * @return {!goog.async.Deferred}
101  */
102 analytics.Tracker.prototype.send;
105  * @param {string} description
106  * @return {!goog.async.Deferred}
107  */
108 analytics.Tracker.prototype.sendAppView;
111  * @param {string} category
112  * @param {string} action
113  * @param {string=} opt_label
114  * @param {number=} opt_value
115  * @return {!goog.async.Deferred}
116  */
117 analytics.Tracker.prototype.sendEvent;
120  * @param {string} network Specifies the social network, for example Facebook
121  *     or Google Plus.
122  * @param {string} action Specifies the social interaction action.
123  *     For example on Google Plus when a user clicks the +1 button,
124  *     the social action is 'plus'.
125  * @param {string} target Specifies the target of a social interaction.
126  *     This value is typically a URL but can be any text.
127  * @return {!goog.async.Deferred}
128  */
129 analytics.Tracker.prototype.sendSocial;
132  * @param {string=} opt_description Specifies the description of an exception.
133  * @param {boolean=} opt_fatal Was the exception fatal.
134  * @return {!goog.async.Deferred}
135  */
136 analytics.Tracker.prototype.sendException;
139  * @param {string} category Specifies the category of the timing.
140  * @param {string} variable Specifies the variable name of the timing.
141  * @param {number} value Specifies the value of the timing.
142  * @param {string=} opt_label Specifies the optional label of the timing.
143  * @param {number=} opt_sampleRate
144  * @return {!goog.async.Deferred}
145  */
146 analytics.Tracker.prototype.sendTiming;
148 analytics.Tracker.prototype.forceSessionStart;
151  * @param {string} category
152  * @param {string} variable
153  * @param {string=} opt_label
154  * @param {number=} opt_sampleRate
155  * @return {!analytics.Tracker.Timing}
156  */
157 analytics.Tracker.prototype.startTiming;
159 /** @interface */
160 analytics.Tracker.Timing;
162 /** @return {!goog.async.Deferred} */
163 analytics.Tracker.Timing.prototype.send;
165 /** @param {!analytics.Tracker.Filter} filter */
166 analytics.Tracker.prototype.addFilter;
168 /** @interface */
169 analytics.Tracker.Hit;
171 /** @return {!analytics.HitType} */
172 analytics.Tracker.Hit.prototype.getHitType;
174 /** @return {!analytics.ParameterMap} */
175 analytics.Tracker.Hit.prototype.getParameters;
177 analytics.Tracker.Hit.prototype.cancel;
180 /** @interface */
181 analytics.Config = function() {};
183 /** @param {boolean} permitted */
184 analytics.Config.prototype.setTrackingPermitted;
186 /** @return {boolean} */
187 analytics.Config.prototype.isTrackingPermitted;
189 /** @param {number} sampleRate */
190 analytics.Config.prototype.setSampleRate;
192 /** @return {!goog.async.Deferred} Settles once the id has been reset. */
193 analytics.Config.prototype.resetUserId;
196 /** @interface */
197 analytics.ParameterMap;
200  * @typedef {{
201  *   key: !analytics.Parameter,
202  *   value: !analytics.Value
203  * }}
204  */
205 analytics.ParameterMap.Entry;
208  * @param {!analytics.Parameter} param
209  * @param {!analytics.Value} value
210  */
211 analytics.ParameterMap.prototype.set;
214  * @param {!analytics.Parameter} param
215  * @return {?analytics.Value}
216  */
217 analytics.ParameterMap.prototype.get;
219 /** @param {!analytics.Parameter} param */
220 analytics.ParameterMap.prototype.remove;
222 /** @return {!Object.<string, analytics.Value>} */
223 analytics.ParameterMap.prototype.toObject;
226 /** @interface */
227 analytics.EventBuilder;
229 /** @typedef {{ index: number, value: string }} */
230 analytics.EventBuilder.Dimension;
232 /** @typedef {{ index: number, value: number }} */
233 analytics.EventBuilder.Metric;
235 /** @return {!analytics.EventBuilder} */
236 analytics.EventBuilder.builder;
239  * @param {string} category
240  * @return {!analytics.EventBuilder}
241  */
242 analytics.EventBuilder.prototype.category;
245  * @param {string} action
246  * @return {!analytics.EventBuilder}
247  */
248 analytics.EventBuilder.prototype.action;
251  * @param {string} label
252  * @return {!analytics.EventBuilder}
253  */
254 analytics.EventBuilder.prototype.label;
257  * @param {number} value
258  * @return {!analytics.EventBuilder}
259  */
260 analytics.EventBuilder.prototype.value;
263  * @param {!analytics.EventBuilder.Dimension} dimension
264  * @return {!analytics.EventBuilder}
265  */
266 analytics.EventBuilder.prototype.dimension;
269  * @param {!analytics.EventBuilder.Metric} metric
270  * @return {!analytics.EventBuilder}
271  */
272 analytics.EventBuilder.prototype.metric;
275  * @param {!analytics.Tracker} tracker
276  * @return {!goog.async.Deferred}
277  */
278 analytics.EventBuilder.prototype.send;
280 /** @param {!analytics.ParameterMap} parameters */
281 analytics.EventBuilder.prototype.collect;