@firebase/analytics 0.7.11-canary.b60cf76e1 → 0.7.11-canary.c187446a2

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.
@@ -42,6 +42,38 @@ export declare interface AnalyticsSettings {
42
42
  config?: GtagConfigParams | EventParams;
43
43
  }
44
44
 
45
+ /**
46
+ * Consent status settings for each consent type.
47
+ * For more information, see
48
+ * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
49
+ * | the GA4 reference documentation for consent state and consent types}.
50
+ * @public
51
+ */
52
+ export declare interface ConsentSettings {
53
+ /** Enables storage, such as cookies, related to advertising */
54
+ ad_storage?: ConsentStatusString;
55
+ /** Enables storage, such as cookies, related to analytics (for example, visit duration) */
56
+ analytics_storage?: ConsentStatusString;
57
+ /**
58
+ * Enables storage that supports the functionality of the website or app such as language settings
59
+ */
60
+ functionality_storage?: ConsentStatusString;
61
+ /** Enables storage related to personalization such as video recommendations */
62
+ personalization_storage?: ConsentStatusString;
63
+ /**
64
+ * Enables storage related to security such as authentication functionality, fraud prevention,
65
+ * and other user protection.
66
+ */
67
+ security_storage?: ConsentStatusString;
68
+ [key: string]: unknown;
69
+ }
70
+
71
+ /**
72
+ * Whether a particular consent type has been granted or denied.
73
+ * @public
74
+ */
75
+ export declare type ConsentStatusString = 'granted' | 'denied';
76
+
45
77
  /**
46
78
  * Standard `gtag.js` control parameters.
47
79
  * For more information, see
@@ -637,6 +669,17 @@ export declare interface Promotion {
637
669
  */
638
670
  export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;
639
671
 
672
+ /**
673
+ * Sets the applicable end user consent state for this web app across all gtag references once
674
+ * Firebase Analytics is initialized.
675
+ *
676
+ * Use the {@link ConsentSettings} to specify individual consent type values. By default consent
677
+ * types are set to "granted".
678
+ * @public
679
+ * @param consentSettings - Maps the applicable end user consent state for gtag.js.
680
+ */
681
+ export declare function setConsent(consentSettings: ConsentSettings): void;
682
+
640
683
  /**
641
684
  * Use gtag `config` command to set `screen_name`.
642
685
  *
@@ -650,6 +693,15 @@ export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analyti
650
693
  */
651
694
  export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
652
695
 
696
+ /**
697
+ * Adds data that will be set on every event logged from the SDK, including automatic ones.
698
+ * With gtag's "set" command, the values passed persist on the current page and are passed with
699
+ * all subsequent events.
700
+ * @public
701
+ * @param customParams - Any custom params the user may pass to gtag.js.
702
+ */
703
+ export declare function setDefaultEventParameters(customParams: CustomParams): void;
704
+
653
705
  /**
654
706
  * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.
655
707
  * Intended to be used if `gtag.js` script has been installed on
@@ -42,6 +42,38 @@ export declare interface AnalyticsSettings {
42
42
  config?: GtagConfigParams | EventParams;
43
43
  }
44
44
 
45
+ /**
46
+ * Consent status settings for each consent type.
47
+ * For more information, see
48
+ * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
49
+ * | the GA4 reference documentation for consent state and consent types}.
50
+ * @public
51
+ */
52
+ export declare interface ConsentSettings {
53
+ /** Enables storage, such as cookies, related to advertising */
54
+ ad_storage?: ConsentStatusString;
55
+ /** Enables storage, such as cookies, related to analytics (for example, visit duration) */
56
+ analytics_storage?: ConsentStatusString;
57
+ /**
58
+ * Enables storage that supports the functionality of the website or app such as language settings
59
+ */
60
+ functionality_storage?: ConsentStatusString;
61
+ /** Enables storage related to personalization such as video recommendations */
62
+ personalization_storage?: ConsentStatusString;
63
+ /**
64
+ * Enables storage related to security such as authentication functionality, fraud prevention,
65
+ * and other user protection.
66
+ */
67
+ security_storage?: ConsentStatusString;
68
+ [key: string]: unknown;
69
+ }
70
+
71
+ /**
72
+ * Whether a particular consent type has been granted or denied.
73
+ * @public
74
+ */
75
+ export declare type ConsentStatusString = 'granted' | 'denied';
76
+
45
77
  /**
46
78
  * Standard `gtag.js` control parameters.
47
79
  * For more information, see
@@ -637,6 +669,17 @@ export declare interface Promotion {
637
669
  */
