@firebase/analytics 0.7.11-canary.69e2ee064 → 0.7.11-canary.ad773fa45

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/src/api.d.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  * limitations under the License.
16
16
  */
17
17
  import { FirebaseApp } from '@firebase/app';
18
- import { Analytics, AnalyticsCallOptions, AnalyticsSettings, CustomParams, EventNameString, EventParams } from './public-types';
18
+ import { Analytics, AnalyticsCallOptions, AnalyticsSettings, ConsentSettings, CustomParams, EventNameString, EventParams } from './public-types';
19
19
  import { ANALYTICS_TYPE } from './constants';
20
20
  import { AnalyticsService } from './factory';
21
21
  export { settings } from './factory';
@@ -94,7 +94,7 @@ export declare function setAnalyticsCollectionEnabled(analyticsInstance: Analyti
94
94
  * With gtag's "set" command, the values passed persist on the current page and are passed with
95
95
  * all subsequent events.
96
96
  * @public
97
- * @param customParams Any custom params the user may pass to gtag.js.
97
+ * @param customParams - Any custom params the user may pass to gtag.js.
98
98
  */
99
99
  export declare function setDefaultEventParameters(customParams: CustomParams): void;
100
100
  /**
@@ -432,3 +432,13 @@ export declare function logEvent<T extends string>(analyticsInstance: Analytics,
432
432
  * @public
433
433
  */
434
434
  export declare type CustomEventName<T> = T extends EventNameString ? never : T;
435
+ /**
436
+ * Sets the applicable end user consent state for this web app across all gtag references once
437
+ * Firebase Analytics is initialized.
438
+ *
439
+ * Use the {@link ConsentSettings} to specify individual consent type values. By default consent
440
+ * types are set to "granted".
441
+ * @public
442
+ * @param consentSettings - Maps the applicable end user consent state for gtag.js.
443
+ */
444
+ export declare function setConsent(consentSettings: ConsentSettings): void;
@@ -26,5 +26,6 @@ export declare const GTAG_URL = "https://www.googletagmanager.com/gtag/js";
26
26
  export declare const enum GtagCommand {
27
27
  EVENT = "event",
28
28
  SET = "set",
29
- CONFIG = "config"
29
+ CONFIG = "config",
30
+ CONSENT = "consent"
30
31
  }
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { AnalyticsCallOptions, CustomParams, EventParams } from './public-types';
17
+ import { AnalyticsCallOptions, CustomParams, EventParams, ConsentSettings } from './public-types';
18
18
  import { Gtag } from './types';
19
19
  /**
20
20
  * Event parameters to set on 'gtag' during initialization.
@@ -58,6 +58,17 @@ export declare function setUserProperties(gtagFunction: Gtag, initializationProm
58
58
  * @param enabled If true, collection is enabled for this ID.
59
59
  */
60
60
  export declare function setAnalyticsCollectionEnabled(initializationPromise: Promise<string>, enabled: boolean): Promise<void>;
61
+ /**
62
+ * Consent parameters to default to during 'gtag' initialization.
63
+ */
64
+ export declare let defaultConsentSettingsForInit: ConsentSettings | undefined;
65
+ /**
66
+ * Sets the variable {@link defaultConsentSettingsForInit} for use in the initialization of
67
+ * analytics.
68
+ *
69
+ * @param consentSettings Maps the applicable end user consent state for gtag.js.
70
+ */
71
+ export declare function _setConsentDefaultForInit(consentSettings?: ConsentSettings): void;
61
72
  /**
62
73
  * Sets the variable `defaultEventParametersForInit` for use in the initialization of
63
74
  * analytics.
@@ -246,3 +246,33 @@ export interface EventParams {
246
246
  page_path?: string;
247
247
  [key: string]: unknown;
248
248
  }
249
+ /**
250
+ * Consent status settings for each consent type.
251
+ * For more information, see
252
+ * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
253
+ * | the GA4 reference documentation for consent state and consent types}.
254
+ * @public
255
+ */
256
+ export interface ConsentSettings {
257
+ /** Enables storage, such as cookies, related to advertising */
258
+ ad_storage?: ConsentStatusString;
259
+ /** Enables storage, such as cookies, related to analytics (for example, visit duration) */
260
+ analytics_storage?: ConsentStatusString;
261
+ /**
262
+ * Enables storage that supports the functionality of the website or app such as language settings
263
+ */
264
+ functionality_storage?: ConsentStatusString;
265
+ /** Enables storage related to personalization such as video recommendations */
266
+ personalization_storage?: ConsentStatusString;
267
+ /**
268
+ * Enables storage related to security such as authentication functionality, fraud prevention,
269
+ * and other user protection.
270
+ */
271
+ security_storage?: ConsentStatusString;
272
+ [key: string]: unknown;
273
+ }
274
+ /**
275
+ * Whether a particular consent type has been granted or denied.
276
+ * @public
277
+ */
278
+ export declare type ConsentStatusString = 'granted' | 'denied';
@@ -14,7 +14,7 @@
14
14
  * See the License for the specific language governing permissions and
15
15
  * limitations under the License.
16
16
  */
17
- import { ControlParams, EventParams, CustomParams } from './public-types';
17
+ import { ControlParams, EventParams, CustomParams, ConsentSettings } from './public-types';
18
18
  /**
19
19
  * Encapsulates metadata concerning throttled fetch requests.
20
20
  */
@@ -48,5 +48,6 @@ export interface Gtag {
48
48
  (command: 'config', targetId: string, config?: ControlParams | EventParams | CustomParams): void;
49
49
  (command: 'set', config: CustomParams): void;
50
50
  (command: 'event', eventName: string, eventParams?: ControlParams | EventParams | CustomParams): void;
51
+ (command: 'consent', subCommand: 'default' | 'update', consentSettings: ConsentSettings): void;
51
52
  }
52
53
  export declare type DataLayer = IArguments[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@firebase/analytics",
3
- "version": "0.7.11-canary.69e2ee064",
3
+ "version": "0.7.11-canary.ad773fa45",
4
4
  "description": "A analytics package for new firebase packages",
5
5
  "author": "Firebase <firebase-support@google.com> (https://firebase.google.com/)",
6
6
  "main": "dist/index.cjs.js",
@@ -37,18 +37,18 @@
37
37
  "typings:public": "node ../../scripts/build/use_typings.js ./dist/analytics-public.d.ts"
38
38
  },
39
39
  "peerDependencies": {
40
- "@firebase/app": "0.7.27-canary.69e2ee064"
40
+ "@firebase/app": "0.7.27-canary.ad773fa45"
41
41
  },
42
42
  "dependencies": {
43
- "@firebase/installations": "0.5.11-canary.69e2ee064",
44
- "@firebase/logger": "0.3.3-canary.69e2ee064",
45
- "@firebase/util": "1.6.2-canary.69e2ee064",
46
- "@firebase/component": "0.5.16-canary.69e2ee064",
43
+ "@firebase/installations": "0.5.11-canary.ad773fa45",
44
+ "@firebase/logger": "0.3.3-canary.ad773fa45",
45
+ "@firebase/util": "1.6.2-canary.ad773fa45",
46
+ "@firebase/component": "0.5.16-canary.ad773fa45",
47
47
  "tslib": "^2.1.0"
48
48
  },
49
49
  "license": "Apache-2.0",
50
50
  "devDependencies": {
51
- "@firebase/app": "0.7.27-canary.69e2ee064",
51
+ "@firebase/app": "0.7.27-canary.ad773fa45",
52
52
  "rollup": "2.72.1",
53
53
  "@rollup/plugin-commonjs": "21.1.0",
54
54
  "@rollup/plugin-json": "4.1.0",