| OLD | NEW |
| (Empty) | |
| 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. |
| 4 |
| 5 var goog = {}; |
| 6 goog.async = {}; |
| 7 |
| 8 /** |
| 9 * @interface |
| 10 * @template VALUE |
| 11 */ |
| 12 goog.async.Deferred; |
| 13 |
| 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; |
| 21 |
| 22 var analytics = {}; |
| 23 |
| 24 /** @typedef {string} */ |
| 25 analytics.HitType; |
| 26 |
| 27 /** @enum {analytics.HitType} */ |
| 28 analytics.HitTypes = { |
| 29 APPVIEW: 'appview', |
| 30 EVENT: 'event', |
| 31 SOCIAL: 'social', |
| 32 TRANSACTION: 'transaction', |
| 33 ITEM: 'item', |
| 34 TIMING: 'timing', |
| 35 EXCEPTION: 'exception' |
| 36 }; |
| 37 |
| 38 /** |
| 39 * @typedef {{ |
| 40 * id: string, |
| 41 * name: string, |
| 42 * valueType: analytics.ValueType, |
| 43 * maxLength: (number|undefined), |
| 44 * defaultValue: (string|undefined) |
| 45 * }} |
| 46 */ |
| 47 analytics.Parameter; |
| 48 |
| 49 /** @typedef {string|number|boolean} */ |
| 50 analytics.Value; |
| 51 |
| 52 /** @typedef {string} */ |
| 53 analytics.ValueType; |
| 54 |
| 55 |
| 56 /** |
| 57 * @param {string} appName |
| 58 * @param {string=} opt_appVersion |
| 59 * @return {!analytics.GoogleAnalytics} |
| 60 */ |
| 61 analytics.getService; |
| 62 |
| 63 |
| 64 /** @interface */ |
| 65 analytics.GoogleAnalytics; |
| 66 |
| 67 /** |
| 68 * @param {string} trackingId |
| 69 * @return {!analytics.Tracker} |
| 70 */ |
| 71 analytics.GoogleAnalytics.prototype.getTracker; |
| 72 |
| 73 /** @return {!goog.async.Deferred.<!analytics.Config>} */ |
| 74 analytics.GoogleAnalytics.prototype.getConfig; |
| 75 |
| 76 |
| 77 /** @interface */ |
| 78 analytics.Tracker; |
| 79 |
| 80 /** @typedef {function(!analytics.Tracker.Hit)} */ |
| 81 analytics.Tracker.Filter; |
| 82 |
| 83 /** |
| 84 * @param {!analytics.HitType|!analytics.EventBuilder} hitType |
| 85 * @param {(!analytics.ParameterMap| |
| 86 * !Object.<string, !analytics.Value>)=} opt_extraParams |
| 87 * @return {!goog.async.Deferred} |
| 88 */ |
| 89 analytics.Tracker.prototype.send; |
| 90 |
| 91 /** |
| 92 * @param {string} description |
| 93 * @return {!goog.async.Deferred} |
| 94 */ |
| 95 analytics.Tracker.prototype.sendAppView; |
| 96 |
| 97 /** |
| 98 * @param {string} category |
| 99 * @param {string} action |
| 100 * @param {string=} opt_label |
| 101 * @param {number=} opt_value |
| 102 * @return {!goog.async.Deferred} |
| 103 */ |
| 104 analytics.Tracker.prototype.sendEvent; |
| 105 |
| 106 /** |
| 107 * @param {string} network Specifies the social network, for example Facebook |
| 108 * or Google Plus. |
| 109 * @param {string} action Specifies the social interaction action. |
| 110 * For example on Google Plus when a user clicks the +1 button, |
| 111 * the social action is 'plus'. |
| 112 * @param {string} target Specifies the target of a social interaction. |
| 113 * This value is typically a URL but can be any text. |
| 114 * @return {!goog.async.Deferred} |
| 115 */ |
| 116 analytics.Tracker.prototype.sendSocial; |
| 117 |
| 118 /** |
| 119 * @param {string=} opt_description Specifies the description of an exception. |
| 120 * @param {boolean=} opt_fatal Was the exception fatal. |
| 121 * @return {!goog.async.Deferred} |
| 122 */ |
| 123 analytics.Tracker.prototype.sendException; |
| 124 |
| 125 /** |
| 126 * @param {string} category Specifies the category of the timing. |
| 127 * @param {string} variable Specifies the variable name of the timing. |
| 128 * @param {number} value Specifies the value of the timing. |
| 129 * @param {string=} opt_label Specifies the optional label of the timing. |
| 130 * @param {number=} opt_sampleRate |
| 131 * @return {!goog.async.Deferred} |
| 132 */ |
| 133 analytics.Tracker.prototype.sendTiming; |
| 134 |
| 135 analytics.Tracker.prototype.forceSessionStart; |
| 136 |
| 137 /** |
| 138 * @param {string} category |
| 139 * @param {string} variable |
| 140 * @param {string=} opt_label |
| 141 * @param {number=} opt_sampleRate |
| 142 * @return {!analytics.Tracker.Timing} |
| 143 */ |
| 144 analytics.Tracker.prototype.startTiming; |
| 145 |
| 146 /** @interface */ |
| 147 analytics.Tracker.Timing; |
| 148 |
| 149 /** @return {!goog.async.Deferred} */ |
| 150 analytics.Tracker.Timing.prototype.send; |
| 151 |
| 152 /** @param {!analytics.Tracker.Filter} filter */ |
| 153 analytics.Tracker.prototype.addFilter; |
| 154 |
| 155 /** @interface */ |
| 156 analytics.Tracker.Hit; |
| 157 |
| 158 /** @return {!analytics.HitType} */ |
| 159 analytics.Tracker.Hit.prototype.getHitType; |
| 160 |
| 161 /** @return {!analytics.ParameterMap} */ |
| 162 analytics.Tracker.Hit.prototype.getParameters; |
| 163 |
| 164 analytics.Tracker.Hit.prototype.cancel; |
| 165 |
| 166 |
| 167 /** @interface */ |
| 168 analytics.Config = function() {}; |
| 169 |
| 170 /** @param {boolean} permitted */ |
| 171 analytics.Config.prototype.setTrackingPermitted; |
| 172 |
| 173 /** @return {boolean} */ |
| 174 analytics.Config.prototype.isTrackingPermitted; |
| 175 |
| 176 /** @param {number} sampleRate */ |
| 177 analytics.Config.prototype.setSampleRate; |
| 178 |
| 179 |
| 180 /** @interface */ |
| 181 analytics.ParameterMap; |
| 182 |
| 183 /** |
| 184 * @typedef {{ |
| 185 * key: !analytics.Parameter, |
| 186 * value: !analytics.Value |
| 187 * }} |
| 188 */ |
| 189 analytics.ParameterMap.Entry; |
| 190 |
| 191 /** |
| 192 * @param {!analytics.Parameter} param |
| 193 * @param {!analytics.Value} value |
| 194 */ |
| 195 analytics.ParameterMap.prototype.set; |
| 196 |
| 197 /** |
| 198 * @param {!analytics.Parameter} param |
| 199 * @return {?analytics.Value} |
| 200 */ |
| 201 analytics.ParameterMap.prototype.get; |
| 202 |
| 203 /** @param {!analytics.Parameter} param */ |
| 204 analytics.ParameterMap.prototype.remove; |
| 205 |
| 206 /** @return {!Object.<string, analytics.Value>} */ |
| 207 analytics.ParameterMap.prototype.toObject; |
| 208 |
| 209 |
| 210 /** @interface */ |
| 211 analytics.EventBuilder; |
| 212 |
| 213 /** @typedef {{ index: number, value: string }} */ |
| 214 analytics.EventBuilder.Dimension; |
| 215 |
| 216 /** @typedef {{ index: number, value: number }} */ |
| 217 analytics.EventBuilder.Metric; |
| 218 |
| 219 /** @return {!analytics.EventBuilder} */ |
| 220 analytics.EventBuilder.builder; |
| 221 |
| 222 /** |
| 223 * @param {string} category |
| 224 * @return {!analytics.EventBuilder} |
| 225 */ |
| 226 analytics.EventBuilder.prototype.category; |
| 227 |
| 228 /** |
| 229 * @param {string} action |
| 230 * @return {!analytics.EventBuilder} |
| 231 */ |
| 232 analytics.EventBuilder.prototype.action; |
| 233 |
| 234 /** |
| 235 * @param {string} label |
| 236 * @return {!analytics.EventBuilder} |
| 237 */ |
| 238 analytics.EventBuilder.prototype.label; |
| 239 |
| 240 /** |
| 241 * @param {number} value |
| 242 * @return {!analytics.EventBuilder} |
| 243 */ |
| 244 analytics.EventBuilder.prototype.value; |
| 245 |
| 246 /** |
| 247 * @param {!analytics.EventBuilder.Dimension} dimension |
| 248 * @return {!analytics.EventBuilder} |
| 249 */ |
| 250 analytics.EventBuilder.prototype.dimension; |
| 251 |
| 252 /** |
| 253 * @param {!analytics.EventBuilder.Metric} metric |
| 254 * @return {!analytics.EventBuilder} |
| 255 */ |
| 256 analytics.EventBuilder.prototype.metric; |
| 257 |
| 258 /** |
| 259 * @param {!analytics.Tracker} tracker |
| 260 * @return {!goog.async.Deferred} |
| 261 */ |
| 262 analytics.EventBuilder.prototype.send; |
| 263 |
| 264 /** @param {!analytics.ParameterMap} parameters */ |
| 265 analytics.EventBuilder.prototype.collect; |
| OLD | NEW |