638
670
  export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analytics, enabled: boolean): void;
639
671
 
672
+ /**
673
+ * Sets the applicable end user consent state for this web app across all gtag references once
674
+ * Firebase Analytics is initialized.
675
+ *
676
+ * Use the {@link ConsentSettings} to specify individual consent type values. By default consent
677
+ * types are set to "granted".
678
+ * @public
679
+ * @param consentSettings - Maps the applicable end user consent state for gtag.js.
680
+ */
681
+ export declare function setConsent(consentSettings: ConsentSettings): void;
682
+
640
683
  /**
641
684
  * Use gtag `config` command to set `screen_name`.
642
685
  *
@@ -650,6 +693,15 @@ export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analyti
650
693
  */
651
694
  export declare function setCurrentScreen(analyticsInstance: Analytics, screenName: string, options?: AnalyticsCallOptions): void;
652
695
 
696
+ /**
697
+ * Adds data that will be set on every event logged from the SDK, including automatic ones.
698
+ * With gtag's "set" command, the values passed persist on the current page and are passed with
699
+ * all subsequent events.
700
+ * @public
701
+ * @param customParams - Any custom params the user may pass to gtag.js.
702
+ */
703
+ export declare function setDefaultEventParameters(customParams: CustomParams): void;
704
+
653
705
  /**
654
706
  * Configures Firebase Analytics to use custom `gtag` or `dataLayer` names.
655
707
  * Intended to be used if `gtag.js` script has been installed on
@@ -277,8 +277,14 @@ measurementIdToAppId) {
277
277
  _a.sent();
278
278
  return [3 /*break*/, 5];
279
279
  case 4:
280
- // If SET, second arg must be params.
281
- gtagCore("set" /* SET */, idOrNameOrParams);
280
+ if (command === "consent" /* CONSENT */) {
281
+ // If CONFIG, second arg must be measurementId.
282
+ gtagCore("consent" /* CONSENT */, 'update', gtagParams);
283
+ }
284
+ else {
285
+ // If SET, second arg must be params.
286
+ gtagCore("set" /* SET */, idOrNameOrParams);
287
+ }
282
288
  _a.label = 5;
283
289
  case 5: return [3 /*break*/, 7];
284
290
  case 6:
@@ -662,6 +668,188 @@ var AnalyticsAbortSignal = /** @class */ (function () {
662
668
  return AnalyticsAbortSignal;
663
669
  }());
664
670
 
