@@ -36,8 +36,12 @@ export const provider = 'google.analytics';
36
36
export const service = 'app-measurement.com' ;
37
37
38
38
/**
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.
41
45
*/
42
46
export function event ( analyticsEventType : string ) {
43
47
return _eventWithOptions ( analyticsEventType , { } ) ;
@@ -61,7 +65,7 @@ export function _eventWithOptions(
61
65
/**
62
66
* The Firebase Analytics event builder interface.
63
67
*
64
- * Access via [`functions.analytics.event()`](functions.analytics#event).
68
+ * Access via [`functions.analytics.event()`](functions.analytics#. event).
65
69
*/
66
70
export class AnalyticsEventBuilder {
67
71
/** @hidden */
@@ -73,12 +77,10 @@ export class AnalyticsEventBuilder {
73
77
/**
74
78
* Event handler that fires every time a Firebase Analytics event occurs.
75
79
*
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
78
81
* occurs.
79
82
*
80
- * @return {!functions.CloudFunction<!functions.analytics.AnalyticsEvent> } A
81
- * Cloud Function you can export.
83
+ * @return A function that you can export and deploy.
82
84
*/
83
85
onLog (
84
86
handler : (
@@ -102,13 +104,11 @@ export class AnalyticsEventBuilder {
102
104
}
103
105
}
104
106
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. */
108
108
export class AnalyticsEvent {
109
109
/**
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).
112
112
*/
113
113
reportingDate : string ;
114
114
@@ -232,11 +232,9 @@ export class UserDimensions {
232
232
}
233
233
}
234
234
235
- /**
236
- * Predefined or custom properties stored on the client side.
237
- */
235
+ /** Predefined or custom properties stored on the client side. */
238
236
export class UserPropertyValue {
239
- /** Last set value of a user property. */
237
+ /** The last set value of a user property. */
240
238
value : string ;
241
239
242
240
/** UTC client time when the user property was last set. */
@@ -250,47 +248,55 @@ export class UserPropertyValue {
250
248
}
251
249
252
250
/**
253
- * Interface representing the device that triggered these Firebase Analytics events.
251
+ * Interface representing the device that triggered these
252
+ * Firebase Analytics events.
254
253
*/
255
254
export interface DeviceInfo {
256
255
/**
257
256
* Device category.
257
+ *
258
258
* Examples: "tablet" or "mobile".
259
259
*/
260
260
deviceCategory ?: string ;
261
261
262
262
/**
263
263
* Device brand name.
264
+ *
264
265
* Examples: "Samsung", "HTC"
265
266
*/
266
267
mobileBrandName ?: string ;
267
268
268
269
/**
269
270
* Device model name in human-readable format.
271
+ *
270
272
* Example: "iPhone 7"
271
273
*/
272
274
mobileModelName ?: string ;
273
275
274
276
/**
275
277
* Device marketing name.
278
+ *
276
279
* Example: "Galaxy S4 Mini"
277
280
*/
278
281
mobileMarketingName ?: string ;
279
282
280
283
/**
281
284
* Device model, as read from the OS.
285
+ *
282
286
* Example: "iPhone9,1"
283
287
*/
284
288
deviceModel ?: string ;
285
289
286
290
/**
287
291
* Device OS version when data capture ended.
292
+ *
288
293
* Example: "4.4.2"
289
294
*/
290
295
platformVersion ?: string ;
291
296
292
297
/**
293
298
* Vendor specific device identifier. This is IDFV on iOS. Not used for Android.
299
+ *
294
300
* Example: '599F9C00-92DC-4B5C-9464-7971F01F8370'
295
301
*/
296
302
deviceId ?: string ;
@@ -313,69 +319,86 @@ export interface DeviceInfo {
313
319
314
320
/**
315
321
* 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).
317
323
*/
318
324
deviceTimeZoneOffsetSeconds : number ;
319
325
320
326
/**
321
327
* The device's Limit Ad Tracking setting.
322
328
* 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.
324
330
*/
325
331
limitedAdTracking : boolean ;
326
332
}
327
333
328
- /**
329
- * Interface representing the geographic origin of the events.
330
- */
334
+ /** Interface representing the geographic origin of the events. */
331
335
export interface GeoInfo {
332
- /** The geographic continent. Example: "Americas". */
336
+ /**
337
+ * The geographic continent.
338
+ *
339
+ * Example: "South America".
340
+ */
333
341
continent ?: string ;
334
342
335
- /** The geographic country. Example: "Brazil". */
343
+ /**
344
+ * The geographic country.
345
+ *
346
+ * Example: "Brazil".
347
+ */
336
348
country ?: string ;
337
349
338
- /** The geographic region. Example: "State of Sao Paulo". */
350
+ /**
351
+ * The geographic region.
352
+ *
353
+ * Example: "State of Sao Paulo".
354
+ */
339
355
region ?: string ;
340
356
341
- /** The geographic city. Example: "Sao Paulo". */
357
+ /**
358
+ * The geographic city.
359
+ *
360
+ * Example: "Sao Paulo".
361
+ */
342
362
city ?: string ;
343
363
}
344
364
345
- /**
346
- * Interface representing the application that triggered these events.
347
- */
365
+ /** Interface representing the application that triggered these events. */
348
366
export interface AppInfo {
349
367
/**
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".
352
371
*/
353
372
appVersion ?: string ;
354
373
355
374
/**
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".
358
378
*/
359
379
appInstanceId : string ;
360
380
361
381
/**
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".
364
385
*/
365
386
appStore ?: string ;
366
387
367
- /** The app platform. Examples: "ANDROID", "IOS". */
388
+ /**
389
+ * The app platform.
390
+ *
391
+ * Examples: "ANDROID", "IOS".
392
+ */
368
393
appPlatform : string ;
369
394
370
395
/** Unique application identifier within an app store. */
371
396
appId ?: string ;
372
397
}
373
398
374
- /**
375
- * Interface representing the bundle in which these events were uploaded.
376
- */
399
+ /** Interface representing the bundle these events were uploaded to. */
377
400
export 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. */
379
402
bundleSequenceId : number ;
380
403
381
404
/** Timestamp offset (in milliseconds) between collection time and upload time. */
@@ -393,6 +416,7 @@ export class ExportBundleInfo {
393
416
}
394
417
}
395
418
419
+ /** @hidden */
396
420
function copyFieldTo < T , K extends keyof T > (
397
421
from : any ,
398
422
to : T ,
@@ -405,6 +429,7 @@ function copyFieldTo<T, K extends keyof T>(
405
429
}
406
430
}
407
431
432
+ /** @hidden */
408
433
function copyField < T , K extends keyof T > (
409
434
from : any ,
410
435
to : T ,
@@ -414,6 +439,7 @@ function copyField<T, K extends keyof T>(
414
439
copyFieldTo ( from , to , field as string , field , transform ) ;
415
440
}
416
441
442
+ /** @hidden */
417
443
function copyFields < T , K extends keyof T > ( from : any , to : T , fields : K [ ] ) : void {
418
444
for ( const field of fields ) {
419
445
copyField ( from , to , field ) ;
@@ -449,10 +475,12 @@ function copyFields<T, K extends keyof T>(from: any, to: T, fields: K[]): void {
449
475
// is due to the encoding library, which renders int64 values as strings to avoid loss of precision. This
450
476
// method always returns a string, similarly to avoid loss of precision, unlike the less-conservative
451
477
// 'unwrapValue' method just below.
478
+ /** @hidden */
452
479
function unwrapValueAsString ( wrapped : any ) : string {
453
480
const key : string = _ . keys ( wrapped ) [ 0 ] ;
454
481
return _ . toString ( wrapped [ key ] ) ;
455
482
}
483
+
456
484
// Ditto as the method above, but returning the values in the idiomatic JavaScript type (string for strings,
457
485
// number for numbers):
458
486
// {
@@ -466,7 +494,10 @@ function unwrapValueAsString(wrapped: any): string {
466
494
// purposes can be divided into 'number' versus 'string'. This method will render all the numbers as
467
495
// JavaScript's 'number' type, since we prefer using idiomatic types. Note that this may lead to loss
468
496
// in precision for int64 fields, so use with care.
497
+ /** @hidden */
469
498
const xValueNumberFields = [ 'intValue' , 'floatValue' , 'doubleValue' ] ;
499
+
500
+ /** @hidden */
470
501
function unwrapValue ( wrapped : any ) : any {
471
502
const key : string = _ . keys ( wrapped ) [ 0 ] ;
472
503
const value : string = unwrapValueAsString ( wrapped ) ;
@@ -476,6 +507,7 @@ function unwrapValue(wrapped: any): any {
476
507
// The JSON payload delivers timestamp fields as strings of timestamps denoted in microseconds.
477
508
// The JavaScript convention is to use numbers denoted in milliseconds. This method
478
509
// makes it easy to convert a field of one type into the other.
510
+ /** @hidden */
479
511
function copyTimestampToMillis < T , K extends keyof T > (
480
512
from : any ,
481
513
to : T ,
@@ -490,6 +522,7 @@ function copyTimestampToMillis<T, K extends keyof T>(
490
522
// The JSON payload delivers timestamp fields as strings of timestamps denoted in microseconds.
491
523
// In our SDK, we'd like to present timestamp as ISO-format strings. This method makes it easy
492
524
// to convert a field of one type into the other.
525
+ /** @hidden */
493
526
function copyTimestampToString < T , K extends keyof T > (
494
527
from : any ,
495
528
to : T ,
0 commit comments