1 | /**
|
2 | * Firebase Analytics
|
3 | *
|
4 | * @packageDocumentation
|
5 | */
|
6 |
|
7 | import { FirebaseApp } from '@firebase/app';
|
8 |
|
9 | /**
|
10 | * An instance of Firebase Analytics.
|
11 | * @public
|
12 | */
|
13 | export declare interface Analytics {
|
14 | /**
|
15 | * The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
|
16 | */
|
17 | app: FirebaseApp;
|
18 | }
|
19 |
|
20 | /**
|
21 | * Additional options that can be passed to Analytics method
|
22 | * calls such as `logEvent`, etc.
|
23 | * @public
|
24 | */
|
25 | export declare interface AnalyticsCallOptions {
|
26 | /**
|
27 | * If true, this config or event call applies globally to all
|
28 | * Google Analytics properties on the page.
|
29 | */
|
30 | global: boolean;
|
31 | }
|
32 |
|
33 | /**
|
34 | * {@link Analytics} instance initialization options.
|
35 | * @public
|
36 | */
|
37 | export declare interface AnalyticsSettings {
|
38 | /**
|
39 | * Params to be passed in the initial `gtag` config call during Firebase
|
40 | * Analytics initialization.
|
41 | */
|
42 | config?: GtagConfigParams | EventParams;
|
43 | }
|
44 |
|
45 | /**
|
46 | * Standard `gtag.js` control parameters.
|
47 | * For more information, see
|
48 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
49 | * | the GA4 reference documentation}.
|
50 | * @public
|
51 | */
|
52 | export declare interface ControlParams {
|
53 | groups?: string | string[];
|
54 | send_to?: string | string[];
|
55 | event_callback?: () => void;
|
56 | event_timeout?: number;
|
57 | }
|
58 |
|
59 | /**
|
60 | * Standard Google Analytics currency type.
|
61 | * @public
|
62 | */
|
63 | export declare type Currency = string | number;
|
64 |
|
65 | /**
|
66 | * Any custom event name string not in the standard list of recommended
|
67 | * event names.
|
68 | * @public
|
69 | */
|
70 | export declare type CustomEventName<T> = T extends EventNameString ? never : T;
|
71 |
|
72 | /**
|
73 | * Any custom params the user may pass to `gtag`.
|
74 | * @public
|
75 | */
|
76 | export declare interface CustomParams {
|
77 | [key: string]: unknown;
|
78 | }
|
79 |
|
80 | /**
|
81 | * Type for standard Google Analytics event names. `logEvent` also accepts any
|
82 | * custom string and interprets it as a custom event name.
|
83 | * @public
|
84 | */
|
85 | export declare type EventNameString = 'add_payment_info' | 'add_shipping_info' | 'add_to_cart' | 'add_to_wishlist' | 'begin_checkout' | 'checkout_progress' | 'exception' | 'generate_lead' | 'login' | 'page_view' | 'purchase' | 'refund' | 'remove_from_cart' | 'screen_view' | 'search' | 'select_content' | 'select_item' | 'select_promotion' | 'set_checkout_option' | 'share' | 'sign_up' | 'timing_complete' | 'view_cart' | 'view_item' | 'view_item_list' | 'view_promotion' | 'view_search_results';
|
86 |
|
87 | /**
|
88 | * Standard `gtag.js` event parameters.
|
89 | * For more information, see
|
90 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
91 | * | the GA4 reference documentation}.
|
92 | * @public
|
93 | */
|
94 | export declare interface EventParams {
|
95 | checkout_option?: string;
|
96 | checkout_step?: number;
|
97 | item_id?: string;
|
98 | content_type?: string;
|
99 | coupon?: string;
|
100 | currency?: string;
|
101 | description?: string;
|
102 | fatal?: boolean;
|
103 | items?: Item[];
|
104 | method?: string;
|
105 | number?: string;
|
106 | promotions?: Promotion[];
|
107 | screen_name?: string;
|
108 | /**
|
109 | * Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
|
110 | */
|
111 | firebase_screen?: string;
|
112 | /**
|
113 | * Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
|
114 | */
|
115 | firebase_screen_class?: string;
|
116 | search_term?: string;
|
117 | shipping?: Currency;
|
118 | tax?: Currency;
|
119 | transaction_id?: string;
|
120 | value?: number;
|
121 | event_label?: string;
|
122 | event_category?: string;
|
123 | shipping_tier?: string;
|
124 | item_list_id?: string;
|
125 | item_list_name?: string;
|
126 | promotion_id?: string;
|
127 | promotion_name?: string;
|
128 | payment_type?: string;
|
129 | affiliation?: string;
|
130 | page_title?: string;
|
131 | page_location?: string;
|
132 | page_path?: string;
|
133 | [key: string]: unknown;
|
134 | }
|
135 |
|
136 | /**
|
137 | * Returns an {@link Analytics} instance for the given app.
|
138 | *
|
139 | * @public
|
140 | *
|
141 | * @param app - The {@link @firebase/app#FirebaseApp} to use.
|
142 | */
|
143 | export declare function getAnalytics(app?: FirebaseApp): Analytics;
|
144 |
|
145 | /**
|
146 | * A set of common Google Analytics config settings recognized by
|
147 | * `gtag.js`.
|
148 | * @public
|
149 | */
|
150 | export declare interface GtagConfigParams {
|
151 | /**
|
152 | * Whether or not a page view should be sent.
|
153 | * If set to true (default), a page view is automatically sent upon initialization
|
154 | * of analytics.
|
155 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
|
156 | */
|
157 | 'send_page_view'?: boolean;
|
158 | /**
|
159 | * The title of the page.
|
160 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
|
161 | */
|
162 | 'page_title'?: string;
|
163 | /**
|
164 | * The URL of the page.
|
165 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
|
166 | */
|
167 | 'page_location'?: string;
|
168 | /**
|
169 | * Defaults to `auto`.
|
170 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
171 | */
|
172 | 'cookie_domain'?: string;
|
173 | /**
|
174 | * Defaults to 63072000 (two years, in seconds).
|
175 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
176 | */
|
177 | 'cookie_expires'?: number;
|
178 | /**
|
179 | * Defaults to `_ga`.
|
180 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
181 | */
|
182 | 'cookie_prefix'?: string;
|
183 | /**
|
184 | * If set to true, will update cookies on each page load.
|
185 | * Defaults to true.
|
186 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
187 | */
|
188 | 'cookie_update'?: boolean;
|
189 | /**
|
190 | * Appends additional flags to the cookie when set.
|
191 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
192 | */
|
193 | 'cookie_flags'?: string;
|
194 | /**
|
195 | * If set to false, disables all advertising features with `gtag.js`.
|
196 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
197 | */
|
198 | 'allow_google_signals'?: boolean;
|
199 | /**
|
200 | * If set to false, disables all advertising personalization with `gtag.js`.
|
201 | * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
202 | */
|
203 | 'allow_ad_personalization_signals'?: boolean;
|
204 | [key: string]: unknown;
|
205 | }
|
206 |
|
207 | /**
|
208 | * Returns an {@link Analytics} instance for the given app.
|
209 | *
|
210 | * @public
|
211 | *
|
212 | * @param app - The {@link @firebase/app#FirebaseApp} to use.
|
213 | */
|
214 | export declare function initializeAnalytics(app: FirebaseApp, options?: AnalyticsSettings): Analytics;
|
215 |
|
216 | /**
|
217 | * This is a public static method provided to users that wraps four different checks:
|
218 | *
|
219 | * 1. Check if it's not a browser extension environment.
|
220 | * 2. Check if cookies are enabled in current browser.
|
221 | * 3. Check if IndexedDB is supported by the browser environment.
|
222 | * 4. Check if the current browser context is valid for using `IndexedDB.open()`.
|
223 | *
|
224 | * @public
|
225 | *
|
226 | */
|
227 | export declare function isSupported(): Promise<boolean>;
|
228 |
|
229 | /**
|
230 | * Standard Google Analytics `Item` type.
|
231 | * @public
|
232 | */
|
233 | export declare interface Item {
|
234 | item_id?: string;
|
235 | item_name?: string;
|
236 | item_brand?: string;
|
237 | item_category?: string;
|
238 | item_category2?: string;
|
239 | item_category3?: string;
|
240 | item_category4?: string;
|
241 | item_category5?: string;
|
242 | item_variant?: string;
|
243 | price?: Currency;
|
244 | quantity?: number;
|
245 | index?: number;
|
246 | coupon?: string;
|
247 | item_list_name?: string;
|
248 | item_list_id?: string;
|
249 | discount?: Currency;
|
250 | affiliation?: string;
|
251 | creative_name?: string;
|
252 | creative_slot?: string;
|
253 | promotion_id?: string;
|
254 | promotion_name?: string;
|
255 | location_id?: string;
|
256 | /** @deprecated Use item_brand instead. */
|
257 | brand?: string;
|
258 | /** @deprecated Use item_category instead. */
|
259 | category?: string;
|
260 | /** @deprecated Use item_id instead. */
|
261 | id?: string;
|
262 | /** @deprecated Use item_name instead. */
|
263 | name?: string;
|
264 | }
|
265 |
|
266 | /**
|
267 | * Sends a Google Analytics event with given `eventParams`. This method
|
268 | * automatically associates this logged event with this Firebase web
|
269 | * app instance on this device.
|
270 | * @public
|
271 | * List of recommended event parameters can be found in
|
272 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
273 | * | the GA4 reference documentation}.
|
274 | */
|
275 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_payment_info', eventParams?: {
|
276 | coupon?: EventParams['coupon'];
|
277 | currency?: EventParams['currency'];
|
278 | items?: EventParams['items'];
|
279 | payment_type?: EventParams['payment_type'];
|
280 | value?: EventParams['value'];
|
281 | [key: string]: any;
|
282 | }, options?: AnalyticsCallOptions): void;
|
283 |
|
284 | /**
|
285 | * Sends a Google Analytics event with given `eventParams`. This method
|
286 | * automatically associates this logged event with this Firebase web
|
287 | * app instance on this device.
|
288 | * @public
|
289 | * List of recommended event parameters can be found in
|
290 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
291 | * | the GA4 reference documentation}.
|
292 | */
|
293 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_shipping_info', eventParams?: {
|
294 | coupon?: EventParams['coupon'];
|
295 | currency?: EventParams['currency'];
|
296 | items?: EventParams['items'];
|
297 | shipping_tier?: EventParams['shipping_tier'];
|
298 | value?: EventParams['value'];
|
299 | [key: string]: any;
|
300 | }, options?: AnalyticsCallOptions): void;
|
301 |
|
302 | /**
|
303 | * Sends a Google Analytics event with given `eventParams`. This method
|
304 | * automatically associates this logged event with this Firebase web
|
305 | * app instance on this device.
|
306 | * @public
|
307 | * List of recommended event parameters can be found in
|
308 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
309 | * | the GA4 reference documentation}.
|
310 | */
|
311 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'add_to_cart' | 'add_to_wishlist' | 'remove_from_cart', eventParams?: {
|
312 | currency?: EventParams['currency'];
|
313 | value?: EventParams['value'];
|
314 | items?: EventParams['items'];
|
315 | [key: string]: any;
|
316 | }, options?: AnalyticsCallOptions): void;
|
317 |
|
318 | /**
|
319 | * Sends a Google Analytics event with given `eventParams`. This method
|
320 | * automatically associates this logged event with this Firebase web
|
321 | * app instance on this device.
|
322 | * @public
|
323 | * List of recommended event parameters can be found in
|
324 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
325 | * | the GA4 reference documentation}.
|
326 | */
|
327 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'begin_checkout', eventParams?: {
|
328 | currency?: EventParams['currency'];
|
329 | coupon?: EventParams['coupon'];
|
330 | value?: EventParams['value'];
|
331 | items?: EventParams['items'];
|
332 | [key: string]: any;
|
333 | }, options?: AnalyticsCallOptions): void;
|
334 |
|
335 | /**
|
336 | * Sends a Google Analytics event with given `eventParams`. This method
|
337 | * automatically associates this logged event with this Firebase web
|
338 | * app instance on this device.
|
339 | * @public
|
340 | * List of recommended event parameters can be found in
|
341 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
342 | * | the GA4 reference documentation}.
|
343 | */
|
344 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'checkout_progress', eventParams?: {
|
345 | currency?: EventParams['currency'];
|
346 | coupon?: EventParams['coupon'];
|
347 | value?: EventParams['value'];
|
348 | items?: EventParams['items'];
|
349 | checkout_step?: EventParams['checkout_step'];
|
350 | checkout_option?: EventParams['checkout_option'];
|
351 | [key: string]: any;
|
352 | }, options?: AnalyticsCallOptions): void;
|
353 |
|
354 | /**
|
355 | * Sends a Google Analytics event with given `eventParams`. This method
|
356 | * automatically associates this logged event with this Firebase web
|
357 | * app instance on this device.
|
358 | * @public
|
359 | * See
|
360 | * {@link https://developers.google.com/analytics/devguides/collection/ga4/exceptions
|
361 | * | Measure exceptions}.
|
362 | */
|
363 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'exception', eventParams?: {
|
364 | description?: EventParams['description'];
|
365 | fatal?: EventParams['fatal'];
|
366 | [key: string]: any;
|
367 | }, options?: AnalyticsCallOptions): void;
|
368 |
|
369 | /**
|
370 | * Sends a Google Analytics event with given `eventParams`. This method
|
371 | * automatically associates this logged event with this Firebase web
|
372 | * app instance on this device.
|
373 | * @public
|
374 | * List of recommended event parameters can be found in
|
375 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
376 | * | the GA4 reference documentation}.
|
377 | */
|
378 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'generate_lead', eventParams?: {
|
379 | value?: EventParams['value'];
|
380 | currency?: EventParams['currency'];
|
381 | [key: string]: any;
|
382 | }, options?: AnalyticsCallOptions): void;
|
383 |
|
384 | /**
|
385 | * Sends a Google Analytics event with given `eventParams`. This method
|
386 | * automatically associates this logged event with this Firebase web
|
387 | * app instance on this device.
|
388 | * @public
|
389 | * List of recommended event parameters can be found in
|
390 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
391 | * | the GA4 reference documentation}.
|
392 | */
|
393 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'login', eventParams?: {
|
394 | method?: EventParams['method'];
|
395 | [key: string]: any;
|
396 | }, options?: AnalyticsCallOptions): void;
|
397 |
|
398 | /**
|
399 | * Sends a Google Analytics event with given `eventParams`. This method
|
400 | * automatically associates this logged event with this Firebase web
|
401 | * app instance on this device.
|
402 | * @public
|
403 | * See
|
404 | * {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view
|
405 | * | Page views}.
|
406 | */
|
407 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'page_view', eventParams?: {
|
408 | page_title?: string;
|
409 | page_location?: string;
|
410 | page_path?: string;
|
411 | [key: string]: any;
|
412 | }, options?: AnalyticsCallOptions): void;
|
413 |
|
414 | /**
|
415 | * Sends a Google Analytics event with given `eventParams`. This method
|
416 | * automatically associates this logged event with this Firebase web
|
417 | * app instance on this device.
|
418 | * @public
|
419 | * List of recommended event parameters can be found in
|
420 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
421 | * | the GA4 reference documentation}.
|
422 | */
|
423 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'purchase' | 'refund', eventParams?: {
|
424 | value?: EventParams['value'];
|
425 | currency?: EventParams['currency'];
|
426 | transaction_id: EventParams['transaction_id'];
|
427 | tax?: EventParams['tax'];
|
428 | shipping?: EventParams['shipping'];
|
429 | items?: EventParams['items'];
|
430 | coupon?: EventParams['coupon'];
|
431 | affiliation?: EventParams['affiliation'];
|
432 | [key: string]: any;
|
433 | }, options?: AnalyticsCallOptions): void;
|
434 |
|
435 | /**
|
436 | * Sends a Google Analytics event with given `eventParams`. This method
|
437 | * automatically associates this logged event with this Firebase web
|
438 | * app instance on this device.
|
439 | * @public
|
440 | * See {@link https://firebase.google.com/docs/analytics/screenviews
|
441 | * | Track Screenviews}.
|
442 | */
|
443 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'screen_view', eventParams?: {
|
444 | firebase_screen: EventParams['firebase_screen'];
|
445 | firebase_screen_class: EventParams['firebase_screen_class'];
|
446 | [key: string]: any;
|
447 | }, options?: AnalyticsCallOptions): void;
|
448 |
|
449 | /**
|
450 | * Sends a Google Analytics event with given `eventParams`. This method
|
451 | * automatically associates this logged event with this Firebase web
|
452 | * app instance on this device.
|
453 | * @public
|
454 | * List of recommended event parameters can be found in
|
455 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
456 | * | the GA4 reference documentation}.
|
457 | */
|
458 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'search' | 'view_search_results', eventParams?: {
|
459 | search_term?: EventParams['search_term'];
|
460 | [key: string]: any;
|
461 | }, options?: AnalyticsCallOptions): void;
|
462 |
|
463 | /**
|
464 | * Sends a Google Analytics event with given `eventParams`. This method
|
465 | * automatically associates this logged event with this Firebase web
|
466 | * app instance on this device.
|
467 | * @public
|
468 | * List of recommended event parameters can be found in
|
469 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
470 | * | the GA4 reference documentation}.
|
471 | */
|
472 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_content', eventParams?: {
|
473 | content_type?: EventParams['content_type'];
|
474 | item_id?: EventParams['item_id'];
|
475 | [key: string]: any;
|
476 | }, options?: AnalyticsCallOptions): void;
|
477 |
|
478 | /**
|
479 | * Sends a Google Analytics event with given `eventParams`. This method
|
480 | * automatically associates this logged event with this Firebase web
|
481 | * app instance on this device.
|
482 | * @public
|
483 | * List of recommended event parameters can be found in
|
484 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
485 | * | the GA4 reference documentation}.
|
486 | */
|
487 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_item', eventParams?: {
|
488 | items?: EventParams['items'];
|
489 | item_list_name?: EventParams['item_list_name'];
|
490 | item_list_id?: EventParams['item_list_id'];
|
491 | [key: string]: any;
|
492 | }, options?: AnalyticsCallOptions): void;
|
493 |
|
494 | /**
|
495 | * Sends a Google Analytics event with given `eventParams`. This method
|
496 | * automatically associates this logged event with this Firebase web
|
497 | * app instance on this device.
|
498 | * @public
|
499 | * List of recommended event parameters can be found in
|
500 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
501 | * | the GA4 reference documentation}.
|
502 | */
|
503 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'select_promotion' | 'view_promotion', eventParams?: {
|
504 | items?: EventParams['items'];
|
505 | promotion_id?: EventParams['promotion_id'];
|
506 | promotion_name?: EventParams['promotion_name'];
|
507 | [key: string]: any;
|
508 | }, options?: AnalyticsCallOptions): void;
|
509 |
|
510 | /**
|
511 | * Sends a Google Analytics event with given `eventParams`. This method
|
512 | * automatically associates this logged event with this Firebase web
|
513 | * app instance on this device.
|
514 | * @public
|
515 | * List of recommended event parameters can be found in
|
516 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
517 | * | the GA4 reference documentation}.
|
518 | */
|
519 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'set_checkout_option', eventParams?: {
|
520 | checkout_step?: EventParams['checkout_step'];
|
521 | checkout_option?: EventParams['checkout_option'];
|
522 | [key: string]: any;
|
523 | }, options?: AnalyticsCallOptions): void;
|
524 |
|
525 | /**
|
526 | * Sends a Google Analytics event with given `eventParams`. This method
|
527 | * automatically associates this logged event with this Firebase web
|
528 | * app instance on this device.
|
529 | * @public
|
530 | * List of recommended event parameters can be found in
|
531 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
532 | * | the GA4 reference documentation}.
|
533 | */
|
534 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'share', eventParams?: {
|
535 | method?: EventParams['method'];
|
536 | content_type?: EventParams['content_type'];
|
537 | item_id?: EventParams['item_id'];
|
538 | [key: string]: any;
|
539 | }, options?: AnalyticsCallOptions): void;
|
540 |
|
541 | /**
|
542 | * Sends a Google Analytics event with given `eventParams`. This method
|
543 | * automatically associates this logged event with this Firebase web
|
544 | * app instance on this device.
|
545 | * @public
|
546 | * List of recommended event parameters can be found in
|
547 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
548 | * | the GA4 reference documentation}.
|
549 | */
|
550 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'sign_up', eventParams?: {
|
551 | method?: EventParams['method'];
|
552 | [key: string]: any;
|
553 | }, options?: AnalyticsCallOptions): void;
|
554 |
|
555 | /**
|
556 | * Sends a Google Analytics event with given `eventParams`. This method
|
557 | * automatically associates this logged event with this Firebase web
|
558 | * app instance on this device.
|
559 | * @public
|
560 | * List of recommended event parameters can be found in
|
561 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
562 | * | the GA4 reference documentation}.
|
563 | */
|
564 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'timing_complete', eventParams?: {
|
565 | name: string;
|
566 | value: number;
|
567 | event_category?: string;
|
568 | event_label?: string;
|
569 | [key: string]: any;
|
570 | }, options?: AnalyticsCallOptions): void;
|
571 |
|
572 | /**
|
573 | * Sends a Google Analytics event with given `eventParams`. This method
|
574 | * automatically associates this logged event with this Firebase web
|
575 | * app instance on this device.
|
576 | * @public
|
577 | * List of recommended event parameters can be found in
|
578 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
579 | * | the GA4 reference documentation}.
|
580 | */
|
581 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_cart' | 'view_item', eventParams?: {
|
582 | currency?: EventParams['currency'];
|
583 | items?: EventParams['items'];
|
584 | value?: EventParams['value'];
|
585 | [key: string]: any;
|
586 | }, options?: AnalyticsCallOptions): void;
|
587 |
|
588 | /**
|
589 | * Sends a Google Analytics event with given `eventParams`. This method
|
590 | * automatically associates this logged event with this Firebase web
|
591 | * app instance on this device.
|
592 | * @public
|
593 | * List of recommended event parameters can be found in
|
594 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
595 | * | the GA4 reference documentation}.
|
596 | */
|
597 | export declare function logEvent(analyticsInstance: Analytics, eventName: 'view_item_list', eventParams?: {
|
598 | items?: EventParams['items'];
|
599 | item_list_name?: EventParams['item_list_name'];
|
600 | item_list_id?: EventParams['item_list_id'];
|
601 | [key: string]: any;
|
602 | }, options?: AnalyticsCallOptions): void;
|
603 |
|
604 | /**
|
605 | * Sends a Google Analytics event with given `eventParams`. This method
|
606 | * automatically associates this logged event with this Firebase web
|
607 | * app instance on this device.
|
608 | * @public
|
609 | * List of recommended event parameters can be found in
|
610 | * {@link https://developers.google.com/gtagjs/reference/ga4-events
|
611 | * | the GA4 reference documentation}.
|
612 | */
|
613 | export declare function logEvent<T extends string>(analyticsInstance: Analytics, eventName: CustomEventName<T>, eventParams?: {
|
614 | [key: string]: any;
|
615 | }, options?: AnalyticsCallOptions): void;
|
616 |
|
617 | /**
|
618 | * Field previously used by some Google Analytics events.
|
619 | * @deprecated Use `Item` instead.
|
620 | * @public
|
621 | */
|
622 | export declare interface Promotion {
|
623 | creative_name?: string;
|
624 | creative_slot?: string;
|
625 | id?: string;
|
626 | name?: string;
|
627 | }
|
628 |
|
629 | /**
|
630 | * Sets whether Google Analytics collection is enabled for this app on this device.
|
631 | * Sets global `window['ga-disable-analyticsId'] = true;`
|
632 | *
|
633 | * @public
|
634 | *
|
635 | * @param analyticsInstance - The {@link Analytics} instance.
|
636 | * @param enabled - If true, enables collection, if false, disables it.
|
637 | */
|
638 | export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;
|
639 |
|
640 | /**
|
641 | * Use gtag `config` command to set `screen_name`.
|
642 | *
|
643 | * @public
|
644 | *
|
645 | * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
|
646 | * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
|
647 | *
|
648 | * @param analyticsInstance - The {@link Analytics} instance.
|
649 | * @param screenName - Screen name to set.
|
650 | */
|
651 | export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
|
652 |
|
653 | /**
|
654 | * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.
|
655 | * Intended to be used if `gtag.js` script has been installed on
|
656 | * this page independently of Firebase Analytics, and is using non-default
|
657 | * names for either the `gtag` function or for `dataLayer`.
|
658 | * Must be called before calling `getAnalytics()` or it won't
|
659 | * have any effect.
|
660 | *
|
661 | * @public
|
662 | *
|
663 | * @param options - Custom gtag and dataLayer names.
|
664 | */
|
665 | export declare function settings(options: SettingsOptions): void;
|
666 |
|
667 | /**
|
668 | * Specifies custom options for your Firebase Analytics instance.
|
669 | * You must set these before initializing `firebase.analytics()`.
|
670 | * @public
|
671 | */
|
672 | export declare interface SettingsOptions {
|
673 | /** Sets custom name for `gtag` function. */
|
674 | gtagName?: string;
|
675 | /** Sets custom name for `dataLayer` array used by `gtag.js`. */
|
676 | dataLayerName?: string;
|
677 | }
|
678 |
|
679 | /**
|
680 | * Use gtag `config` command to set `user_id`.
|
681 | *
|
682 | * @public
|
683 | *
|
684 | * @param analyticsInstance - The {@link Analytics} instance.
|
685 | * @param id - User ID to set.
|
686 | */
|
687 | export declare function setUserId(analyticsInstance: Analytics, id: string, options?: AnalyticsCallOptions): void;
|
688 |
|
689 | /**
|
690 | * Use gtag `config` command to set all params specified.
|
691 | *
|
692 | * @public
|
693 | */
|
694 | export declare function setUserProperties(analyticsInstance: Analytics, properties: CustomParams, options?: AnalyticsCallOptions): void;
|
695 |
|
696 | export { }
|