671
+ /**
672
+ * @license
673
+ * Copyright 2019 Google LLC
674
+ *
675
+ * Licensed under the Apache License, Version 2.0 (the "License");
676
+ * you may not use this file except in compliance with the License.
677
+ * You may obtain a copy of the License at
678
+ *
679
+ * http://www.apache.org/licenses/LICENSE-2.0
680
+ *
681
+ * Unless required by applicable law or agreed to in writing, software
682
+ * distributed under the License is distributed on an "AS IS" BASIS,
683
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
684
+ * See the License for the specific language governing permissions and
685
+ * limitations under the License.
686
+ */
687
+ /**
688
+ * Event parameters to set on 'gtag' during initialization.
689
+ */
690
+ var defaultEventParametersForInit;
691
+ /**
692
+ * Logs an analytics event through the Firebase SDK.
693
+ *
694
+ * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
695
+ * @param eventName Google Analytics event name, choose from standard list or use a custom string.
696
+ * @param eventParams Analytics event parameters.
697
+ */
698
+ function logEvent$1(gtagFunction, initializationPromise, eventName, eventParams, options) {
699
+ return __awaiter(this, void 0, void 0, function () {
700
+ var measurementId, params;
701
+ return __generator(this, function (_a) {
702
+ switch (_a.label) {
703
+ case 0:
704
+ if (!(options && options.global)) return [3 /*break*/, 1];
705
+ gtagFunction("event" /* EVENT */, eventName, eventParams);
706
+ return [2 /*return*/];
707
+ case 1: return [4 /*yield*/, initializationPromise];
708
+ case 2:
709
+ measurementId = _a.sent();
710
+ params = __assign(__assign({}, eventParams), { 'send_to': measurementId });
711
+ gtagFunction("event" /* EVENT */, eventName, params);
712
+ _a.label = 3;
713
+ case 3: return [2 /*return*/];
714
+ }
715
+ });
716
+ });
717
+ }
718
+ /**
719
+ * Set screen_name parameter for this Google Analytics ID.
720
+ *
721
+ * @deprecated Use {@link logEvent} with `eventName` as 'screen_view' and add relevant `eventParams`.
722
+ * See {@link https://firebase.google.com/docs/analytics/screenviews | Track Screenviews}.
723
+ *
724
+ * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
725
+ * @param screenName Screen name string to set.
726
+ */
727
+ function setCurrentScreen$1(gtagFunction, initializationPromise, screenName, options) {
728
+ return __awaiter(this, void 0, void 0, function () {
729
+ var measurementId;
730
+ return __generator(this, function (_a) {
731
+ switch (_a.label) {
732
+ case 0:
733
+ if (!(options && options.global)) return [3 /*break*/, 1];
734
+ gtagFunction("set" /* SET */, { 'screen_name': screenName });
735
+ return [2 /*return*/, Promise.resolve()];
736
+ case 1: return [4 /*yield*/, initializationPromise];
737
+ case 2:
738
+ measurementId = _a.sent();
739
+ gtagFunction("config" /* CONFIG */, measurementId, {
740
+ update: true,
741
+ 'screen_name': screenName
742
+ });
743
+ _a.label = 3;
744
+ case 3: return [2 /*return*/];
745
+ }
746
+ });
747
+ });
748
+ }
749
+ /**
750
+ * Set user_id parameter for this Google Analytics ID.
751
+ *
752
+ * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
753
+ * @param id User ID string to set
754
+ */
755
+ function setUserId$1(gtagFunction, initializationPromise, id, options) {
756
+ return __awaiter(this, void 0, void 0, function () {
757
+ var measurementId;
758
+ return __generator(this, function (_a) {
759
+ switch (_a.label) {
760
+ case 0:
761
+ if (!(options && options.global)) return [3 /*break*/, 1];
762
+ gtagFunction("set" /* SET */, { 'user_id': id });
763
+ return [2 /*return*/, Promise.resolve()];
764
+ case 1: return [4 /*yield*/, initializationPromise];
765
+ case 2:
766
+ measurementId = _a.sent();
767
+ gtagFunction("config" /* CONFIG */, measurementId, {
768
+ update: true,
769
+ 'user_id': id
770
+ });
771
+ _a.label = 3;
772
+ case 3: return [2 /*return*/];
773
+ }
774
+ });
775
+ });
776
+ }
777
+ /**
778
+ * Set all other user properties other than user_id and screen_name.
779
+ *
780
+ * @param gtagFunction Wrapped gtag function that waits for fid to be set before sending an event
781
+ * @param properties Map of user properties to set
782
+ */
783
+ function setUserProperties$1(gtagFunction, initializationPromise, properties, options) {
784
+ return __awaiter(this, void 0, void 0, function () {
785
+ var flatProperties, _i, _a, key, measurementId;
786
+ return __generator(this, function (_b) {
787
+ switch (_b.label) {
788
+ case 0:
789
+ if (!(options && options.global)) return [3 /*break*/, 1];
790
+ flatProperties = {};
791
+ for (_i = 0, _a = Object.keys(properties); _i < _a.length; _i++) {
792
+ key = _a[_i];
793
+ // use dot notation for merge behavior in gtag.js
794
+ flatProperties["user_properties." + key] = properties[key];
795
+ }
796
+ gtagFunction("set" /* SET */, flatProperties);
797
+ return [2 /*return*/, Promise.resolve()];
798
+ case 1: return [4 /*yield*/, initializationPromise];
799
+ case 2:
800
+ measurementId = _b.sent();
801
+ gtagFunction("config" /* CONFIG */, measurementId, {
802
+ update: true,
803
+ 'user_properties': properties
804
+ });
805
+ _b.label = 3;
806
+ case 3: return [2 /*return*/];
807
+ }
808
+ });
809
+ });
810
+ }
811
+ /**
812
+ * Set whether collection is enabled for this ID.
813
+ *
814
+ * @param enabled If true, collection is enabled for this ID.
815
+ */
816
+ function setAnalyticsCollectionEnabled$1(initializationPromise, enabled) {
817
+ return __awaiter(this, void 0, void 0, function () {
818
+ var measurementId;
819
+ return __generator(this, function (_a) {
820
+ switch (_a.label) {
821
+ case 0: return [4 /*yield*/, initializationPromise];
822
+ case 1:
823
+ measurementId = _a.sent();
824
+ window["ga-disable-" + measurementId] = !enabled;
825
+ return [2 /*return*/];
826
+ }
827
+ });
828
+ });
829
+ }
830
+ /**
831
+ * Consent parameters to default to during 'gtag' initialization.
832
+ */
833
+ var defaultConsentSettingsForInit;
834
+ /**
835
+ * Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of
836
+ * analytics.
837
+ *
838
+ * @param consentSettings Maps the applicable end user consent state for gtag.js.
839
+ */
840
+ function _setConsentDefaultForInit(consentSettings) {
841
+ defaultConsentSettingsForInit = consentSettings;
842
+ }
843
+ /**
844
+ * Sets the variable `defaultEventParametersForInit` for use in the initialization of
845
+ * analytics.
846
+ *
847
+ * @param customParams Any custom params the user may pass to gtag.js.
848
+ */
849
+ function _setDefaultEventParametersForInit(customParams) {
850
+ defaultEventParametersForInit = customParams;
851
+ }
852
+
665
853
  /**
666
854
  * @license
667
855
  * Copyright 2020 Google LLC
@@ -762,6 +950,11 @@ function _initializeAnalytics(app, dynamicConfigPromisesList, measurementIdToApp
762
950
  if (!findGtagScriptOnPage()) {
763
951
  insertScriptTag(dataLayerName, dynamicConfig.measurementId);
764
952
  }
953
+ // Detects if there are consent settings that need to be configured.
954
+ if (defaultConsentSettingsForInit) {
955
+ gtagCore("consent" /* CONSENT */, 'default', defaultConsentSettingsForInit);
956
+ _setConsentDefaultForInit(undefined);
957
+ }
765
958
  // This command initializes gtag.js and only needs to be called once for the entire web app,
