UNPKG

2.68 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, CustomParams, EventParams } from './public-types';
18import { Gtag } from './types';
19/**
20 * Logs an analytics event through the Firebase SDK.
21 *
22 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
23 * @param eventName Google Analytics event name, choose from standard list or use a custom string.
24 * @param eventParams Analytics event parameters.
25 */
26export declare function logEvent(gtagFunction: Gtag, initializationPromise: Promise<string>, eventName: string, eventParams?: EventParams, options?: AnalyticsCallOptions): Promise<void>;
27/**
28 * Set screen_name parameter for this Google Analytics ID.
29 *
30 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
31 * @param screenName Screen name string to set.
32 */
33export declare function setCurrentScreen(gtagFunction: Gtag, initializationPromise: Promise<string>, screenName: string | null, options?: AnalyticsCallOptions): Promise<void>;
34/**
35 * Set user_id parameter for this Google Analytics ID.
36 *
37 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
38 * @param id User ID string to set
39 */
40export declare function setUserId(gtagFunction: Gtag, initializationPromise: Promise<string>, id: string | null, options?: AnalyticsCallOptions): Promise<void>;
41/**
42 * Set all other user properties other than user_id and screen_name.
43 *
44 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
45 * @param properties Map of user properties to set
46 */
47export declare function setUserProperties(gtagFunction: Gtag, initializationPromise: Promise<string>, properties: CustomParams, options?: AnalyticsCallOptions): Promise<void>;
48/**
49 * Set whether collection is enabled for this ID.
50 *
51 * @param enabled If true, collection is enabled for this ID.
52 */
53export declare function setAnalyticsCollectionEnabled(initializationPromise: Promise<string>, enabled: boolean): Promise<void>;