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