UNPKG

2.88 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 * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
31 * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
32 *
33 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
34 * @param screenName Screen name string to set.
35 */
36export declare function setCurrentScreen(gtagFunction: Gtag, initializationPromise: Promise<string>, screenName: string | null, options?: AnalyticsCallOptions): Promise<void>;
37/**
38 * Set user_id parameter for this Google Analytics ID.
39 *
40 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
41 * @param id User ID string to set
42 */
43export declare function setUserId(gtagFunction: Gtag, initializationPromise: Promise<string>, id: string | null, options?: AnalyticsCallOptions): Promise<void>;
44/**
45 * Set all other user properties other than user_id and screen_name.
46 *
47 * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
48 * @param properties Map of user properties to set
49 */
50export declare function setUserProperties(gtagFunction: Gtag, initializationPromise: Promise<string>, properties: CustomParams, options?: AnalyticsCallOptions): Promise<void>;
51/**
52 * Set whether collection is enabled for this ID.
53 *
54 * @param enabled If true, collection is enabled for this ID.
55 */
56export declare function setAnalyticsCollectionEnabled(initializationPromise: Promise<string>, enabled: boolean): Promise<void>;