@react-native-firebase/analytics 17.2.0 → 17.3.1

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -3,6 +3,16 @@
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
+ ### [17.3.1](https://github.com/invertase/react-native-firebase/compare/v17.3.0...v17.3.1) (2023-02-23)
7
+
8
+ **Note:** Version bump only for package @react-native-firebase/analytics
9
+
10
+ ## [17.3.0](https://github.com/invertase/react-native-firebase/compare/v17.2.0...v17.3.0) (2023-02-15)
11
+
12
+ ### Features
13
+
14
+ - **analytics:** Expose modular API that matches the Firebase web JS SDK v9 API ([#6816](https://github.com/invertase/react-native-firebase/issues/6816)) ([a42551a](https://github.com/invertase/react-native-firebase/commit/a42551aadb98ba6fdd18dde627b436e667d0a014))
15
+
6
16
  ## [17.2.0](https://github.com/invertase/react-native-firebase/compare/v17.1.0...v17.2.0) (2023-02-15)
7
17
 
8
18
  **Note:** Version bump only for package @react-native-firebase/analytics
package/lib/index.d.ts CHANGED
@@ -630,6 +630,160 @@ export namespace FirebaseAnalyticsTypes {
630
630
 
631
631
  // eslint-disable-next-line @typescript-eslint/no-empty-interface
632
632
  export interface Statics {}
633
+ /**
634
+ * Analytics instance initialization options. Web only.
635
+ */
636
+ export interface AnalyticsSettings {
637
+ config?: GtagConfigParams | EventParams;
638
+ }
639
+ /**
640
+ * Additional options that can be passed to Analytics method calls such as logEvent. Web only.
641
+ */
642
+ export interface AnalyticsCallOptions {
643
+ /**
644
+ * If true, this config or event call applies globally to all Google Analytics properties on the page. Web only.
645
+ */
646
+ global: boolean;
647
+ }
648
+ /**
649
+ * A set of common Google Analytics config settings recognized by gtag.js. Web only.
650
+ */
651
+ export interface GtagConfigParams {
652
+ /**
653
+ * Whether or not a page view should be sent.
654
+ * If set to true (default), a page view is automatically sent upon initialization
655
+ * of analytics.
656
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
657
+ */
658
+ send_page_view?: boolean;
659
+ /**
660
+ * The title of the page.
661
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
662
+ */
663
+ page_title?: string;
664
+ /**
665
+ * The URL of the page.
666
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/page-view | Page views }
667
+ */
668
+ page_location?: string;
669
+ /**
670
+ * Defaults to `auto`.
671
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
672
+ */
673
+ cookie_domain?: string;
674
+ /**
675
+ * Defaults to 63072000 (two years, in seconds).
676
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
677
+ */
678
+ cookie_expires?: number;
679
+ /**
680
+ * Defaults to `_ga`.
681
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
682
+ */
683
+ cookie_prefix?: string;
684
+ /**
685
+ * If set to true, will update cookies on each page load.
686
+ * Defaults to true.
687
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
688
+ */
689
+ cookie_update?: boolean;
690
+ /**
691
+ * Appends additional flags to the cookie when set.
692
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/cookies-user-id | Cookies and user identification }
693
+ */
694
+ cookie_flags?: string;
695
+ /**
696
+ * If set to false, disables all advertising features with `gtag.js`.
697
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
698
+ */
699
+ allow_google_signals?: boolean;
700
+ /**
701
+ * If set to false, disables all advertising personalization with `gtag.js`.
702
+ * See {@link https://developers.google.com/analytics/devguides/collection/ga4/display-features | Disable advertising features }
703
+ */
704
+ allow_ad_personalization_signals?: boolean;
705
+ [key: string]: unknown;
706
+ }
707
+ /**
708
+ * Standard gtag.js event parameters. For more information, see the GA4 reference documentation. Web only.
709
+ */
710
+ export interface EventParams {
711
+ checkout_option?: string;
712
+ checkout_step?: number;
713
+ item_id?: string;
714
+ content_type?: string;
715
+ coupon?: string;
716
+ currency?: string;
717
+ description?: string;
718
+ fatal?: boolean;
719
+ items?: Item[];
720
+ method?: string;
721
+ number?: string;
722
+ promotions?: Promotion[];
723
+ screen_name?: string;
724
+ /**
725
+ * Firebase-specific. Use to log a `screen_name` to Firebase Analytics.
726
+ */
727
+ firebase_screen?: string;
728
+ /**
729
+ * Firebase-specific. Use to log a `screen_class` to Firebase Analytics.
730
+ */
731
+ firebase_screen_class?: string;
732
+ search_term?: string;
733
+ shipping?: Currency;
734
+ tax?: Currency;
735
+ transaction_id?: string;
736
+ value?: number;
737
+ event_label?: string;
738
+ event_category?: string;
739
+ shipping_tier?: string;
740
+ item_list_id?: string;
741
+ item_list_name?: string;
742
+ promotion_id?: string;
743
+ promotion_name?: string;
744
+ payment_type?: string;
745
+ affiliation?: string;
746
+ page_title?: string;
747
+ page_location?: string;
748
+ page_path?: string;
749
+ [key: string]: unknown;
750
+ }
751
+
752
+ /**
753
+ * Consent status settings for each consent type.
754
+ * For more information, see
755
+ * {@link https://developers.google.com/tag-platform/tag-manager/templates/consent-apis
756
+ * | the GA4 reference documentation for consent state and consent types}.
757
+ */
758
+ export interface ConsentSettings {
759
+ /** Enables storage, such as cookies, related to advertising */
760
+ ad_storage?: ConsentStatusString;
761
+ /** Enables storage, such as cookies, related to analytics (for example, visit duration) */
762
+ analytics_storage?: ConsentStatusString;
763
+ /**
764
+ * Enables storage that supports the functionality of the website or app such as language settings
765
+ */
766
+ functionality_storage?: ConsentStatusString;
767
+ /** Enables storage related to personalization such as video recommendations */
768
+ personalization_storage?: ConsentStatusString;
769
+ /**
770
+ * Enables storage related to security such as authentication functionality, fraud prevention,
771
+ * and other user protection.
772
+ */
773
+ security_storage?: ConsentStatusString;
774
+ [key: string]: unknown;
775
+ }
776
+
777
+ /**
778
+ * Specifies custom options for your Firebase Analytics instance.
779
+ * You must set these before initializing `firebase.analytics()`.
780
+ */
781
+ export interface SettingsOptions {
782
+ /** Sets custom name for `gtag` function. */
783
+ gtagName?: string;
784
+ /** Sets custom name for `dataLayer` array used by `gtag.js`. */
785
+ dataLayerName?: string;
786
+ }
633
787
 
634
788
  /**
635
789
  * The Firebase Analytics service interface.
@@ -665,8 +819,13 @@ export namespace FirebaseAnalyticsTypes {
665
819
  *
666
820
  * @param name Event name must not conflict with any Reserved Events.
667
821
  * @param params Parameters to be sent and displayed with the event.
822
+ * @param options Additional options that can be passed. Web only.
668
823
  */
669
- logEvent(name: string, params?: { [key: string]: any }): Promise<void>;
824
+ logEvent(
825
+ name: string,
826
+ params?: { [key: string]: any },
827
+ options?: AnalyticsCallOptions,
828
+ ): Promise<void>;
670
829
 
671
830
  /**
672
831
  * If true, allows the device to collect analytical data and send it to
@@ -757,8 +916,12 @@ export namespace FirebaseAnalyticsTypes {
757
916
  *
758
917
  * @react-native-firebase
759
918
  * @param properties Set a property value to null to remove it.
919
+ * @param options Additional options that can be passed. Web only.
760
920
  */
761
- setUserProperties(properties: { [key: string]: string | null }): Promise<void>;
921
+ setUserProperties(
922
+ properties: { [key: string]: string | null },
923
+ options?: AnalyticsCallOptions,
924
+ ): Promise<void>;
762
925
 
763
926
  /**
764
927
  * Clears all analytics data for this instance from the device and resets the app instance ID.
package/lib/index.js CHANGED
@@ -37,6 +37,55 @@ import { isBoolean } from '@react-native-firebase/app/lib/common';
37
37
  import version from './version';
38
38
  import * as structs from './structs';
39
39
 
40
+ export {
41
+ getAnalytics,
42
+ logEvent,
43
+ setAnalyticsCollectionEnabled,
44
+ setSessionTimeoutDuration,
45
+ getAppInstanceId,
46
+ setUserId,
47
+ setUserProperty,
48
+ setUserProperties,
49
+ resetAnalyticsData,
50
+ logAddPaymentInfo,
51
+ logScreenView,
52
+ logAddShippingInfo,
53
+ logAddToCart,
54
+ logAddToWishlist,
55
+ logAppOpen,
56
+ logBeginCheckout,
57
+ logCampaignDetails,
58
+ logEarnVirtualCurrency,
59
+ logGenerateLead,
60
+ logJoinGroup,
61
+ logLevelEnd,
62
+ logLevelStart,
63
+ logLevelUp,
64
+ logLogin,
65
+ logPostScore,
66
+ logSelectContent,
67
+ logPurchase,
68
+ logRefund,
69
+ logRemoveFromCart,
70
+ logSearch,
71
+ logSelectItem,
72
+ logSetCheckoutOption,
73
+ logSelectPromotion,
74
+ logShare,
75
+ logSignUp,
76
+ logSpendVirtualCurrency,
77
+ logTutorialBegin,
78
+ logTutorialComplete,
79
+ logUnlockAchievement,
80
+ logViewCart,
81
+ logViewItem,
82
+ logViewItemList,
83
+ logViewPromotion,
84
+ logViewSearchResults,
85
+ setDefaultEventParameters,
86
+ initiateOnDeviceConversionMeasurementWithEmailAddress,
87
+ } from '../modular/index';
88
+
40
89
  const ReservedEventNames = [
41
90
  'ad_activeview',
42
91
  'ad_click',
@@ -79,7 +128,7 @@ const namespace = 'analytics';
79
128
  const nativeModuleName = 'RNFBAnalyticsModule';
80
129
 
81
130
  class FirebaseAnalyticsModule extends FirebaseModule {
82
- logEvent(name, params = {}) {
131
+ logEvent(name, params = {}, options = {}) {
83
132
  if (!isString(name)) {
84
133
  throw new Error("firebase.analytics().logEvent(*) 'name' expected a string value.");
85
134
  }
@@ -102,6 +151,18 @@ class FirebaseAnalyticsModule extends FirebaseModule {
102
151
  );
103
152
  }
104
153
 
154
+ if (!isUndefined(options)) {
155
+ if (!isObject(options)) {
156
+ throw new Error(
157
+ "firebase.analytics().logEvent(_, _, *) 'options' expected an object value.",
158
+ );
159
+ }
160
+
161
+ if (!isUndefined(options.global) && !isBoolean(options.global)) {
162
+ throw new Error("'options.global' property expected a boolean.");
163
+ }
164
+ }
165
+
105
166
  return this.native.logEvent(name, params);
106
167
  }
107
168
 
@@ -157,13 +218,25 @@ class FirebaseAnalyticsModule extends FirebaseModule {
157
218
  return this.native.setUserProperty(name, value);
158
219
  }
159
220
 
160
- setUserProperties(properties) {
221
+ setUserProperties(properties, options = {}) {
161
222
  if (!isObject(properties)) {
162
223
  throw new Error(
163
224
  "firebase.analytics().setUserProperties(*) 'properties' expected an object of key/value pairs.",
164
225
  );
165
226
  }
166
227
 
228
+ if (!isUndefined(options)) {
229
+ if (!isObject(options)) {
230
+ throw new Error(
231
+ "firebase.analytics().logEvent(_, _, *) 'options' expected an object value.",
232
+ );
233
+ }
234
+
235
+ if (!isUndefined(options.global) && !isBoolean(options.global)) {
236
+ throw new Error("'options.global' property expected a boolean.");
237
+ }
238
+ }
239
+
167
240
  const entries = Object.entries(properties);
168
241
  for (let i = 0; i < entries.length; i++) {
169
242
  const [key, value] = entries[i];
package/lib/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
  // Generated by genversion.
2
- module.exports = '17.2.0';
2
+ module.exports = '17.3.1';
@@ -0,0 +1,596 @@
1
+ import { firebase } from '..';
2
+
3
+ /**
4
+ * Returns a Analytics instance for the given app.
5
+ * @param app - FirebaseApp. Optional.
6
+ * @returns {Analytics}
7
+ */
8
+ export function getAnalytics(app) {
9
+ if (app) {
10
+ return firebase.app(app.name).analytics();
11
+ }
12
+
13
+ return firebase.app().analytics();
14
+ }
15
+
16
+ /**
17
+ * Returns a Analytics instance for the given app.
18
+ * @param app - FirebaseApp.
19
+ * @param options - `AnalyticsSettings`. Web only.
20
+ * @returns {Analytics}
21
+ */
22
+ // eslint-disable-next-line
23
+ export function initializeAnalytics(app, options) {
24
+ // options is specifically for web. Implement when it becomes available.
25
+ return firebase.app(app.name).analytics();
26
+ }
27
+
28
+ /**
29
+ * Log a custom event with optional params. Note that there are various limits that applied
30
+ * to event parameters (total parameter count, etc), but analytics applies the limits during
31
+ * cloud processing, the errors will not be seen as Promise rejections when you call logEvent.
32
+ * While integrating this API in your app you are strongly encouraged to enable
33
+ * [DebugView](https://firebase.google.com/docs/analytics/debugview) -
34
+ * any errors in your events will show up in the firebase web console with links to relevant documentation
35
+ *
36
+ * @param analytics Analytics instance.
37
+ * @param name Event name must not conflict with any Reserved Events.
38
+ * @param params Parameters to be sent and displayed with the event.
39
+ * @param options Additional options that can be passed. Web only.
40
+ */
41
+ export function logEvent(analytics, name, eventParams = {}, options = {}) {
42
+ return analytics.logEvent(name, eventParams, options);
43
+ }
44
+
45
+ /**
46
+ * If true, allows the device to collect analytical data and send it to
47
+ * Firebase. Useful for GDPR.
48
+ *
49
+ * @param analytics Analytics instance.
50
+ * @param enabled A boolean value representing whether Analytics collection is enabled or disabled. Analytics collection is enabled by default.
51
+ */
52
+ export function setAnalyticsCollectionEnabled(analytics, enabled) {
53
+ return analytics.setAnalyticsCollectionEnabled(enabled);
54
+ }
55
+ /**
56
+ * Sets the duration of inactivity that terminates the current session.
57
+ *
58
+ * @param analytics Analytics instance.
59
+ * @param milliseconds The default value is 1800000 (30 minutes).
60
+ */
61
+ export function setSessionTimeoutDuration(analytics, milliseconds = 1800000) {
62
+ return analytics.setSessionTimeoutDuration(milliseconds);
63
+ }
64
+ /**
65
+ * Retrieve the app instance id of the application.
66
+ *
67
+ * @param analytics Analytics instance.
68
+ * @returns Returns the app instance id or null on android if FirebaseAnalytics.ConsentType.ANALYTICS_STORAGE has been set to FirebaseAnalytics.ConsentStatus.DENIED and null on iOS if ConsentType.analyticsStorage has been set to ConsentStatus.denied.
69
+ */
70
+ export function getAppInstanceId(analytics) {
71
+ return analytics.getAppInstanceId();
72
+ }
73
+ /**
74
+ * Gives a user a unique identification.
75
+ *
76
+ * @param analytics Analytics instance.
77
+ * @param id Set to null to remove a previously assigned ID from analytics
78
+ * events
79
+ */
80
+ export function setUserId(analytics, id) {
81
+ return analytics.setUserId(id);
82
+ }
83
+ /**
84
+ * 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.
85
+ *
86
+ * @param analytics Analytics instance.
87
+ * @param name A user property identifier.
88
+ * @param value Set to null to remove a previously assigned ID from analytics events.
89
+ */
90
+ export function setUserProperty(analytics, name, value) {
91
+ return analytics.setUserProperty(name, value);
92
+ }
93
+ /**
94
+ * Sets multiple key/value pairs of data on the current user. Each Firebase project can have up to 25 uniquely named (case-sensitive) user properties.
95
+ *
96
+ * > When you set user properties, be sure to never include personally identifiable information such as names, social security numbers, or email addresses, even in hashed form.
97
+ *
98
+ * @param analytics Analytics instance.
99
+ * @param properties Set a property value to null to remove it.
100
+ * @param options `AnalyticsCallOptions`. Additional options that can be passed. Web only.
101
+ */
102
+ export function setUserProperties(analytics, properties, options = {}) {
103
+ return analytics.setUserProperties(properties, options);
104
+ }
105
+ /**
106
+ * Clears all analytics data for this instance from the device and resets the app instance ID.
107
+ *
108
+ * @param analytics Analytics instance.
109
+ */
110
+ export function resetAnalyticsData(analytics) {
111
+ return analytics.resetAnalyticsData();
112
+ }
113
+ /**
114
+ * E-Commerce Purchase event. This event signifies that an item(s) was purchased by a user. Note: This is different from the in-app purchase event, which is reported
115
+ * automatically for Google Play-based apps.
116
+ *
117
+ * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately.
118
+ *
119
+ * Logged event name: `purchase`
120
+ *
121
+ * @param analytics Analytics instance.
122
+ * @param params See {@link analytics.AddPaymentInfoEventParameters}.
123
+ */
124
+ export function logAddPaymentInfo(analytics, object = {}) {
125
+ return analytics.logAddPaymentInfo(object);
126
+ }
127
+ /**
128
+ * Sets or clears the screen name and class the user is currently viewing
129
+ *
130
+ * @param analytics Analytics instance.
131
+ * @param params See {@link analytics.ScreenViewParameters}.
132
+ */
133
+ export function logScreenView(analytics, object = {}) {
134
+ return analytics.logScreenView(object);
135
+ }
136
+ /**
137
+ * Add Payment Info event. This event signifies that a user has submitted their payment information to your app.
138
+ *
139
+ * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately.
140
+ *
141
+ * Logged event name: `add_payment_info`
142
+ *
143
+ * @param analytics Analytics instance.
144
+ * @param params See {@link analytics.AddShippingInfoParameters}.
145
+ */
146
+ export function logAddShippingInfo(analytics, object = {}) {
147
+ return analytics.logAddShippingInfo(object);
148
+ }
149
+ /**
150
+ * E-Commerce Add To Cart event.
151
+ *
152
+ * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately.
153
+ *
154
+ * Logged event name: `add_to_cart`
155
+ *
156
+ * @param analytics Analytics instance.
157
+ * @param params See {@link analytics.AddToCartEventParameters}.
158
+ */
159
+ export function logAddToCart(analytics, object = {}) {
160
+ return analytics.logAddToCart(object);
161
+ }
162
+ /**
163
+ * E-Commerce Add To Wishlist event. This event signifies that an item was added to a wishlist.
164
+ * Use this event to identify popular gift items in your app.
165
+ *
166
+ * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately.
167
+ *
168
+ * Logged event name: `add_to_wishlist
169
+ *
170
+ * @param analytics Analytics instance.
171
+ * @param params See {@link analytics.AddToWishlistEventParameters}.
172
+ */
173
+ export function logAddToWishlist(analytics, object = {}) {
174
+ return analytics.logAddToWishlist(object);
175
+ }
176
+ /**
177
+ * App Open event. By logging this event when an App is moved to the foreground, developers can
178
+ * understand how often users leave and return during the course of a Session. Although Sessions
179
+ * are automatically reported, this event can provide further clarification around the continuous
180
+ * engagement of app-users.
181
+ *
182
+ * @param analytics Analytics instance.
183
+ */
184
+ export function logAppOpen(analytics) {
185
+ return analytics.logAppOpen();
186
+ }
187
+ /**
188
+ * E-Commerce Begin Checkout event. This event signifies that a user has begun the process of
189
+ * checking out.
190
+ *
191
+ * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately.
192
+ *
193
+ * Logged event name: `begin_checkout`
194
+ *
195
+ * @param analytics Analytics instance.
196
+ * @param params See {@link analytics.BeginCheckoutEventParameters}.
197
+ */
198
+ export function logBeginCheckout(analytics, object = {}) {
199
+ return analytics.logBeginCheckout(object);
200
+ }
201
+ /**
202
+ * Log this event to supply the referral details of a re-engagement campaign.
203
+ *
204
+ * Logged event name: `campaign_details`
205
+ *
206
+ * @param analytics Analytics instance.
207
+ * @param params See {@link analytics.CampaignDetailsEventParameters}.
208
+ */
209
+ export function logCampaignDetails(analytics, object = {}) {
210
+ return analytics.logCampaignDetails(object);
211
+ }
212
+ /**
213
+ * Earn Virtual Currency event. This event tracks the awarding of virtual currency in your app. Log this along with
214
+ * {@link analytics.logSpendVirtualCurrency} to better understand your virtual economy.
215
+ *
216
+ * Logged event name: `earn_virtual_currency`
217
+ *
218
+ * @param analytics Analytics instance.
219
+ * @param params See {@link analytics.EarnVirtualCurrencyEventParameters}.
220
+ */
221
+ export function logEarnVirtualCurrency(analytics, object = {}) {
222
+ return analytics.logEarnVirtualCurrency(object);
223
+ }
224
+ /**
225
+ * Generate Lead event. Log this event when a lead has been generated in the app to understand
226
+ * the efficacy of your install and re-engagement campaigns.
227
+ *
228
+ * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately.
229
+ *
230
+ * Logged event name: `generate_lead`
231
+ *
232
+ * @param analytics Analytics instance.
233
+ * @param params See {@link analytics.GenerateLeadEventParameters}.
234
+ */
235
+ export function logGenerateLead(analytics, object = {}) {
236
+ return analytics.logGenerateLead(object);
237
+ }
238
+ /**
239
+ * Join Group event. Log this event when a user joins a group such as a guild, team or family.
240
+ * Use this event to analyze how popular certain groups or social features are in your app
241
+ *
242
+ * Logged event name: `join_group`
243
+ *
244
+ * @param analytics Analytics instance.
245
+ * @param params See {@link analytics.JoinGroupEventParameters}.
246
+ */
247
+ export function logJoinGroup(analytics, object = {}) {
248
+ return analytics.logJoinGroup(object);
249
+ }
250
+ /**
251
+ * Level End event.
252
+ *
253
+ * Logged event name: `level_end`
254
+ *
255
+ * @param analytics Analytics instance.
256
+ * @param params See {@link analytics.LevelEndEventParameters}.
257
+ */
258
+ export function logLevelEnd(analytics, object = {}) {
259
+ return analytics.logLevelEnd(object);
260
+ }
261
+ /**
262
+ * Level Start event.
263
+ *
264
+ * Logged event name: `level_start`
265
+ *
266
+ * @param analytics Analytics instance.
267
+ * @param params See {@link analytics.LevelStartEventParameters}.
268
+ */
269
+ export function logLevelStart(analytics, object = {}) {
270
+ return analytics.logLevelStart(object);
271
+ }
272
+ /**
273
+ * Level Up event. This event signifies that a player has leveled up in your gaming app.
274
+ * It can help you gauge the level distribution of your userbase and help you identify certain levels that are difficult to pass.
275
+ *
276
+ * Logged event name: `level_up`
277
+ *
278
+ * @param analytics Analytics instance.
279
+ * @param params See {@link analytics.LevelUpEventParameters}.
280
+ */
281
+ export function logLevelUp(analytics, object = {}) {
282
+ return analytics.logLevelUp(object);
283
+ }
284
+ /**
285
+ * Login event. Apps with a login feature can report this event to signify that a user has logged in.
286
+ *
287
+ * Logged event name: `login`
288
+ *
289
+ * @param analytics Analytics instance.
290
+ * @param params See {@link analytics.LoginEventParameters}.
291
+ */
292
+ export function logLogin(analytics, object = {}) {
293
+ return analytics.logLogin(object);
294
+ }
295
+ /**
296
+ * Post Score event. Log this event when the user posts a score in your gaming app. This event can
297
+ * help you understand how users are actually performing in your game and it can help you correlate
298
+ * high scores with certain audiences or behaviors.
299
+ *
300
+ * Logged event name: `post_score`
301
+ *
302
+ * @param analytics Analytics instance.
303
+ * @param params See {@link analytics.PostScoreEventParameters}.
304
+ */
305
+ export function logPostScore(analytics, object = {}) {
306
+ return analytics.logPostScore(object);
307
+ }
308
+ /**
309
+ * Select Content event. This general purpose event signifies that a user has selected some
310
+ * content of a certain type in an app. The content can be any object in your app. This event
311
+ * can help you identify popular content and categories of content in your app.
312
+ *
313
+ * Logged event name: `select_content`
314
+ *
315
+ * @param analytics Analytics instance.
316
+ * @param params See {@link analytics.SelectContentEventParameters}.
317
+ */
318
+ export function logSelectContent(analytics, object = {}) {
319
+ return analytics.logSelectContent(object);
320
+ }
321
+ /**
322
+ * E-Commerce Purchase event. This event signifies that an item(s) was purchased by a user. Note: This is different from the in-app purchase event, which is reported
323
+ * automatically for Google Play-based apps.
324
+ *
325
+ * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately.
326
+ *
327
+ * Logged event name: `purchase`
328
+ *
329
+ * @param analytics Analytics instance.
330
+ * @param params See {@link analytics.PurchaseEventParameters}.
331
+ */
332
+ export function logPurchase(analytics, object = {}) {
333
+ return analytics.logPurchase(object);
334
+ }
335
+ /**
336
+ * E-Commerce Refund event. This event signifies that a refund was issued.
337
+ *
338
+ * Logged event name: `remove_from_cart`
339
+ *
340
+ * @param analytics Analytics instance.
341
+ * @param params See {@link analytics.RefundEventParameters}.
342
+ */
343
+ export function logRefund(analytics, object = {}) {
344
+ return analytics.logRefund(object);
345
+ }
346
+ /**
347
+ * Remove from cart event.
348
+ *
349
+ * Logged event name: `remove_from_cart`
350
+ *
351
+ * @param analytics Analytics instance.
352
+ * @param params See {@link analytics.RemoveFromCartEventParameters}.
353
+ */
354
+ export function logRemoveFromCart(analytics, object = {}) {
355
+ return analytics.logRemoveFromCart(object);
356
+ }
357
+ /**
358
+ * Search event. Apps that support search features can use this event to contextualize search
359
+ * operations by supplying the appropriate, corresponding parameters. This event can help you
360
+ * identify the most popular content in your app.
361
+ *
362
+ * Logged event name: `search`
363
+ *
364
+ * @param analytics Analytics instance.
365
+ * @param params See {@link analytics.SearchEventParameters}.
366
+ */
367
+ export function logSearch(analytics, object = {}) {
368
+ return analytics.logSearch(object);
369
+ }
370
+ /**
371
+ * Select Item event. This event signifies that an item was selected by a user from a list.
372
+ * Use the appropriate parameters to contextualize the event.
373
+ * Use this event to discover the most popular items selected.
374
+ *
375
+ * Logged event name: `select_item`
376
+ *
377
+ * @param analytics Analytics instance.
378
+ * @param params See {@link analytics.SelectItemEventParameters}.
379
+ */
380
+ export function logSelectItem(analytics, object = {}) {
381
+ return analytics.logSelectItem(object);
382
+ }
383
+ /**
384
+ * Set checkout option event.
385
+ *
386
+ * Logged event name: `set_checkout_option`
387
+ *
388
+ * @param analytics Analytics instance.
389
+ * @param params See {@link analytics.SetCheckoutOptionEventParameters}.
390
+ */
391
+ export function logSetCheckoutOption(analytics, object = {}) {
392
+ return analytics.logSetCheckoutOption(object);
393
+ }
394
+ /**
395
+ * Select promotion event. This event signifies that a user has selected a promotion offer. Use the
396
+ * appropriate parameters to contextualize the event, such as the item(s) for which the promotion applies.
397
+ *
398
+ * Logged event name: `select_promotion`
399
+ *
400
+ * @param analytics Analytics instance.
401
+ * @param params See {@link analytics.SelectPromotionEventParameters}.
402
+ */
403
+ export function logSelectPromotion(analytics, object = {}) {
404
+ return analytics.logSelectPromotion(object);
405
+ }
406
+ /**
407
+ * Share event. Apps with social features can log the Share event to identify the most viral content.
408
+ *
409
+ * Logged event name: `share`
410
+ *
411
+ * @param analytics Analytics instance.
412
+ * @param params See {@link analytics.ShareEventParameters}.
413
+ */
414
+ export function logShare(analytics, object = {}) {
415
+ return analytics.logShare(object);
416
+ }
417
+ /**
418
+ * Sign Up event. This event indicates that a user has signed up for an account in your app.
419
+ * The parameter signifies the method by which the user signed up. Use this event to understand
420
+ * the different behaviors between logged in and logged out users.
421
+ *
422
+ * Logged event name: `sign_up`
423
+ *
424
+ * @param analytics Analytics instance.
425
+ * @param params See {@link analytics.SignUpEventParameters}.
426
+ */
427
+ export function logSignUp(analytics, object = {}) {
428
+ return analytics.logSignUp(object);
429
+ }
430
+ /**
431
+ * Spend Virtual Currency event. This event tracks the sale of virtual goods in your app and can
432
+ * help you identify which virtual goods are the most popular objects of purchase.
433
+ *
434
+ * Logged event name: `spend_virtual_currency`
435
+ *
436
+ * @param analytics Analytics instance.
437
+ * @param params See {@link analytics.SpendVirtualCurrencyEventParameters}.
438
+ */
439
+ export function logSpendVirtualCurrency(analytics, object = {}) {
440
+ return analytics.logSpendVirtualCurrency(object);
441
+ }
442
+ /**
443
+ * Tutorial Begin event. This event signifies the start of the on-boarding process in your app.
444
+ * Use this in a funnel with {@link analytics#logTutorialComplete} to understand how many users
445
+ * complete this process and move on to the full app experience.
446
+ *
447
+ * Logged event name: `tutorial_begin`
448
+ *
449
+ * @param analytics Analytics instance.
450
+ */
451
+ export function logTutorialBegin(analytics) {
452
+ return analytics.logTutorialBegin();
453
+ }
454
+ /**
455
+ * Tutorial End event. Use this event to signify the user's completion of your app's on-boarding process.
456
+ * Add this to a funnel with {@link analytics#logTutorialBegin} to understand how many users
457
+ * complete this process and move on to the full app experience.
458
+ *
459
+ * Logged event name: `tutorial_complete`
460
+ *
461
+ * @param analytics Analytics instance.
462
+ */
463
+ export function logTutorialComplete(analytics) {
464
+ return analytics.logTutorialComplete();
465
+ }
466
+ /**
467
+ * Unlock Achievement event. Log this event when the user has unlocked an achievement in your game.
468
+ * Since achievements generally represent the breadth of a gaming experience, this event can help
469
+ * you understand how many users are experiencing all that your game has to offer.
470
+ *
471
+ * Logged event name: `unlock_achievement`
472
+ *
473
+ * @param analytics Analytics instance.
474
+ * @param params See {@link analytics.UnlockAchievementEventParameters}.
475
+ */
476
+ export function logUnlockAchievement(analytics, object = {}) {
477
+ return analytics.logUnlockAchievement(object);
478
+ }
479
+ /**
480
+ * E-commerce View Cart event. This event signifies that a user has viewed their cart. Use this to analyze your purchase funnel.
481
+ *
482
+ * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately.
483
+ *
484
+ * Logged event name: `view_cart`
485
+ *
486
+ * @param analytics Analytics instance.
487
+ * @param params See {@link analytics.ViewCartEventParameters}.
488
+ */
489
+ export function logViewCart(analytics, object = {}) {
490
+ return analytics.logViewCart(object);
491
+ }
492
+ /**
493
+ * View Item event. This event signifies that some content was shown to the user. This content
494
+ * may be a product, a screen or just a simple image or text. Use the appropriate parameters
495
+ * to contextualize the event. Use this event to discover the most popular items viewed in your app.
496
+ *
497
+ * If you supply the `value` parameter, you must also supply the `currency` parameter so that revenue metrics can be computed accurately.
498
+ *
499
+ * Logged event name: `view_item`
500
+ *
501
+ * @param analytics Analytics instance.
502
+ * @param params See {@link analytics.ViewItemEventParameters}.
503
+ */
504
+ export function logViewItem(analytics, object = {}) {
505
+ return analytics.logViewItem(object);
506
+ }
507
+ /**
508
+ * View Item List event. Log this event when the user has been presented with a list of items of a certain category.
509
+ *
510
+ * Logged event name: `view_item_list`
511
+ *
512
+ * @param analytics Analytics instance.
513
+ * @param params See {@link analytics.ViewItemListEventParameters}.
514
+ */
515
+ export function logViewItemList(analytics, object = {}) {
516
+ return analytics.logViewItemList(object);
517
+ }
518
+
519
+ export function logViewPromotion(analytics, object = {}) {
520
+ return analytics.logViewPromotion(object);
521
+ }
522
+ /**
523
+ * View Search Results event. Log this event when the user has been presented with the results of a search.
524
+ *
525
+ * Logged event name: `view_search_results`
526
+ *
527
+ * @param analytics Analytics instance.
528
+ * @param params See {@link analytics.ViewSearchResultsParameters}.
529
+ */
530
+ export function logViewSearchResults(analytics, object = {}) {
531
+ return analytics.logViewSearchResults(object);
532
+ }
533
+ /**
534
+ * Adds parameters that will be set on every event logged from the SDK, including automatic ones.
535
+ *
536
+ * @param analytics Analytics instance.
537
+ * @param params Parameters to be added to the map of parameters added to every event.
538
+ * They will be added to the map of default event parameters, replacing any existing
539
+ * parameter with the same name. Valid parameter values are String, long, and double.
540
+ * Setting a key's value to null will clear that parameter. Passing in a null bundle
541
+ * will clear all parameters.
542
+ * For Web, the values passed persist on the current page and are passed with all
543
+ * subsequent events.
544
+ */
545
+ export function setDefaultEventParameters(analytics, params = {}) {
546
+ return analytics.setDefaultEventParameters(params);
547
+ }
548
+ /**
549
+ * start privacy-sensitive on-device conversion management.
550
+ * This is iOS-only.
551
+ * This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile
552
+ *
553
+ * @param analytics Analytics instance.
554
+ * @param emailAddress email address, properly formatted complete with domain name e.g, 'user@example.com'
555
+ */
556
+ export function initiateOnDeviceConversionMeasurementWithEmailAddress(analytics, emailAddress) {
557
+ return analytics.initiateOnDeviceConversionMeasurementWithEmailAddress(emailAddress);
558
+ }
559
+
560
+ /**
561
+ * Checks four different things.
562
+ * 1. Checks if it's not a browser extension environment.
563
+ * 2. Checks if cookies are enabled in current browser.
564
+ * 3. Checks if IndexedDB is supported by the browser environment.
565
+ * 4. Checks if the current browser context is valid for using IndexedDB.open().
566
+ * @returns {Promise<boolean>}
567
+ */
568
+ export function isSupported() {
569
+ // always return "true" for now until Web implementation. Web only.
570
+ return Promise.resolve(true);
571
+ }
572
+ /**
573
+ * Sets the applicable end user consent state for this web app across all gtag
574
+ * references once Firebase Analytics is initialized. Web only.
575
+ * @param analytics Analytics instance.
576
+ * @param consentSettings See {@link analytics.ConsentSettings}.
577
+ * @returns {void}
578
+ */
579
+ // eslint-disable-next-line
580
+ export function setConsent(consentSettings) {
581
+ // Returns nothing until Web implemented.
582
+ }
583
+
584
+ /**
585
+ * Configures Firebase Analytics to use custom gtag or dataLayer names.
586
+ * Intended to be used if gtag.js script has been installed on this page
587
+ * independently of Firebase Analytics, and is using non-default names for
588
+ * either the gtag function or for dataLayer. Must be called before calling
589
+ * `getAnalytics()` or it won't have any effect. Web only.
590
+ * @param options See {@link analytics.SettingsOptions}.
591
+ * @returns {void}
592
+ */
593
+ // eslint-disable-next-line
594
+ export function settings(options) {
595
+ // Returns nothing until Web implemented.
596
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-firebase/analytics",
3
- "version": "17.2.0",
3
+ "version": "17.3.1",
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,10 +22,10 @@
22
22
  "analytics"
23
23
  ],
24
24
  "peerDependencies": {
25
- "@react-native-firebase/app": "17.2.0"
25
+ "@react-native-firebase/app": "17.3.1"
26
26
  },
27
27
  "publishConfig": {
28
28
  "access": "public"
29
29
  },
30
- "gitHead": "57666670bd7fa4121a6598c639c4b2a24b9d181c"
30
+ "gitHead": "8c57bbb3d9c397fc472b78e9853b671ed41e30ca"
31
31
  }