@firebase/analytics 0.7.11-20220621210445 → 0.7.11-canary.b12af44a5
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/CHANGELOG.md +4 -5
- package/dist/analytics-public.d.ts +9 -0
- package/dist/analytics.d.ts +9 -0
- package/dist/esm/index.esm.js +192 -158
- package/dist/esm/index.esm.js.map +1 -1
- package/dist/esm/index.esm2017.js +145 -111
- package/dist/esm/index.esm2017.js.map +1 -1
- package/dist/esm/src/api.d.ts +8 -0
- package/dist/esm/src/functions.d.ts +11 -0
- package/dist/index.cjs.js +192 -157
- package/dist/index.cjs.js.map +1 -1
- package/dist/src/api.d.ts +8 -0
- package/dist/src/functions.d.ts +11 -0
- package/package.json +7 -7
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
# @firebase/analytics
|
|
2
2
|
|
|
3
|
-
## 0.7.11
|
|
3
|
+
## 0.7.11
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- [`835f1d46a`](https://github.com/firebase/firebase-js-sdk/commit/835f1d46a6780535bc660ef7dc23293350d5fe43) [#6357](https://github.com/firebase/firebase-js-sdk/pull/6357) - Fix typo in GtagConfigParams
|
|
8
8
|
|
|
9
9
|
- Updated dependencies [[`efe2000fc`](https://github.com/firebase/firebase-js-sdk/commit/efe2000fc499e2c85c4e5e0fef6741ff3bad2eb0)]:
|
|
10
|
-
- @firebase/util@1.6.2
|
|
11
|
-
- @firebase/
|
|
12
|
-
- @firebase/
|
|
13
|
-
- @firebase/installations@0.5.11-20220621210445
|
|
10
|
+
- @firebase/util@1.6.2
|
|
11
|
+
- @firebase/component@0.5.16
|
|
12
|
+
- @firebase/installations@0.5.11
|
|
14
13
|
|
|
15
14
|
## 0.7.10
|
|
16
15
|
|
|
@@ -650,6 +650,15 @@ export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analyti
|
|
|
650
650
|
*/
|
|
651
651
|
export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
|
|
652
652
|
|
|
653
|
+
/**
|
|
654
|
+
* Adds data that will be set on every event logged from the SDK, including automatic ones.
|
|
655
|
+
* With gtag's "set" command, the values passed persist on the current page and are passed with
|
|
656
|
+
* all subsequent events.
|
|
657
|
+
* @public
|
|
658
|
+
* @param customParams Any custom params the user may pass to gtag.js.
|
|
659
|
+
*/
|
|
660
|
+
export declare function setDefaultEventParameters(customParams: CustomParams): void;
|
|
661
|
+
|
|
653
662
|
/**
|
|
654
663
|
* Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.
|
|
655
664
|
* Intended to be used if `gtag.js` script has been installed on
|
package/dist/analytics.d.ts
CHANGED
|
@@ -650,6 +650,15 @@ export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analyti
|
|
|
650
650
|
*/
|
|
651
651
|
export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
|
|
652
652
|
|
|
653
|
+
/**
|
|
654
|
+
* Adds data that will be set on every event logged from the SDK, including automatic ones.
|
|
655
|
+
* With gtag's "set" command, the values passed persist on the current page and are passed with
|
|
656
|
+
* all subsequent events.
|
|
657
|
+
* @public
|
|
658
|
+
* @param customParams Any custom params the user may pass to gtag.js.
|
|
659
|
+
*/
|
|
660
|
+
export declare function setDefaultEventParameters(customParams: CustomParams): void;
|
|
661
|
+
|
|
653
662
|
/**
|
|
654
663
|
* Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.
|
|
655
664
|
* Intended to be used if `gtag.js` script has been installed on
|
package/dist/esm/index.esm.js
CHANGED
|
@@ -662,6 +662,175 @@ var AnalyticsAbortSignal = /** @class */ (function () {
|
|
|
662
662
|
return AnalyticsAbortSignal;
|
|
663
663
|
}());
|
|
664
664
|
|
|
665
|
+
/**
|
|
666
|
+
* @license
|
|
667
|
+
* Copyright 2019 Google LLC
|
|
668
|
+
*
|
|
669
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
670
|
+
* you may not use this file except in compliance with the License.
|
|
671
|
+
* You may obtain a copy of the License at
|
|
672
|
+
*
|
|
673
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
674
|
+
*
|
|
675
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
676
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
677
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
678
|
+
* See the License for the specific language governing permissions and
|
|
679
|
+
* limitations under the License.
|
|
680
|
+
*/
|
|
681
|
+
/**
|
|
682
|
+
* Event parameters to set on 'gtag' during initialization.
|
|
683
|
+
*/
|
|
684
|
+
var defaultEventParametersForInit;
|
|
685
|
+
/**
|
|
686
|
+
* Logs an analytics event through the Firebase SDK.
|
|
687
|
+
*
|
|
688
|
+
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
|
|
689
|
+
* @param eventName Google Analytics event name, choose from standard list or use a custom string.
|
|
690
|
+
* @param eventParams Analytics event parameters.
|
|
691
|
+
*/
|
|
692
|
+
function logEvent$1(gtagFunction, initializationPromise, eventName, eventParams, options) {
|
|
693
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
694
|
+
var measurementId, params;
|
|
695
|
+
return __generator(this, function (_a) {
|
|
696
|
+
switch (_a.label) {
|
|
697
|
+
case 0:
|
|
698
|
+
if (!(options && options.global)) return [3 /*break*/, 1];
|
|
699
|
+
gtagFunction("event" /* EVENT */, eventName, eventParams);
|
|
700
|
+
return [2 /*return*/];
|
|
701
|
+
case 1: return [4 /*yield*/, initializationPromise];
|
|
702
|
+
case 2:
|
|
703
|
+
measurementId = _a.sent();
|
|
704
|
+
params = __assign(__assign({}, eventParams), { 'send_to': measurementId });
|
|
705
|
+
gtagFunction("event" /* EVENT */, eventName, params);
|
|
706
|
+
_a.label = 3;
|
|
707
|
+
case 3: return [2 /*return*/];
|
|
708
|
+
}
|
|
709
|
+
});
|
|
710
|
+
});
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Set screen_name parameter for this Google Analytics ID.
|
|
714
|
+
*
|
|
715
|
+
* @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
|
|
716
|
+
* See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
|
|
717
|
+
*
|
|
718
|
+
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
|
|
719
|
+
* @param screenName Screen name string to set.
|
|
720
|
+
*/
|
|
721
|
+
function setCurrentScreen$1(gtagFunction, initializationPromise, screenName, options) {
|
|
722
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
723
|
+
var measurementId;
|
|
724
|
+
return __generator(this, function (_a) {
|
|
725
|
+
switch (_a.label) {
|
|
726
|
+
case 0:
|
|
727
|
+
if (!(options && options.global)) return [3 /*break*/, 1];
|
|
728
|
+
gtagFunction("set" /* SET */, { 'screen_name': screenName });
|
|
729
|
+
return [2 /*return*/, Promise.resolve()];
|
|
730
|
+
case 1: return [4 /*yield*/, initializationPromise];
|
|
731
|
+
case 2:
|
|
732
|
+
measurementId = _a.sent();
|
|
733
|
+
gtagFunction("config" /* CONFIG */, measurementId, {
|
|
734
|
+
update: true,
|
|
735
|
+
'screen_name': screenName
|
|
736
|
+
});
|
|
737
|
+
_a.label = 3;
|
|
738
|
+
case 3: return [2 /*return*/];
|
|
739
|
+
}
|
|
740
|
+
});
|
|
741
|
+
});
|
|
742
|
+
}
|
|
743
|
+
/**
|
|
744
|
+
* Set user_id parameter for this Google Analytics ID.
|
|
745
|
+
*
|
|
746
|
+
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
|
|
747
|
+
* @param id User ID string to set
|
|
748
|
+
*/
|
|
749
|
+
function setUserId$1(gtagFunction, initializationPromise, id, options) {
|
|
750
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
751
|
+
var measurementId;
|
|
752
|
+
return __generator(this, function (_a) {
|
|
753
|
+
switch (_a.label) {
|
|
754
|
+
case 0:
|
|
755
|
+
if (!(options && options.global)) return [3 /*break*/, 1];
|
|
756
|
+
gtagFunction("set" /* SET */, { 'user_id': id });
|
|
757
|
+
return [2 /*return*/, Promise.resolve()];
|
|
758
|
+
case 1: return [4 /*yield*/, initializationPromise];
|
|
759
|
+
case 2:
|
|
760
|
+
measurementId = _a.sent();
|
|
761
|
+
gtagFunction("config" /* CONFIG */, measurementId, {
|
|
762
|
+
update: true,
|
|
763
|
+
'user_id': id
|
|
764
|
+
});
|
|
765
|
+
_a.label = 3;
|
|
766
|
+
case 3: return [2 /*return*/];
|
|
767
|
+
}
|
|
768
|
+
});
|
|
769
|
+
});
|
|
770
|
+
}
|
|
771
|
+
/**
|
|
772
|
+
* Set all other user properties other than user_id and screen_name.
|
|
773
|
+
*
|
|
774
|
+
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
|
|
775
|
+
* @param properties Map of user properties to set
|
|
776
|
+
*/
|
|
777
|
+
function setUserProperties$1(gtagFunction, initializationPromise, properties, options) {
|
|
778
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
779
|
+
var flatProperties, _i, _a, key, measurementId;
|
|
780
|
+
return __generator(this, function (_b) {
|
|
781
|
+
switch (_b.label) {
|
|
782
|
+
case 0:
|
|
783
|
+
if (!(options && options.global)) return [3 /*break*/, 1];
|
|
784
|
+
flatProperties = {};
|
|
785
|
+
for (_i = 0, _a = Object.keys(properties); _i < _a.length; _i++) {
|
|
786
|
+
key = _a[_i];
|
|
787
|
+
// use dot notation for merge behavior in gtag.js
|
|
788
|
+
flatProperties["user_properties." + key] = properties[key];
|
|
789
|
+
}
|
|
790
|
+
gtagFunction("set" /* SET */, flatProperties);
|
|
791
|
+
return [2 /*return*/, Promise.resolve()];
|
|
792
|
+
case 1: return [4 /*yield*/, initializationPromise];
|
|
793
|
+
case 2:
|
|
794
|
+
measurementId = _b.sent();
|
|
795
|
+
gtagFunction("config" /* CONFIG */, measurementId, {
|
|
796
|
+
update: true,
|
|
797
|
+
'user_properties': properties
|
|
798
|
+
});
|
|
799
|
+
_b.label = 3;
|
|
800
|
+
case 3: return [2 /*return*/];
|
|
801
|
+
}
|
|
802
|
+
});
|
|
803
|
+
});
|
|
804
|
+
}
|
|
805
|
+
/**
|
|
806
|
+
* Set whether collection is enabled for this ID.
|
|
807
|
+
*
|
|
808
|
+
* @param enabled If true, collection is enabled for this ID.
|
|
809
|
+
*/
|
|
810
|
+
function setAnalyticsCollectionEnabled$1(initializationPromise, enabled) {
|
|
811
|
+
return __awaiter(this, void 0, void 0, function () {
|
|
812
|
+
var measurementId;
|
|
813
|
+
return __generator(this, function (_a) {
|
|
814
|
+
switch (_a.label) {
|
|
815
|
+
case 0: return [4 /*yield*/, initializationPromise];
|
|
816
|
+
case 1:
|
|
817
|
+
measurementId = _a.sent();
|
|
818
|
+
window["ga-disable-" + measurementId] = !enabled;
|
|
819
|
+
return [2 /*return*/];
|
|
820
|
+
}
|
|
821
|
+
});
|
|
822
|
+
});
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Sets the variable `defaultEventParametersForInit` for use in the initialization of
|
|
826
|
+
* analytics.
|
|
827
|
+
*
|
|
828
|
+
* @param customParams Any custom params the user may pass to gtag.js.
|
|
829
|
+
*/
|
|
830
|
+
function _setDefaultEventParametersForInit(customParams) {
|
|
831
|
+
defaultEventParametersForInit = customParams;
|
|
832
|
+
}
|
|
833
|
+
|
|
665
834
|
/**
|
|
666
835
|
* @license
|
|
667
836
|
* Copyright 2020 Google LLC
|
|
@@ -779,6 +948,11 @@ function _initializeAnalytics(app, dynamicConfigPromisesList, measurementIdToApp
|
|
|
779
948
|
// Note: This will trigger a page_view event unless 'send_page_view' is set to false in
|
|
780
949
|
// `configProperties`.
|
|
781
950
|
gtagCore("config" /* CONFIG */, dynamicConfig.measurementId, configProperties);
|
|
951
|
+
// Detects if there is data that will be set on every event logged from the SDK.
|
|
952
|
+
if (defaultEventParametersForInit) {
|
|
953
|
+
gtagCore("set" /* SET */, defaultEventParametersForInit);
|
|
954
|
+
_setDefaultEventParametersForInit(undefined);
|
|
955
|
+
}
|
|
782
956
|
return [2 /*return*/, dynamicConfig.measurementId];
|
|
783
957
|
}
|
|
784
958
|
});
|
|
@@ -943,162 +1117,6 @@ function factory(app, installations, options) {
|
|
|
943
1117
|
return analyticsInstance;
|
|
944
1118
|
}
|
|
945
1119
|
|
|
946
|
-
/**
|
|
947
|
-
* @license
|
|
948
|
-
* Copyright 2019 Google LLC
|
|
949
|
-
*
|
|
950
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
951
|
-
* you may not use this file except in compliance with the License.
|
|
952
|
-
* You may obtain a copy of the License at
|
|
953
|
-
*
|
|
954
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
955
|
-
*
|
|
956
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
957
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
958
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
959
|
-
* See the License for the specific language governing permissions and
|
|
960
|
-
* limitations under the License.
|
|
961
|
-
*/
|
|
962
|
-
/**
|
|
963
|
-
* Logs an analytics event through the Firebase SDK.
|
|
964
|
-
*
|
|
965
|
-
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
|
|
966
|
-
* @param eventName Google Analytics event name, choose from standard list or use a custom string.
|
|
967
|
-
* @param eventParams Analytics event parameters.
|
|
968
|
-
*/
|
|
969
|
-
function logEvent$1(gtagFunction, initializationPromise, eventName, eventParams, options) {
|
|
970
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
971
|
-
var measurementId, params;
|
|
972
|
-
return __generator(this, function (_a) {
|
|
973
|
-
switch (_a.label) {
|
|
974
|
-
case 0:
|
|
975
|
-
if (!(options && options.global)) return [3 /*break*/, 1];
|
|
976
|
-
gtagFunction("event" /* EVENT */, eventName, eventParams);
|
|
977
|
-
return [2 /*return*/];
|
|
978
|
-
case 1: return [4 /*yield*/, initializationPromise];
|
|
979
|
-
case 2:
|
|
980
|
-
measurementId = _a.sent();
|
|
981
|
-
params = __assign(__assign({}, eventParams), { 'send_to': measurementId });
|
|
982
|
-
gtagFunction("event" /* EVENT */, eventName, params);
|
|
983
|
-
_a.label = 3;
|
|
984
|
-
case 3: return [2 /*return*/];
|
|
985
|
-
}
|
|
986
|
-
});
|
|
987
|
-
});
|
|
988
|
-
}
|
|
989
|
-
/**
|
|
990
|
-
* Set screen_name parameter for this Google Analytics ID.
|
|
991
|
-
*
|
|
992
|
-
* @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
|
|
993
|
-
* See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
|
|
994
|
-
*
|
|
995
|
-
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
|
|
996
|
-
* @param screenName Screen name string to set.
|
|
997
|
-
*/
|
|
998
|
-
function setCurrentScreen$1(gtagFunction, initializationPromise, screenName, options) {
|
|
999
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1000
|
-
var measurementId;
|
|
1001
|
-
return __generator(this, function (_a) {
|
|
1002
|
-
switch (_a.label) {
|
|
1003
|
-
case 0:
|
|
1004
|
-
if (!(options && options.global)) return [3 /*break*/, 1];
|
|
1005
|
-
gtagFunction("set" /* SET */, { 'screen_name': screenName });
|
|
1006
|
-
return [2 /*return*/, Promise.resolve()];
|
|
1007
|
-
case 1: return [4 /*yield*/, initializationPromise];
|
|
1008
|
-
case 2:
|
|
1009
|
-
measurementId = _a.sent();
|
|
1010
|
-
gtagFunction("config" /* CONFIG */, measurementId, {
|
|
1011
|
-
update: true,
|
|
1012
|
-
'screen_name': screenName
|
|
1013
|
-
});
|
|
1014
|
-
_a.label = 3;
|
|
1015
|
-
case 3: return [2 /*return*/];
|
|
1016
|
-
}
|
|
1017
|
-
});
|
|
1018
|
-
});
|
|
1019
|
-
}
|
|
1020
|
-
/**
|
|
1021
|
-
* Set user_id parameter for this Google Analytics ID.
|
|
1022
|
-
*
|
|
1023
|
-
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
|
|
1024
|
-
* @param id User ID string to set
|
|
1025
|
-
*/
|
|
1026
|
-
function setUserId$1(gtagFunction, initializationPromise, id, options) {
|
|
1027
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1028
|
-
var measurementId;
|
|
1029
|
-
return __generator(this, function (_a) {
|
|
1030
|
-
switch (_a.label) {
|
|
1031
|
-
case 0:
|
|
1032
|
-
if (!(options && options.global)) return [3 /*break*/, 1];
|
|
1033
|
-
gtagFunction("set" /* SET */, { 'user_id': id });
|
|
1034
|
-
return [2 /*return*/, Promise.resolve()];
|
|
1035
|
-
case 1: return [4 /*yield*/, initializationPromise];
|
|
1036
|
-
case 2:
|
|
1037
|
-
measurementId = _a.sent();
|
|
1038
|
-
gtagFunction("config" /* CONFIG */, measurementId, {
|
|
1039
|
-
update: true,
|
|
1040
|
-
'user_id': id
|
|
1041
|
-
});
|
|
1042
|
-
_a.label = 3;
|
|
1043
|
-
case 3: return [2 /*return*/];
|
|
1044
|
-
}
|
|
1045
|
-
});
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1048
|
-
/**
|
|
1049
|
-
* Set all other user properties other than user_id and screen_name.
|
|
1050
|
-
*
|
|
1051
|
-
* @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
|
|
1052
|
-
* @param properties Map of user properties to set
|
|
1053
|
-
*/
|
|
1054
|
-
function setUserProperties$1(gtagFunction, initializationPromise, properties, options) {
|
|
1055
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1056
|
-
var flatProperties, _i, _a, key, measurementId;
|
|
1057
|
-
return __generator(this, function (_b) {
|
|
1058
|
-
switch (_b.label) {
|
|
1059
|
-
case 0:
|
|
1060
|
-
if (!(options && options.global)) return [3 /*break*/, 1];
|
|
1061
|
-
flatProperties = {};
|
|
1062
|
-
for (_i = 0, _a = Object.keys(properties); _i < _a.length; _i++) {
|
|
1063
|
-
key = _a[_i];
|
|
1064
|
-
// use dot notation for merge behavior in gtag.js
|
|
1065
|
-
flatProperties["user_properties." + key] = properties[key];
|
|
1066
|
-
}
|
|
1067
|
-
gtagFunction("set" /* SET */, flatProperties);
|
|
1068
|
-
return [2 /*return*/, Promise.resolve()];
|
|
1069
|
-
case 1: return [4 /*yield*/, initializationPromise];
|
|
1070
|
-
case 2:
|
|
1071
|
-
measurementId = _b.sent();
|
|
1072
|
-
gtagFunction("config" /* CONFIG */, measurementId, {
|
|
1073
|
-
update: true,
|
|
1074
|
-
'user_properties': properties
|
|
1075
|
-
});
|
|
1076
|
-
_b.label = 3;
|
|
1077
|
-
case 3: return [2 /*return*/];
|
|
1078
|
-
}
|
|
1079
|
-
});
|
|
1080
|
-
});
|
|
1081
|
-
}
|
|
1082
|
-
/**
|
|
1083
|
-
* Set whether collection is enabled for this ID.
|
|
1084
|
-
*
|
|
1085
|
-
* @param enabled If true, collection is enabled for this ID.
|
|
1086
|
-
*/
|
|
1087
|
-
function setAnalyticsCollectionEnabled$1(initializationPromise, enabled) {
|
|
1088
|
-
return __awaiter(this, void 0, void 0, function () {
|
|
1089
|
-
var measurementId;
|
|
1090
|
-
return __generator(this, function (_a) {
|
|
1091
|
-
switch (_a.label) {
|
|
1092
|
-
case 0: return [4 /*yield*/, initializationPromise];
|
|
1093
|
-
case 1:
|
|
1094
|
-
measurementId = _a.sent();
|
|
1095
|
-
window["ga-disable-" + measurementId] = !enabled;
|
|
1096
|
-
return [2 /*return*/];
|
|
1097
|
-
}
|
|
1098
|
-
});
|
|
1099
|
-
});
|
|
1100
|
-
}
|
|
1101
|
-
|
|
1102
1120
|
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
1103
1121
|
/**
|
|
1104
1122
|
* Returns an {@link Analytics} instance for the given app.
|
|
@@ -1230,6 +1248,22 @@ function setAnalyticsCollectionEnabled(analyticsInstance, enabled) {
|
|
|
1230
1248
|
analyticsInstance = getModularInstance(analyticsInstance);
|
|
1231
1249
|
setAnalyticsCollectionEnabled$1(initializationPromisesMap[analyticsInstance.app.options.appId], enabled).catch(function (e) { return logger.error(e); });
|
|
1232
1250
|
}
|
|
1251
|
+
/**
|
|
1252
|
+
* Adds data that will be set on every event logged from the SDK, including automatic ones.
|
|
1253
|
+
* With gtag's "set" command, the values passed persist on the current page and are passed with
|
|
1254
|
+
* all subsequent events.
|
|
1255
|
+
* @public
|
|
1256
|
+
* @param customParams Any custom params the user may pass to gtag.js.
|
|
1257
|
+
*/
|
|
1258
|
+
function setDefaultEventParameters(customParams) {
|
|
1259
|
+
// Check if reference to existing gtag function on window object exists
|
|
1260
|
+
if (wrappedGtagFunction) {
|
|
1261
|
+
wrappedGtagFunction("set" /* SET */, customParams);
|
|
1262
|
+
}
|
|
1263
|
+
else {
|
|
1264
|
+
_setDefaultEventParametersForInit(customParams);
|
|
1265
|
+
}
|
|
1266
|
+
}
|
|
1233
1267
|
/**
|
|
1234
1268
|
* Sends a Google Analytics event with given `eventParams`. This method
|
|
1235
1269
|
* automatically associates this logged event with this Firebase web
|
|
@@ -1247,7 +1281,7 @@ function logEvent(analyticsInstance, eventName, eventParams, options) {
|
|
|
1247
1281
|
}
|
|
1248
1282
|
|
|
1249
1283
|
var name = "@firebase/analytics";
|
|
1250
|
-
var version = "0.7.11-
|
|
1284
|
+
var version = "0.7.11-canary.b12af44a5";
|
|
1251
1285
|
|
|
1252
1286
|
/**
|
|
1253
1287
|
* Firebase Analytics
|
|
@@ -1284,5 +1318,5 @@ function registerAnalytics() {
|
|
|
1284
1318
|
}
|
|
1285
1319
|
registerAnalytics();
|
|
1286
1320
|
|
|
1287
|
-
export { getAnalytics, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setCurrentScreen, setUserId, setUserProperties, settings };
|
|
1321
|
+
export { getAnalytics, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setCurrentScreen, setDefaultEventParameters, setUserId, setUserProperties, settings };
|
|
1288
1322
|
//# sourceMappingURL=index.esm.js.map
|