@firebase/analytics 0.7.2-canary.f1c38f3cc → 0.7.2-pr5646.2abc5e854
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index.esm.js → esm/index.esm.js} +1 -1
- package/dist/esm/index.esm.js.map +1 -0
- package/dist/{index.esm2017.js → esm/index.esm2017.js} +1 -1
- package/dist/esm/index.esm2017.js.map +1 -0
- package/dist/esm/package.json +1 -0
- package/dist/esm/src/api.d.ts +423 -0
- package/dist/esm/src/api.test.d.ts +17 -0
- package/dist/esm/src/constants.d.ts +30 -0
- package/dist/esm/src/errors.d.ts +52 -0
- package/dist/esm/src/factory.d.ts +74 -0
- package/dist/esm/src/functions.d.ts +53 -0
- package/dist/esm/src/functions.test.d.ts +17 -0
- package/dist/esm/src/get-config.d.ts +72 -0
- package/dist/esm/src/get-config.test.d.ts +17 -0
- package/dist/esm/src/helpers.d.ts +57 -0
- package/dist/esm/src/helpers.test.d.ts +17 -0
- package/dist/esm/src/index.d.ts +13 -0
- package/dist/esm/src/index.test.d.ts +17 -0
- package/dist/esm/src/initialize-analytics.d.ts +36 -0
- package/dist/esm/src/initialize-analytics.test.d.ts +17 -0
- package/dist/esm/src/logger.d.ts +18 -0
- package/dist/esm/src/public-types.d.ts +248 -0
- package/dist/esm/src/types.d.ts +52 -0
- package/dist/esm/testing/get-fake-firebase-services.d.ts +29 -0
- package/dist/esm/testing/gtag-script-util.d.ts +1 -0
- package/dist/esm/testing/integration-tests/integration.d.ts +18 -0
- package/dist/esm/testing/setup.d.ts +17 -0
- package/dist/index.cjs.js +1 -1
- package/package.json +18 -11
- package/dist/index.esm.js.map +0 -1
- package/dist/index.esm2017.js.map +0 -1
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 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
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* @fileoverview Most logic is copied from packages/remote-config/src/client/retrying_client.ts
|
|
19
|
+
*/
|
|
20
|
+
import { FirebaseApp } from '@firebase/app';
|
|
21
|
+
import { DynamicConfig, ThrottleMetadata, MinimalDynamicConfig } from './types';
|
|
22
|
+
export interface AppFields {
|
|
23
|
+
appId: string;
|
|
24
|
+
apiKey: string;
|
|
25
|
+
measurementId?: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Backoff factor for 503 errors, which we want to be conservative about
|
|
29
|
+
* to avoid overloading servers. Each retry interval will be
|
|
30
|
+
* BASE_INTERVAL_MILLIS * LONG_RETRY_FACTOR ^ retryCount, so the second one
|
|
31
|
+
* will be ~30 seconds (with fuzzing).
|
|
32
|
+
*/
|
|
33
|
+
export declare const LONG_RETRY_FACTOR = 30;
|
|
34
|
+
/**
|
|
35
|
+
* Stubbable retry data storage class.
|
|
36
|
+
*/
|
|
37
|
+
declare class RetryData {
|
|
38
|
+
throttleMetadata: {
|
|
39
|
+
[appId: string]: ThrottleMetadata;
|
|
40
|
+
};
|
|
41
|
+
intervalMillis: number;
|
|
42
|
+
constructor(throttleMetadata?: {
|
|
43
|
+
[appId: string]: ThrottleMetadata;
|
|
44
|
+
}, intervalMillis?: number);
|
|
45
|
+
getThrottleMetadata(appId: string): ThrottleMetadata;
|
|
46
|
+
setThrottleMetadata(appId: string, metadata: ThrottleMetadata): void;
|
|
47
|
+
deleteThrottleMetadata(appId: string): void;
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Fetches dynamic config from backend.
|
|
51
|
+
* @param app Firebase app to fetch config for.
|
|
52
|
+
*/
|
|
53
|
+
export declare function fetchDynamicConfig(appFields: AppFields): Promise<DynamicConfig>;
|
|
54
|
+
/**
|
|
55
|
+
* Fetches dynamic config from backend, retrying if failed.
|
|
56
|
+
* @param app Firebase app to fetch config for.
|
|
57
|
+
*/
|
|
58
|
+
export declare function fetchDynamicConfigWithRetry(app: FirebaseApp, retryData?: RetryData, timeoutMillis?: number): Promise<DynamicConfig | MinimalDynamicConfig>;
|
|
59
|
+
/**
|
|
60
|
+
* Shims a minimal AbortSignal (copied from Remote Config).
|
|
61
|
+
*
|
|
62
|
+
* <p>AbortController's AbortSignal conveniently decouples fetch timeout logic from other aspects
|
|
63
|
+
* of networking, such as retries. Firebase doesn't use AbortController enough to justify a
|
|
64
|
+
* polyfill recommendation, like we do with the Fetch API, but this minimal shim can easily be
|
|
65
|
+
* swapped out if/when we do.
|
|
66
|
+
*/
|
|
67
|
+
export declare class AnalyticsAbortSignal {
|
|
68
|
+
listeners: Array<() => void>;
|
|
69
|
+
addEventListener(listener: () => void): void;
|
|
70
|
+
abort(): void;
|
|
71
|
+
}
|
|
72
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 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
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,57 @@
|
|
|
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
|
+
*/
|
|
17
|
+
import { DynamicConfig, DataLayer, Gtag, MinimalDynamicConfig } from './types';
|
|
18
|
+
/**
|
|
19
|
+
* Makeshift polyfill for Promise.allSettled(). Resolves when all promises
|
|
20
|
+
* have either resolved or rejected.
|
|
21
|
+
*
|
|
22
|
+
* @param promises Array of promises to wait for.
|
|
23
|
+
*/
|
|
24
|
+
export declare function promiseAllSettled<T>(promises: Array<Promise<T>>): Promise<T[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Inserts gtag script tag into the page to asynchronously download gtag.
|
|
27
|
+
* @param dataLayerName Name of datalayer (most often the default, "_dataLayer").
|
|
28
|
+
*/
|
|
29
|
+
export declare function insertScriptTag(dataLayerName: string, measurementId: string): void;
|
|
30
|
+
/**
|
|
31
|
+
* Get reference to, or create, global datalayer.
|
|
32
|
+
* @param dataLayerName Name of datalayer (most often the default, "_dataLayer").
|
|
33
|
+
*/
|
|
34
|
+
export declare function getOrCreateDataLayer(dataLayerName: string): DataLayer;
|
|
35
|
+
/**
|
|
36
|
+
* Creates global gtag function or wraps existing one if found.
|
|
37
|
+
* This wrapped function attaches Firebase instance ID (FID) to gtag 'config' and
|
|
38
|
+
* 'event' calls that belong to the GAID associated with this Firebase instance.
|
|
39
|
+
*
|
|
40
|
+
* @param initializationPromisesMap Map of appIds to their initialization promises.
|
|
41
|
+
* @param dynamicConfigPromisesList Array of dynamic config fetch promises.
|
|
42
|
+
* @param measurementIdToAppId Map of GA measurementIDs to corresponding Firebase appId.
|
|
43
|
+
* @param dataLayerName Name of global GA datalayer array.
|
|
44
|
+
* @param gtagFunctionName Name of global gtag function ("gtag" if not user-specified).
|
|
45
|
+
*/
|
|
46
|
+
export declare function wrapOrCreateGtag(initializationPromisesMap: {
|
|
47
|
+
[appId: string]: Promise<string>;
|
|
48
|
+
}, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: {
|
|
49
|
+
[measurementId: string]: string;
|
|
50
|
+
}, dataLayerName: string, gtagFunctionName: string): {
|
|
51
|
+
gtagCore: Gtag;
|
|
52
|
+
wrappedGtag: Gtag;
|
|
53
|
+
};
|
|
54
|
+
/**
|
|
55
|
+
* Returns first script tag in DOM matching our gtag url pattern.
|
|
56
|
+
*/
|
|
57
|
+
export declare function findGtagScriptOnPage(): HTMLScriptElement | null;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 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
|
+
*/
|
|
17
|
+
import { DynamicConfig, Gtag, MinimalDynamicConfig } from './types';
|
|
18
|
+
import { _FirebaseInstallationsInternal } from '@firebase/installations';
|
|
19
|
+
import { FirebaseApp } from '@firebase/app';
|
|
20
|
+
import { AnalyticsSettings } from './public-types';
|
|
21
|
+
/**
|
|
22
|
+
* Initialize the analytics instance in gtag.js by calling config command with fid.
|
|
23
|
+
*
|
|
24
|
+
* NOTE: We combine analytics initialization and setting fid together because we want fid to be
|
|
25
|
+
* part of the `page_view` event that's sent during the initialization
|
|
26
|
+
* @param app Firebase app
|
|
27
|
+
* @param gtagCore The gtag function that's not wrapped.
|
|
28
|
+
* @param dynamicConfigPromisesList Array of all dynamic config promises.
|
|
29
|
+
* @param measurementIdToAppId Maps measurementID to appID.
|
|
30
|
+
* @param installations _FirebaseInstallationsInternal instance.
|
|
31
|
+
*
|
|
32
|
+
* @returns Measurement ID.
|
|
33
|
+
*/
|
|
34
|
+
export declare function _initializeAnalytics(app: FirebaseApp, dynamicConfigPromisesList: Array<Promise<DynamicConfig | MinimalDynamicConfig>>, measurementIdToAppId: {
|
|
35
|
+
[key: string]: string;
|
|
36
|
+
}, installations: _FirebaseInstallationsInternal, gtagCore: Gtag, dataLayerName: string, options?: AnalyticsSettings): Promise<string>;
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
*/
|
|
17
|
+
import '../testing/setup';
|
|
@@ -0,0 +1,18 @@
|
|
|
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
|
+
*/
|
|
17
|
+
import { Logger } from '@firebase/logger';
|
|
18
|
+
export declare const logger: Logger;
|
|
@@ -0,0 +1,248 @@
|
|
|
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
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
/**
|
|
19
|
+
* A set of common Google Analytics config settings recognized by
|
|
20
|
+
* `gtag.js`.
|
|
21
|
+
* @public
|
|
22
|
+
*/
|
|
23
|
+
export interface GtagConfigParams {
|
|
24
|
+
/**
|
|
25
|
+
* Whether or not a page view should be sent.
|
|
26
|
+
* If set to true (default), a page view is automatically sent upon initialization
|
|
27
|
+
* of analytics.
|
|
28
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
|
|
29
|
+
*/
|
|
30
|
+
'send_page_view'?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The title of the page.
|
|
33
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
|
|
34
|
+
*/
|
|
35
|
+
'page_title'?: string;
|
|
36
|
+
/**
|
|
37
|
+
* The URL of the page.
|
|
38
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
|
|
39
|
+
*/
|
|
40
|
+
'page_location'?: string;
|
|
41
|
+
/**
|
|
42
|
+
* Defaults to `auto`.
|
|
43
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
44
|
+
*/
|
|
45
|
+
'cookie_domain'?: string;
|
|
46
|
+
/**
|
|
47
|
+
* Defaults to 63072000 (two years, in seconds).
|
|
48
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
49
|
+
*/
|
|
50
|
+
'cookie_expires'?: number;
|
|
51
|
+
/**
|
|
52
|
+
* Defaults to `_ga`.
|
|
53
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
54
|
+
*/
|
|
55
|
+
'cookie_prefix'?: string;
|
|
56
|
+
/**
|
|
57
|
+
* If set to true, will update cookies on each page load.
|
|
58
|
+
* Defaults to true.
|
|
59
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
60
|
+
*/
|
|
61
|
+
'cookie_update'?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Appends additional flags to the cookie when set.
|
|
64
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
|
|
65
|
+
*/
|
|
66
|
+
'cookie_flags'?: string;
|
|
67
|
+
/**
|
|
68
|
+
* If set to false, disables all advertising features with `gtag.js`.
|
|
69
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
|
70
|
+
*/
|
|
71
|
+
'allow_google_signals?': boolean;
|
|
72
|
+
/**
|
|
73
|
+
* If set to false, disables all advertising personalization with `gtag.js`.
|
|
74
|
+
* See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
|
|
75
|
+
*/
|
|
76
|
+
'allow_ad_personalization_signals'?: boolean;
|
|
77
|
+
[key: string]: unknown;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* {@link Analytics} instance initialization options.
|
|
81
|
+
* @public
|
|
82
|
+
*/
|
|
83
|
+
export interface AnalyticsSettings {
|
|
84
|
+
/**
|
|
85
|
+
* Params to be passed in the initial `gtag` config call during Firebase
|
|
86
|
+
* Analytics initialization.
|
|
87
|
+
*/
|
|
88
|
+
config?: GtagConfigParams | EventParams;
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Additional options that can be passed to Analytics method
|
|
92
|
+
* calls such as `logEvent`, `setCurrentScreen`, etc.
|
|
93
|
+
* @public
|
|
94
|
+
*/
|
|
95
|
+
export interface AnalyticsCallOptions {
|
|
96
|
+
/**
|
|
97
|
+
* If true, this config or event call applies globally to all
|
|
98
|
+
* Google Analytics properties on the page.
|
|
99
|
+
*/
|
|
100
|
+
global: boolean;
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* An instance of Firebase Analytics.
|
|
104
|
+
* @public
|
|
105
|
+
*/
|
|
106
|
+
export interface Analytics {
|
|
107
|
+
/**
|
|
108
|
+
* The {@link @firebase/app#FirebaseApp} this {@link Analytics} instance is associated with.
|
|
109
|
+
*/
|
|
110
|
+
app: FirebaseApp;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Specifies custom options for your Firebase Analytics instance.
|
|
114
|
+
* You must set these before initializing `firebase.analytics()`.
|
|
115
|
+
* @public
|
|
116
|
+
*/
|
|
117
|
+
export interface SettingsOptions {
|
|
118
|
+
/** Sets custom name for `gtag` function. */
|
|
119
|
+
gtagName?: string;
|
|
120
|
+
/** Sets custom name for `dataLayer` array used by `gtag.js`. */
|
|
121
|
+
dataLayerName?: string;
|
|
122
|
+
}
|
|
123
|
+
/**
|
|
124
|
+
* Any custom params the user may pass to `gtag`.
|
|
125
|
+
* @public
|
|
126
|
+
*/
|
|
127
|
+
export interface CustomParams {
|
|
128
|
+
[key: string]: unknown;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Type for standard Google Analytics event names. `logEvent` also accepts any
|
|
132
|
+
* custom string and interprets it as a custom event name.
|
|
133
|
+
* @public
|
|
134
|
+
*/
|
|
135
|
+
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';
|
|
136
|
+
/**
|
|
137
|
+
* Standard Google Analytics currency type.
|
|
138
|
+
* @public
|
|
139
|
+
*/
|
|
140
|
+
export declare type Currency = string | number;
|
|
141
|
+
/**
|
|
142
|
+
* Standard Google Analytics `Item` type.
|
|
143
|
+
* @public
|
|
144
|
+
*/
|
|
145
|
+
export interface Item {
|
|
146
|
+
item_id?: string;
|
|
147
|
+
item_name?: string;
|
|
148
|
+
item_brand?: string;
|
|
149
|
+
item_category?: string;
|
|
150
|
+
item_category2?: string;
|
|
151
|
+
item_category3?: string;
|
|
152
|
+
item_category4?: string;
|
|
153
|
+
item_category5?: string;
|
|
154
|
+
item_variant?: string;
|
|
155
|
+
price?: Currency;
|
|
156
|
+
quantity?: number;
|
|
157
|
+
index?: number;
|
|
158
|
+
coupon?: string;
|
|
159
|
+
item_list_name?: string;
|
|
160
|
+
item_list_id?: string;
|
|
161
|
+
discount?: Currency;
|
|
162
|
+
affiliation?: string;
|
|
163
|
+
creative_name?: string;
|
|
164
|
+
creative_slot?: string;
|
|
165
|
+
promotion_id?: string;
|
|
166
|
+
promotion_name?: string;
|
|
167
|
+
location_id?: string;
|
|
168
|
+
/** @deprecated Use item_brand instead. */
|
|
169
|
+
brand?: string;
|
|
170
|
+
/** @deprecated Use item_category instead. */
|
|
171
|
+
category?: string;
|
|
172
|
+
/** @deprecated Use item_id instead. */
|
|
173
|
+
id?: string;
|
|
174
|
+
/** @deprecated Use item_name instead. */
|
|
175
|
+
name?: string;
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Field previously used by some Google Analytics events.
|
|
179
|
+
* @deprecated Use `Item` instead.
|
|
180
|
+
* @public
|
|
181
|
+
*/
|
|
182
|
+
export interface Promotion {
|
|
183
|
+
creative_name?: string;
|
|
184
|
+
creative_slot?: string;
|
|
185
|
+
id?: string;
|
|
186
|
+
name?: string;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Standard `gtag.js` control parameters.
|
|
190
|
+
* For more information, see
|
|
191
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
192
|
+
* | the GA4 reference documentation}.
|
|
193
|
+
* @public
|
|
194
|
+
*/
|
|
195
|
+
export interface ControlParams {
|
|
196
|
+
groups?: string | string[];
|
|
197
|
+
send_to?: string | string[];
|
|
198
|
+
event_callback?: () => void;
|
|
199
|
+
event_timeout?: number;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Standard `gtag.js` event parameters.
|
|
203
|
+
* For more information, see
|
|
204
|
+
* {@link https://developers.google.com/gtagjs/reference/ga4-events
|
|
205
|
+
* | the GA4 reference documentation}.
|
|
206
|
+
* @public
|
|
207
|
+
*/
|
|
208
|
+
export interface EventParams {
|
|
209
|
+
checkout_option?: string;
|
|
210
|
+
checkout_step?: number;
|
|
211
|
+
item_id?: string;
|
|
212
|
+
content_type?: string;
|
|
213
|
+
coupon?: string;
|
|
214
|
+
currency?: string;
|
|
215
|
+
description?: string;
|
|
216
|
+
fatal?: boolean;
|
|
217
|
+
items?: Item[];
|
|
218
|
+
method?: string;
|
|
219
|
+
number?: string;
|
|
220
|
+
promotions?: Promotion[];
|
|
221
|
+
screen_name?: string;
|
|
222
|
+
/**
|
|
223
|
+
* Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
|
|
224
|
+
*/
|
|
225
|
+
firebase_screen?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
|
|
228
|
+
*/
|
|
229
|
+
firebase_screen_class?: string;
|
|
230
|
+
search_term?: string;
|
|
231
|
+
shipping?: Currency;
|
|
232
|
+
tax?: Currency;
|
|
233
|
+
transaction_id?: string;
|
|
234
|
+
value?: number;
|
|
235
|
+
event_label?: string;
|
|
236
|
+
event_category?: string;
|
|
237
|
+
shipping_tier?: string;
|
|
238
|
+
item_list_id?: string;
|
|
239
|
+
item_list_name?: string;
|
|
240
|
+
promotion_id?: string;
|
|
241
|
+
promotion_name?: string;
|
|
242
|
+
payment_type?: string;
|
|
243
|
+
affiliation?: string;
|
|
244
|
+
page_title?: string;
|
|
245
|
+
page_location?: string;
|
|
246
|
+
page_path?: string;
|
|
247
|
+
[key: string]: unknown;
|
|
248
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 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
|
+
*/
|
|
17
|
+
import { ControlParams, EventParams, CustomParams } from './public-types';
|
|
18
|
+
/**
|
|
19
|
+
* Encapsulates metadata concerning throttled fetch requests.
|
|
20
|
+
*/
|
|
21
|
+
export interface ThrottleMetadata {
|
|
22
|
+
backoffCount: number;
|
|
23
|
+
throttleEndTimeMillis: number;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Dynamic configuration fetched from server.
|
|
27
|
+
* See https://firebase.google.com/docs/projects/api/reference/rest/v1beta1/projects.webApps/getConfig
|
|
28
|
+
*/
|
|
29
|
+
export interface DynamicConfig {
|
|
30
|
+
projectId: string;
|
|
31
|
+
appId: string;
|
|
32
|
+
databaseURL: string;
|
|
33
|
+
storageBucket: string;
|
|
34
|
+
locationId: string;
|
|
35
|
+
apiKey: string;
|
|
36
|
+
authDomain: string;
|
|
37
|
+
messagingSenderId: string;
|
|
38
|
+
measurementId: string;
|
|
39
|
+
}
|
|
40
|
+
export interface MinimalDynamicConfig {
|
|
41
|
+
appId: string;
|
|
42
|
+
measurementId: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Standard `gtag` function provided by gtag.js.
|
|
46
|
+
*/
|
|
47
|
+
export interface Gtag {
|
|
48
|
+
(command: 'config', targetId: string, config?: ControlParams | EventParams | CustomParams): void;
|
|
49
|
+
(command: 'set', config: CustomParams): void;
|
|
50
|
+
(command: 'event', eventName: string, eventParams?: ControlParams | EventParams | CustomParams): void;
|
|
51
|
+
}
|
|
52
|
+
export declare type DataLayer = IArguments[];
|
|
@@ -0,0 +1,29 @@
|
|
|
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
|
+
*/
|
|
17
|
+
import { FirebaseApp } from '@firebase/app';
|
|
18
|
+
import { _FirebaseInstallationsInternal } from '@firebase/installations';
|
|
19
|
+
export declare function getFakeApp(fakeAppParams?: {
|
|
20
|
+
appId?: string;
|
|
21
|
+
apiKey?: string;
|
|
22
|
+
measurementId?: string;
|
|
23
|
+
}): FirebaseApp;
|
|
24
|
+
export declare function getFakeInstallations(fid?: string, onFidResolve?: Function): _FirebaseInstallationsInternal;
|
|
25
|
+
export declare function getFullApp(fakeAppParams?: {
|
|
26
|
+
appId?: string;
|
|
27
|
+
apiKey?: string;
|
|
28
|
+
measurementId?: string;
|
|
29
|
+
}): FirebaseApp;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function removeGtagScript(): void;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright 2020 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
|
+
*/
|
|
17
|
+
import '@firebase/installations';
|
|
18
|
+
import '../setup';
|
|
@@ -0,0 +1,17 @@
|
|
|
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
|
+
*/
|
|
17
|
+
export {};
|
package/dist/index.cjs.js
CHANGED
|
@@ -1242,7 +1242,7 @@ function logEvent(analyticsInstance, eventName, eventParams, options) {
|
|
|
1242
1242
|
}
|
|
1243
1243
|
|
|
1244
1244
|
var name = "@firebase/analytics";
|
|
1245
|
-
var version = "0.7.2-
|
|
1245
|
+
var version = "0.7.2-pr5646.2abc5e854";
|
|
1246
1246
|
|
|
1247
1247
|
/**
|
|
1248
1248
|
* Firebase Analytics
|