@react-native-firebase/analytics 21.13.0 → 22.0.0

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 CHANGED
@@ -3,6 +3,18 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [22.0.0](https://github.com/invertase/react-native-firebase/compare/v21.14.0...v22.0.0) (2025-04-25)
7
+
8
+ ### Bug Fixes
9
+
10
+ - **analytics:** Type defs ([#8363](https://github.com/invertase/react-native-firebase/issues/8363)) ([74efc84](https://github.com/invertase/react-native-firebase/commit/74efc848e3ecda47b5c7cdf79e5e72370cd10b7d))
11
+ - **android:** use `=` assignment vs deprecated space-assignment ([39c2ecb](https://github.com/invertase/react-native-firebase/commit/39c2ecb0069a8a5a65b04fb7f86ccecf83273868))
12
+ - enable provenance signing during publish ([4535f0d](https://github.com/invertase/react-native-firebase/commit/4535f0d5756c89aeb8f8e772348c71d8176348be))
13
+
14
+ ## [21.14.0](https://github.com/invertase/react-native-firebase/compare/v21.13.0...v21.14.0) (2025-04-14)
15
+
16
+ **Note:** Version bump only for package @react-native-firebase/analytics
17
+
6
18
  ## [21.13.0](https://github.com/invertase/react-native-firebase/compare/v21.12.3...v21.13.0) (2025-03-31)
7
19
 
8
20
  **Note:** Version bump only for package @react-native-firebase/analytics
@@ -119,11 +119,11 @@ if (rootProject.ext && rootProject.ext.firebaseJson) {
119
119
  android {
120
120
  def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')[0].toInteger()
121
121
  if (agpVersion >= 7) {
122
- namespace 'io.invertase.firebase.analytics'
122
+ namespace = 'io.invertase.firebase.analytics'
123
123
  }
124
124
 
125
125
  defaultConfig {
126
- multiDexEnabled true
126
+ multiDexEnabled = true
127
127
  manifestPlaceholders = [
128
128
  firebaseJsonAutoCollectionEnabled: dataCollectionEnabled,
129
129
  firebaseJsonCollectionDeactivated: collectionDeactivated,
@@ -139,18 +139,18 @@ android {
139
139
 
140
140
  buildFeatures {
141
141
  // AGP 8 no longer builds config by default
142
- buildConfig true
142
+ buildConfig = true
143
143
  }
144
144
 
145
145
  lintOptions {
146
146
  disable 'GradleCompatible'
147
- abortOnError false
147
+ abortOnError = false
148
148
  }
149
149
 
150
150
  if (agpVersion < 8) {
151
151
  compileOptions {
152
- sourceCompatibility JavaVersion.VERSION_11
153
- targetCompatibility JavaVersion.VERSION_11
152
+ sourceCompatibility = JavaVersion.VERSION_11
153
+ targetCompatibility = JavaVersion.VERSION_11
154
154
  }
155
155
  }
156
156
 
@@ -23,6 +23,14 @@ export declare function initializeAnalytics(
23
23
  options?: FirebaseAnalyticsTypes.AnalyticsSettings,
24
24
  ): Analytics;
25
25
 
26
+ /**
27
+ * Retrieves a unique Google Analytics identifier for the web client.
28
+ *
29
+ * @param analyticsInstance - Instance of analytics (web - only)
30
+ *
31
+ */
32
+ export declare function getGoogleAnalyticsClientId(analyticsInstance: Analytics): Promise<string>;
33
+
26
34
  /**
27
35
  * Log a custom event with optional params. Note that there are various limits that applied
28
36
  * to event parameters (total parameter count, etc), but analytics applies the limits during
@@ -605,10 +613,14 @@ export function getAppInstanceId(analytics: Analytics): Promise<string | null>;
605
613
  * Gives a user a unique identification.
606
614
  *
607
615
  * @param analytics Analytics instance.
608
- * @param id Set to null to remove a previously assigned ID from analytics
609
- * events
616
+ * @param id Set to null to remove a previously assigned ID from analytics events
617
+ * @param options Additional options that can be passed to Analytics method calls such as logEvent, etc.
610
618
  */
611
- export function setUserId(analytics: Analytics, id: string | null): Promise<void>;
619
+ export function setUserId(
620
+ analytics: Analytics,
621
+ id: string | null,
622
+ options?: AnalyticsCallOptions,
623
+ ): Promise<void>;
612
624
 
613
625
  /**
614
626
  * Sets a key/value pair of data on the current user. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties.
@@ -1,4 +1,5 @@
1
1
  import { getApp } from '@react-native-firebase/app';
2
+ import { Platform } from 'react-native';
2
3
 
3
4
  /**
4
5
  * @typedef {import('@firebase/app').FirebaseApp} FirebaseApp
@@ -64,6 +65,20 @@ export function initializeAnalytics(app, options) {
64
65
  return getApp(app.name).analytics();
65
66
  }
66
67
 
68
+ /**
69
+ * Retrieves a unique Google Analytics identifier for the web client.
70
+ *
71
+ * @param {FirebaseAnalytics} analytics - Instance of analytics (web - only)
72
+ * @returns {Promise<string>}
73
+ */
74
+ export async function getGoogleAnalyticsClientId(analytics) {
75
+ if (Platform.OS === 'android' || Platform.OS === 'ios') {
76
+ throw new Error('getGoogleAnalyticsClientId is web-only.');
77
+ } else {
78
+ return getAppInstanceId(analytics);
79
+ }
80
+ }
81
+
67
82
  /**
68
83
  * Log a custom event with optional params.
69
84
  * @param {FirebaseAnalytics} analytics - Analytics instance.
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '21.13.0';
2
+ module.exports = '22.0.0';
@@ -5,8 +5,8 @@ import { AnalyticsApi } from './api';
5
5
 
6
6
  let analyticsInstances = {};
7
7
 
8
- function getAnalyticsApi() {
9
- const app = getApp('[DEFAULT]');
8
+ function getAnalyticsApi(appName) {
9
+ const app = getApp(appName);
10
10
  const measurementId = app.options.measurementId;
11
11
  if (!measurementId) {
12
12
  // eslint-disable-next-line no-console
@@ -104,9 +104,9 @@ export default {
104
104
  },
105
105
 
106
106
  getAppInstanceId() {
107
- // Unsupported for web.
108
107
  return guard(async () => {
109
- return null;
108
+ const api = getAnalyticsApi('[DEFAULT]');
109
+ return api._getCid();
110
110
  });
111
111
  },
112
112
 
package/lib/web/api.js CHANGED
@@ -171,24 +171,22 @@ class AnalyticsApi {
171
171
  await setItem('analytics:cid', this.cid);
172
172
  if (isMemoryStorage()) {
173
173
  console.warn(
174
- ```
175
- Firebase Analytics is using in memory persistence. This means that the analytics
176
- client ID is reset every time your app is restarted which may result in
177
- inaccurate data being shown on the Firebase Analytics dashboard.
178
-
179
- To enable persistence, provide an Async Storage implementation.
180
-
181
- For example, to use React Native Async Storage:
182
-
183
- import AsyncStorage from '@react-native-async-storage/async-storage';
184
-
185
- // Before initializing Firebase set the Async Storage implementation
186
- // that will be used to persist user sessions.
187
- firebase.setReactNativeAsyncStorage(AsyncStorage);
188
-
189
- // Then initialize Firebase as normal.
190
- await firebase.initializeApp({ ... });
191
- ```,
174
+ 'Firebase Analytics is using in memory persistence. This means that the analytics\n' +
175
+ 'client ID is reset every time your app is restarted which may result in\n' +
176
+ 'inaccurate data being shown on the Firebase Analytics dashboard.\n' +
177
+ '\n' +
178
+ 'To enable persistence, provide an Async Storage implementation.\n' +
179
+ '\n' +
180
+ 'For example, to use React Native Async Storage:\n' +
181
+ '\n' +
182
+ " import AsyncStorage from '@react-native-async-storage/async-storage';\n" +
183
+ '\n' +
184
+ ' // Before initializing Firebase set the Async Storage implementation\n' +
185
+ ' // that will be used to persist user sessions.\n' +
186
+ ' firebase.setReactNativeAsyncStorage(AsyncStorage);\n' +
187
+ '\n' +
188
+ ' // Then initialize Firebase as normal.\n' +
189
+ ' await firebase.initializeApp({ ... });\n',
192
190
  );
193
191
  }
194
192
  return this.cid;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/analytics",
3
- "version": "21.13.0",
3
+ "version": "22.0.0",
4
4
  "author": "Invertase <oss@invertase.io> (http://invertase.io)",
5
5
  "description": "React Native Firebase - The analytics module provides out of the box support with Google Analytics for Firebase. Integration with the Android & iOS allows for in-depth analytical insight reporting, such as device information, location, user actions and more.",
6
6
  "main": "lib/index.js",
@@ -22,13 +22,14 @@
22
22
  "analytics"
23
23
  ],
24
24
  "peerDependencies": {
25
- "@react-native-firebase/app": "21.13.0"
25
+ "@react-native-firebase/app": "22.0.0"
26
26
  },
27
27
  "publishConfig": {
28
- "access": "public"
28
+ "access": "public",
29
+ "provenance": true
29
30
  },
30
31
  "dependencies": {
31
32
  "superstruct": "^2.0.2"
32
33
  },
33
- "gitHead": "d4d02d15431a0be091a7417833e0180479f5e788"
34
+ "gitHead": "e9fee87b413c90e243347d5c60272f07f41d99b8"
34
35
  }