UNPKG

2.66 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright 2019 Google LLC
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 */
17import { AnalyticsCallOptions, Gtag, CustomParams, EventParams } from '@firebase/analytics-types';
18/**
19 * Logs an analytics event through the Firebase SDK.
20 *
21 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
22 * @param eventName Google Analytics event name, choose from standard list or use a custom string.
23 * @param eventParams Analytics event parameters.
24 */
25export declare function logEvent(gtagFunction: Gtag, initializationPromise: Promise<string>, eventName: string, eventParams?: EventParams, options?: AnalyticsCallOptions): Promise<void>;
26/**
27 * Set screen_name parameter for this Google Analytics ID.
28 *
29 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
30 * @param screenName Screen name string to set.
31 */
32export declare function setCurrentScreen(gtagFunction: Gtag, initializationPromise: Promise<string>, screenName: string | null, options?: AnalyticsCallOptions): Promise<void>;
33/**
34 * Set user_id parameter for this Google Analytics ID.
35 *
36 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
37 * @param id User ID string to set
38 */
39export declare function setUserId(gtagFunction: Gtag, initializationPromise: Promise<string>, id: string | null, options?: AnalyticsCallOptions): Promise<void>;
40/**
41 * Set all other user properties other than user_id and screen_name.
42 *
43 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
44 * @param properties Map of user properties to set
45 */
46export declare function setUserProperties(gtagFunction: Gtag, initializationPromise: Promise<string>, properties: CustomParams, options?: AnalyticsCallOptions): Promise<void>;
47/**
48 * Set whether collection is enabled for this ID.
49 *
50 * @param enabled If true, collection is enabled for this ID.
51 */
52export declare function setAnalyticsCollectionEnabled(initializationPromise: Promise<string>, enabled: boolean): Promise<void>;