766
959
  // but since it is idempotent, we can call it multiple times.
767
960
  // We keep it together with other initialization logic for better code structure.
@@ -779,6 +972,11 @@ function _initializeAnalytics(app, dynamicConfigPromisesList, measurementIdToApp
779
972
  // Note: This will trigger a page_view event unless 'send_page_view' is set to false in
780
973
  // `configProperties`.
781
974
  gtagCore("config" /* CONFIG */, dynamicConfig.measurementId, configProperties);
975
+ // Detects if there is data that will be set on every event logged from the SDK.
976
+ if (defaultEventParametersForInit) {
977
+ gtagCore("set" /* SET */, defaultEventParametersForInit);
978
+ _setDefaultEventParametersForInit(undefined);
979
+ }
782
980
  return [2 /*return*/, dynamicConfig.measurementId];
783
981
  }
784
982
  });
@@ -943,162 +1141,6 @@ function factory(app, installations, options) {
943
1141
  return analyticsInstance;
944
1142
  }
945
1143
 
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
1144
  /* eslint-disable @typescript-eslint/no-explicit-any */
1103
1145
  /**
1104
1146
  * Returns an {@link Analytics} instance for the given app.
@@ -1230,6 +1272,22 @@ function setAnalyticsCollectionEnabled(analyticsInstance, enabled) {
1230
1272
  analyticsInstance = getModularInstance(analyticsInstance);
1231
1273
  setAnalyticsCollectionEnabled$1(initializationPromisesMap[analyticsInstance.app.options.appId], enabled).catch(function (e) { return logger.error(e); });
1232
1274
  }
1275
+ /**
1276
+ * Adds data that will be set on every event logged from the SDK, including automatic ones.
1277
+ * With gtag's "set" command, the values passed persist on the current page and are passed with
1278
+ * all subsequent events.
1279
+ * @public
1280
+ * @param customParams - Any custom params the user may pass to gtag.js.
1281
+ */
1282
+ function setDefaultEventParameters(customParams) {
1283
+ // Check if reference to existing gtag function on window object exists
1284
+ if (wrappedGtagFunction) {
1285
+ wrappedGtagFunction("set" /* SET */, customParams);
1286
+ }
1287
+ else {
1288
+ _setDefaultEventParametersForInit(customParams);
1289
+ }
1290
+ }
1233
1291
  /**
1234
1292
  * Sends a Google Analytics event with given `eventParams`. This method
1235
1293
  * automatically associates this logged event with this Firebase web
@@ -1244,10 +1302,28 @@ function setAnalyticsCollectionEnabled(analyticsInstance, enabled) {
1244
1302
  function logEvent(analyticsInstance, eventName, eventParams, options) {
1245
1303
  analyticsInstance = getModularInstance(analyticsInstance);
1246
1304
  logEvent$1(wrappedGtagFunction, initializationPromisesMap[analyticsInstance.app.options.appId], eventName, eventParams, options).catch(function (e) { return logger.error(e); });
1305
+ }
1306
+ /**
1307
+ * Sets the applicable end user consent state for this web app across all gtag references once
1308
+ * Firebase Analytics is initialized.
1309
+ *
1310
+ * Use the {@link ConsentSettings} to specify individual consent type values. By default consent
1311
+ * types are set to "granted".
1312
+ * @public
1313
+ * @param consentSettings - Maps the applicable end user consent state for gtag.js.
1314
+ */
1315
+ function setConsent(consentSettings) {
1316
+ // Check if reference to existing gtag function on window object exists
1317
+ if (wrappedGtagFunction) {
1318
+ wrappedGtagFunction("consent" /* CONSENT */, 'update', consentSettings);
1319
+ }
1320
+ else {
1321
+ _setConsentDefaultForInit(consentSettings);
1322
+ }
1247
1323
  }
1248
1324
 
1249
1325
  var name = "@firebase/analytics";
1250
- var version = "0.7.11-canary.b60cf76e1";
1326
+ var version = "0.7.11-canary.c187446a2";
1251
1327
 
1252
1328
  /**
1253
1329
  * Firebase Analytics
@@ -1284,5 +1360,5 @@ function registerAnalytics() {
1284
1360
  }
1285
1361
  registerAnalytics();
1286
1362
 
1287
- export { getAnalytics, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setCurrentScreen, setUserId, setUserProperties, settings };
1363
+ export { getAnalytics, initializeAnalytics, isSupported, logEvent, setAnalyticsCollectionEnabled, setConsent, setCurrentScreen, setDefaultEventParameters, setUserId, setUserProperties, settings };
1288
1364
  //# sourceMappingURL=index.esm.js.map