@@ -36,8 +36,12 @@ export const provider = 'google.analytics';
3636export const service = 'app-measurement.com' ;
3737
3838/**
39- * Select analytics events to listen to for events.
40- * @param analyticsEventType Name of the analytics event type.
39+ * Registers a function to handle analytics events.
40+ *
41+ * @param analyticsEventType Name of the analytics event type to which
42+ * this Cloud Function is scoped.
43+ *
44+ * @return Analytics event builder interface.
4145 */
4246export function event ( analyticsEventType : string ) {
4347 return _eventWithOptions ( analyticsEventType , { } ) ;
@@ -61,7 +65,7 @@ export function _eventWithOptions(
6165/**
6266 * The Firebase Analytics event builder interface.
6367 *
64- * Access via [`functions.analytics.event()`](functions.analytics#event).
68+ * Access via [`functions.analytics.event()`](functions.analytics#. event).
6569 */
6670export class AnalyticsEventBuilder {
6771 /** @hidden */
@@ -73,12 +77,10 @@ export class AnalyticsEventBuilder {
7377 /**
7478 * Event handler that fires every time a Firebase Analytics event occurs.
7579 *
76- * @param {!function(!functions.Event<!functions.analytics.AnalyticsEvent>) }
77- * handler Event handler that fires every time a Firebase Analytics event
80+ * @param handler Event handler that fires every time a Firebase Analytics event
7881 * occurs.
7982 *
80- * @return {!functions.CloudFunction<!functions.analytics.AnalyticsEvent> } A
81- * Cloud Function you can export.
83+ * @return A function that you can export and deploy.
8284 */
8385 onLog (
8486 handler : (
@@ -102,13 +104,11 @@ export class AnalyticsEventBuilder {
102104 }
103105}
104106
105- /**
106- * Interface representing a Firebase Analytics event that was logged for a specific user.
107- */
107+ /** Interface representing a Firebase Analytics event that was logged for a specific user. */
108108export class AnalyticsEvent {
109109 /**
110- * The date on which the event.was logged.
111- * (`YYYYMMDD` format in the registered timezone of your app).
110+ * The date on which the event.was logged.
111+ * (`YYYYMMDD` format in the registered timezone of your app).
112112 */
113113 reportingDate : string ;
114114
@@ -232,11 +232,9 @@ export class UserDimensions {
232232 }
233233}
234234
235- /**
236- * Predefined or custom properties stored on the client side.
237- */
235+ /** Predefined or custom properties stored on the client side. */
238236export class UserPropertyValue {
239- /** Last set value of a user property. */
237+ /** The last set value of a user property. */
240238 value : string ;
241239
242240 /** UTC client time when the user property was last set. */
@@ -250,47 +248,55 @@ export class UserPropertyValue {
250248}
251249
252250/**
253- * Interface representing the device that triggered these Firebase Analytics events.
251+ * Interface representing the device that triggered these
252+ * Firebase Analytics events.
254253 */
255254export interface DeviceInfo {
256255 /**
257256 * Device category.
257+ *
258258 * Examples: "tablet" or "mobile".
259259 */
260260 deviceCategory ?: string ;
261261
262262 /**
263263 * Device brand name.
264+ *
264265 * Examples: "Samsung", "HTC"
265266 */
266267 mobileBrandName ?: string ;
267268
268269 /**
269270 * Device model name in human-readable format.
271+ *
270272 * Example: "iPhone 7"
271273 */
272274 mobileModelName ?: string ;
273275
274276 /**
275277 * Device marketing name.
278+ *
276279 * Example: "Galaxy S4 Mini"
277280 */
278281 mobileMarketingName ?: string ;
279282
280283 /**
281284 * Device model, as read from the OS.
285+ *
282286 * Example: "iPhone9,1"
283287 */
284288 deviceModel ?: string ;
285289
286290 /**
287291 * Device OS version when data capture ended.
292+ *
288293 * Example: "4.4.2"
289294 */
290295 platformVersion ?: string ;
291296
292297 /**
293298 * Vendor specific device identifier. This is IDFV on iOS. Not used for Android.
299+ *
294300 * Example: '599F9C00-92DC-4B5C-9464-7971F01F8370'
295301 */
296302 deviceId ?: string ;
@@ -313,69 +319,86 @@ export interface DeviceInfo {
313319
314320 /**
315321 * The time zone of the device when data was uploaded, as seconds skew from UTC.
316- * Use this to calculate the device's local time for [`event.timestamp`](functions.Event#timestamp)` .
322+ * Use this to calculate the device's local time for [`event.timestamp`](functions.Event#timestamp).
317323 */
318324 deviceTimeZoneOffsetSeconds : number ;
319325
320326 /**
321327 * The device's Limit Ad Tracking setting.
322328 * When `true`, you cannot use `resettableDeviceId` for remarketing, demographics or influencing ads serving
323- * behaviour. However, you can use resettableDeviceId for conversion tracking and campaign attribution.
329+ * behaviour. However, you can use ` resettableDeviceId` for conversion tracking and campaign attribution.
324330 */
325331 limitedAdTracking : boolean ;
326332}
327333
328- /**
329- * Interface representing the geographic origin of the events.
330- */
334+ /** Interface representing the geographic origin of the events. */
331335export interface GeoInfo {
332- /** The geographic continent. Example: "Americas". */
336+ /**
337+ * The geographic continent.
338+ *
339+ * Example: "South America".
340+ */
333341 continent ?: string ;
334342
335- /** The geographic country. Example: "Brazil". */
343+ /**
344+ * The geographic country.
345+ *
346+ * Example: "Brazil".
347+ */
336348 country ?: string ;
337349
338- /** The geographic region. Example: "State of Sao Paulo". */
350+ /**
351+ * The geographic region.
352+ *
353+ * Example: "State of Sao Paulo".
354+ */
339355 region ?: string ;
340356
341- /** The geographic city. Example: "Sao Paulo". */
357+ /**
358+ * The geographic city.
359+ *
360+ * Example: "Sao Paulo".
361+ */
342362 city ?: string ;
343363}
344364
345- /**
346- * Interface representing the application that triggered these events.
347- */
365+ /** Interface representing the application that triggered these events. */
348366export interface AppInfo {
349367 /**
350- * The app's version name.
351- * Examples: "1.0", "4.3.1.1.213361", "2.3 (1824253)", "v1.8b22p6".
368+ * The app's version name.
369+ *
370+ * Examples: "1.0", "4.3.1.1.213361", "2.3 (1824253)", "v1.8b22p6".
352371 */
353372 appVersion ?: string ;
354373
355374 /**
356- * Unique id for this instance of the app.
357- * Example: "71683BF9FA3B4B0D9535A1F05188BAF3".
375+ * Unique ID for this instance of the app.
376+ *
377+ * Example: "71683BF9FA3B4B0D9535A1F05188BAF3".
358378 */
359379 appInstanceId : string ;
360380
361381 /**
362- * The identifier of the store that installed the app.
363- * Examples: "com.sec.android.app.samsungapps", "com.amazon.venezia", "com.nokia.nstore".
382+ * The identifier of the store that installed the app.
383+ *
384+ * Examples: "com.sec.android.app.samsungapps", "com.amazon.venezia", "com.nokia.nstore".
364385 */
365386 appStore ?: string ;
366387
367- /** The app platform. Examples: "ANDROID", "IOS". */
388+ /**
389+ * The app platform.
390+ *
391+ * Examples: "ANDROID", "IOS".
392+ */
368393 appPlatform : string ;
369394
370395 /** Unique application identifier within an app store. */
371396 appId ?: string ;
372397}
373398
374- /**
375- * Interface representing the bundle in which these events were uploaded.
376- */
399+ /** Interface representing the bundle these events were uploaded to. */
377400export class ExportBundleInfo {
378- /** Monotonically increasing index for each bundle set by the Analytics SDK. */
401+ /** Monotonically increasing index for each bundle set by the Analytics SDK. */
379402 bundleSequenceId : number ;
380403
381404 /** Timestamp offset (in milliseconds) between collection time and upload time. */
@@ -393,6 +416,7 @@ export class ExportBundleInfo {
393416 }
394417}
395418
419+ /** @hidden */
396420function copyFieldTo < T , K extends keyof T > (
397421 from : any ,
398422 to : T ,
@@ -405,6 +429,7 @@ function copyFieldTo<T, K extends keyof T>(
405429 }
406430}
407431
432+ /** @hidden */
408433function copyField < T , K extends keyof T > (
409434 from : any ,
410435 to : T ,
@@ -414,6 +439,7 @@ function copyField<T, K extends keyof T>(
414439 copyFieldTo ( from , to , field as string , field , transform ) ;
415440}
416441
442+ /** @hidden */
417443function copyFields < T , K extends keyof T > ( from : any , to : T , fields : K [ ] ) : void {
418444 for ( const field of fields ) {
419445 copyField ( from , to , field ) ;
@@ -449,10 +475,12 @@ function copyFields<T, K extends keyof T>(from: any, to: T, fields: K[]): void {
449475// is due to the encoding library, which renders int64 values as strings to avoid loss of precision. This
450476// method always returns a string, similarly to avoid loss of precision, unlike the less-conservative
451477// 'unwrapValue' method just below.
478+ /** @hidden */
452479function unwrapValueAsString ( wrapped : any ) : string {
453480 const key : string = _ . keys ( wrapped ) [ 0 ] ;
454481 return _ . toString ( wrapped [ key ] ) ;
455482}
483+
456484// Ditto as the method above, but returning the values in the idiomatic JavaScript type (string for strings,
457485// number for numbers):
458486// {
@@ -466,7 +494,10 @@ function unwrapValueAsString(wrapped: any): string {
466494// purposes can be divided into 'number' versus 'string'. This method will render all the numbers as
467495// JavaScript's 'number' type, since we prefer using idiomatic types. Note that this may lead to loss
468496// in precision for int64 fields, so use with care.
497+ /** @hidden */
469498const xValueNumberFields = [ 'intValue' , 'floatValue' , 'doubleValue' ] ;
499+
500+ /** @hidden */
470501function unwrapValue ( wrapped : any ) : any {
471502 const key : string = _ . keys ( wrapped ) [ 0 ] ;
472503 const value : string = unwrapValueAsString ( wrapped ) ;
@@ -476,6 +507,7 @@ function unwrapValue(wrapped: any): any {
476507// The JSON payload delivers timestamp fields as strings of timestamps denoted in microseconds.
477508// The JavaScript convention is to use numbers denoted in milliseconds. This method
478509// makes it easy to convert a field of one type into the other.
510+ /** @hidden */
479511function copyTimestampToMillis < T , K extends keyof T > (
480512 from : any ,
481513 to : T ,
@@ -490,6 +522,7 @@ function copyTimestampToMillis<T, K extends keyof T>(
490522// The JSON payload delivers timestamp fields as strings of timestamps denoted in microseconds.
491523// In our SDK, we'd like to present timestamp as ISO-format strings. This method makes it easy
492524// to convert a field of one type into the other.
525+ /** @hidden */
493526function copyTimestampToString < T , K extends keyof T > (
494527 from : any ,
495528 to : T ,
0 commit comments