@react-native-firebase/analytics 20.3.0 → 20.5.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +12 -0
- package/__tests__/analytics.test.ts +324 -1
- package/ios/RNFBAnalytics/RNFBAnalyticsModule.m +28 -0
- package/lib/index.d.ts +65 -5
- package/lib/index.js +40 -52
- package/lib/modular/index.d.ts +47 -4
- package/lib/modular/index.js +300 -373
- package/lib/version.js +1 -1
- package/package.json +3 -3
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
|
+
## [20.5.0](https://github.com/invertase/react-native-firebase/compare/v20.4.0...v20.5.0) (2024-09-11)
|
7
|
+
|
8
|
+
### Features
|
9
|
+
|
10
|
+
- **analytics:** initiate on device measurement with sha256-hashed values ([#7963](https://github.com/invertase/react-native-firebase/issues/7963)) ([5ce51e1](https://github.com/invertase/react-native-firebase/commit/5ce51e1b8b225bb509b4a0d444f42fa4c5f3effc))
|
11
|
+
|
12
|
+
## [20.4.0](https://github.com/invertase/react-native-firebase/compare/v20.3.0...v20.4.0) (2024-08-13)
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
- **analytics:** update the typing for Item ([#7919](https://github.com/invertase/react-native-firebase/issues/7919)) ([c2c4576](https://github.com/invertase/react-native-firebase/commit/c2c457608c865f6d25e4b9b6689cbc00721de194))
|
17
|
+
|
6
18
|
## [20.3.0](https://github.com/invertase/react-native-firebase/compare/v20.2.1...v20.3.0) (2024-07-19)
|
7
19
|
|
8
20
|
### Bug Fixes
|
@@ -1,6 +1,62 @@
|
|
1
1
|
import { describe, expect, it, xit } from '@jest/globals';
|
2
2
|
|
3
|
-
import {
|
3
|
+
import {
|
4
|
+
firebase,
|
5
|
+
getAnalytics,
|
6
|
+
initializeAnalytics,
|
7
|
+
logEvent,
|
8
|
+
setAnalyticsCollectionEnabled,
|
9
|
+
setSessionTimeoutDuration,
|
10
|
+
getAppInstanceId,
|
11
|
+
getSessionId,
|
12
|
+
setUserId,
|
13
|
+
setUserProperty,
|
14
|
+
setUserProperties,
|
15
|
+
resetAnalyticsData,
|
16
|
+
logAddPaymentInfo,
|
17
|
+
logScreenView,
|
18
|
+
logAddShippingInfo,
|
19
|
+
logAddToCart,
|
20
|
+
logAddToWishlist,
|
21
|
+
logAppOpen,
|
22
|
+
logBeginCheckout,
|
23
|
+
logCampaignDetails,
|
24
|
+
logEarnVirtualCurrency,
|
25
|
+
logGenerateLead,
|
26
|
+
logJoinGroup,
|
27
|
+
logLevelEnd,
|
28
|
+
logLevelStart,
|
29
|
+
logLevelUp,
|
30
|
+
logLogin,
|
31
|
+
logPostScore,
|
32
|
+
logSelectContent,
|
33
|
+
logPurchase,
|
34
|
+
logRefund,
|
35
|
+
logRemoveFromCart,
|
36
|
+
logSearch,
|
37
|
+
logSelectItem,
|
38
|
+
logSetCheckoutOption,
|
39
|
+
logSelectPromotion,
|
40
|
+
logShare,
|
41
|
+
logSignUp,
|
42
|
+
logSpendVirtualCurrency,
|
43
|
+
logTutorialBegin,
|
44
|
+
logTutorialComplete,
|
45
|
+
logUnlockAchievement,
|
46
|
+
logViewCart,
|
47
|
+
logViewItem,
|
48
|
+
logViewItemList,
|
49
|
+
logViewPromotion,
|
50
|
+
logViewSearchResults,
|
51
|
+
setDefaultEventParameters,
|
52
|
+
initiateOnDeviceConversionMeasurementWithEmailAddress,
|
53
|
+
initiateOnDeviceConversionMeasurementWithHashedEmailAddress,
|
54
|
+
initiateOnDeviceConversionMeasurementWithPhoneNumber,
|
55
|
+
initiateOnDeviceConversionMeasurementWithHashedPhoneNumber,
|
56
|
+
isSupported,
|
57
|
+
setConsent,
|
58
|
+
settings,
|
59
|
+
} from '../lib';
|
4
60
|
|
5
61
|
describe('Analytics', function () {
|
6
62
|
describe('namespace', function () {
|
@@ -595,4 +651,271 @@ describe('Analytics', function () {
|
|
595
651
|
);
|
596
652
|
});
|
597
653
|
});
|
654
|
+
|
655
|
+
describe('initiateOnDeviceConversionMeasurementWithHashedEmailAddress()', function () {
|
656
|
+
it('throws if not a string', function () {
|
657
|
+
expect(() =>
|
658
|
+
// @ts-ignore
|
659
|
+
firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedEmailAddress(true),
|
660
|
+
).toThrowError(
|
661
|
+
"firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedEmailAddress(*) 'hashedEmailAddress' expected a string value.",
|
662
|
+
);
|
663
|
+
});
|
664
|
+
});
|
665
|
+
|
666
|
+
describe('initiateOnDeviceConversionMeasurementWithHashedPhoneNumber()', function () {
|
667
|
+
it('throws if not a string', function () {
|
668
|
+
expect(() =>
|
669
|
+
// @ts-ignore
|
670
|
+
firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(1234),
|
671
|
+
).toThrowError(
|
672
|
+
"firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(*) 'hashedPhoneNumber' expected a string value.",
|
673
|
+
);
|
674
|
+
});
|
675
|
+
|
676
|
+
it('throws if hashed value is a phone number in E.164 format', function () {
|
677
|
+
expect(() =>
|
678
|
+
firebase
|
679
|
+
.analytics()
|
680
|
+
.initiateOnDeviceConversionMeasurementWithHashedPhoneNumber('+1234567890'),
|
681
|
+
).toThrowError(
|
682
|
+
"firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(*) 'hashedPhoneNumber' expected a sha256-hashed value of a phone number in E.164 format.",
|
683
|
+
);
|
684
|
+
});
|
685
|
+
});
|
686
|
+
|
687
|
+
describe('modular', function () {
|
688
|
+
it('`getAnalytics` function is properly exposed to end user', function () {
|
689
|
+
expect(getAnalytics).toBeDefined();
|
690
|
+
});
|
691
|
+
|
692
|
+
it('`initializeAnalytics` function is properly exposed to end user', function () {
|
693
|
+
expect(initializeAnalytics).toBeDefined();
|
694
|
+
});
|
695
|
+
|
696
|
+
it('`logEvent` function is properly exposed to end user', function () {
|
697
|
+
expect(logEvent).toBeDefined();
|
698
|
+
});
|
699
|
+
|
700
|
+
it('`setAnalyticsCollectionEnabled` function is properly exposed to end user', function () {
|
701
|
+
expect(setAnalyticsCollectionEnabled).toBeDefined();
|
702
|
+
});
|
703
|
+
|
704
|
+
it('`setSessionTimeoutDuration` function is properly exposed to end user', function () {
|
705
|
+
expect(setSessionTimeoutDuration).toBeDefined();
|
706
|
+
});
|
707
|
+
|
708
|
+
it('`getAppInstanceId` function is properly exposed to end user', function () {
|
709
|
+
expect(getAppInstanceId).toBeDefined();
|
710
|
+
});
|
711
|
+
|
712
|
+
it('`getSessionId` function is properly exposed to end user', function () {
|
713
|
+
expect(getSessionId).toBeDefined();
|
714
|
+
});
|
715
|
+
|
716
|
+
it('`setUserId` function is properly exposed to end user', function () {
|
717
|
+
expect(setUserId).toBeDefined();
|
718
|
+
});
|
719
|
+
|
720
|
+
it('`setUserProperty` function is properly exposed to end user', function () {
|
721
|
+
expect(setUserProperty).toBeDefined();
|
722
|
+
});
|
723
|
+
|
724
|
+
it('`setUserProperties` function is properly exposed to end user', function () {
|
725
|
+
expect(setUserProperties).toBeDefined();
|
726
|
+
});
|
727
|
+
|
728
|
+
it('`resetAnalyticsData` function is properly exposed to end user', function () {
|
729
|
+
expect(resetAnalyticsData).toBeDefined();
|
730
|
+
});
|
731
|
+
|
732
|
+
it('`logAddPaymentInfo` function is properly exposed to end user', function () {
|
733
|
+
expect(logAddPaymentInfo).toBeDefined();
|
734
|
+
});
|
735
|
+
|
736
|
+
it('`logScreenView` function is properly exposed to end user', function () {
|
737
|
+
expect(logScreenView).toBeDefined();
|
738
|
+
});
|
739
|
+
|
740
|
+
it('`logAddShippingInfo` function is properly exposed to end user', function () {
|
741
|
+
expect(logAddShippingInfo).toBeDefined();
|
742
|
+
});
|
743
|
+
|
744
|
+
it('`logAddToCart` function is properly exposed to end user', function () {
|
745
|
+
expect(logAddToCart).toBeDefined();
|
746
|
+
});
|
747
|
+
|
748
|
+
it('`logAddToWishlist` function is properly exposed to end user', function () {
|
749
|
+
expect(logAddToWishlist).toBeDefined();
|
750
|
+
});
|
751
|
+
|
752
|
+
it('`logAppOpen` function is properly exposed to end user', function () {
|
753
|
+
expect(logAppOpen).toBeDefined();
|
754
|
+
});
|
755
|
+
|
756
|
+
it('`logBeginCheckout` function is properly exposed to end user', function () {
|
757
|
+
expect(logBeginCheckout).toBeDefined();
|
758
|
+
});
|
759
|
+
|
760
|
+
it('`logCampaignDetails` function is properly exposed to end user', function () {
|
761
|
+
expect(logCampaignDetails).toBeDefined();
|
762
|
+
});
|
763
|
+
|
764
|
+
it('`logEarnVirtualCurrency` function is properly exposed to end user', function () {
|
765
|
+
expect(logEarnVirtualCurrency).toBeDefined();
|
766
|
+
});
|
767
|
+
|
768
|
+
it('`logGenerateLead` function is properly exposed to end user', function () {
|
769
|
+
expect(logGenerateLead).toBeDefined();
|
770
|
+
});
|
771
|
+
|
772
|
+
it('`logJoinGroup` function is properly exposed to end user', function () {
|
773
|
+
expect(logJoinGroup).toBeDefined();
|
774
|
+
});
|
775
|
+
|
776
|
+
it('`logLevelEnd` function is properly exposed to end user', function () {
|
777
|
+
expect(logLevelEnd).toBeDefined();
|
778
|
+
});
|
779
|
+
|
780
|
+
it('`logLevelStart` function is properly exposed to end user', function () {
|
781
|
+
expect(logLevelStart).toBeDefined();
|
782
|
+
});
|
783
|
+
|
784
|
+
it('`logLevelUp` function is properly exposed to end user', function () {
|
785
|
+
expect(logLevelUp).toBeDefined();
|
786
|
+
});
|
787
|
+
|
788
|
+
it('`logLogin` function is properly exposed to end user', function () {
|
789
|
+
expect(logLogin).toBeDefined();
|
790
|
+
});
|
791
|
+
|
792
|
+
it('`logPostScore` function is properly exposed to end user', function () {
|
793
|
+
expect(logPostScore).toBeDefined();
|
794
|
+
});
|
795
|
+
|
796
|
+
it('`logSelectContent` function is properly exposed to end user', function () {
|
797
|
+
expect(logSelectContent).toBeDefined();
|
798
|
+
});
|
799
|
+
|
800
|
+
it('`logPurchase` function is properly exposed to end user', function () {
|
801
|
+
expect(logPurchase).toBeDefined();
|
802
|
+
});
|
803
|
+
|
804
|
+
it('`logRefund` function is properly exposed to end user', function () {
|
805
|
+
expect(logRefund).toBeDefined();
|
806
|
+
});
|
807
|
+
|
808
|
+
it('`logRemoveFromCart` function is properly exposed to end user', function () {
|
809
|
+
expect(logRemoveFromCart).toBeDefined();
|
810
|
+
});
|
811
|
+
|
812
|
+
it('`logSearch` function is properly exposed to end user', function () {
|
813
|
+
expect(logSearch).toBeDefined();
|
814
|
+
});
|
815
|
+
|
816
|
+
it('`logSelectItem` function is properly exposed to end user', function () {
|
817
|
+
expect(logSelectItem).toBeDefined();
|
818
|
+
});
|
819
|
+
|
820
|
+
it('`logSetCheckoutOption` function is properly exposed to end user', function () {
|
821
|
+
expect(logSetCheckoutOption).toBeDefined();
|
822
|
+
});
|
823
|
+
|
824
|
+
it('`logSelectPromotion` function is properly exposed to end user', function () {
|
825
|
+
expect(logSelectPromotion).toBeDefined();
|
826
|
+
});
|
827
|
+
|
828
|
+
it('`logShare` function is properly exposed to end user', function () {
|
829
|
+
expect(logShare).toBeDefined();
|
830
|
+
});
|
831
|
+
|
832
|
+
it('`logSignUp` function is properly exposed to end user', function () {
|
833
|
+
expect(logSignUp).toBeDefined();
|
834
|
+
});
|
835
|
+
|
836
|
+
it('`logSpendVirtualCurrency` function is properly exposed to end user', function () {
|
837
|
+
expect(logSpendVirtualCurrency).toBeDefined();
|
838
|
+
});
|
839
|
+
|
840
|
+
it('`logTutorialBegin` function is properly exposed to end user', function () {
|
841
|
+
expect(logTutorialBegin).toBeDefined();
|
842
|
+
});
|
843
|
+
|
844
|
+
it('`logTutorialComplete` function is properly exposed to end user', function () {
|
845
|
+
expect(logTutorialComplete).toBeDefined();
|
846
|
+
});
|
847
|
+
|
848
|
+
it('`logUnlockAchievement` function is properly exposed to end user', function () {
|
849
|
+
expect(logUnlockAchievement).toBeDefined();
|
850
|
+
});
|
851
|
+
|
852
|
+
it('`logViewCart` function is properly exposed to end user', function () {
|
853
|
+
expect(logViewCart).toBeDefined();
|
854
|
+
});
|
855
|
+
|
856
|
+
it('`logViewItem` function is properly exposed to end user', function () {
|
857
|
+
expect(logViewItem).toBeDefined();
|
858
|
+
});
|
859
|
+
|
860
|
+
it('`logViewItemList` function is properly exposed to end user', function () {
|
861
|
+
expect(logViewItemList).toBeDefined();
|
862
|
+
});
|
863
|
+
|
864
|
+
it('`logViewPromotion` function is properly exposed to end user', function () {
|
865
|
+
expect(logViewPromotion).toBeDefined();
|
866
|
+
});
|
867
|
+
|
868
|
+
it('`logViewSearchResults` function is properly exposed to end user', function () {
|
869
|
+
expect(logViewSearchResults).toBeDefined();
|
870
|
+
});
|
871
|
+
|
872
|
+
it('`setDefaultEventParameters` function is properly exposed to end user', function () {
|
873
|
+
expect(setDefaultEventParameters).toBeDefined();
|
874
|
+
});
|
875
|
+
|
876
|
+
it('`initiateOnDeviceConversionMeasurementWithEmailAddress` function is properly exposed to end user', function () {
|
877
|
+
expect(initiateOnDeviceConversionMeasurementWithEmailAddress).toBeDefined();
|
878
|
+
});
|
879
|
+
|
880
|
+
it('`initiateOnDeviceConversionMeasurementWithHashedEmailAddress` function is properly exposed to end user', function () {
|
881
|
+
expect(initiateOnDeviceConversionMeasurementWithHashedEmailAddress).toBeDefined();
|
882
|
+
});
|
883
|
+
|
884
|
+
it('`initiateOnDeviceConversionMeasurementWithHashedEmailAddress` throws if not a string', function () {
|
885
|
+
expect(() =>
|
886
|
+
// @ts-ignore
|
887
|
+
initiateOnDeviceConversionMeasurementWithHashedEmailAddress(getAnalytics(), true),
|
888
|
+
).toThrowError(
|
889
|
+
"firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedEmailAddress(*) 'hashedEmailAddress' expected a string value.",
|
890
|
+
);
|
891
|
+
});
|
892
|
+
|
893
|
+
it('`initiateOnDeviceConversionMeasurementWithHashedPhoneNumber` should throw if the value is in E.164 format', function () {
|
894
|
+
expect(() =>
|
895
|
+
initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(getAnalytics(), '+1234567890'),
|
896
|
+
).toThrowError(
|
897
|
+
"firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(*) 'hashedPhoneNumber' expected a sha256-hashed value of a phone number in E.164 format.",
|
898
|
+
);
|
899
|
+
});
|
900
|
+
|
901
|
+
it('`initiateOnDeviceConversionMeasurementWithPhoneNumber` function is properly exposed to end user', function () {
|
902
|
+
expect(initiateOnDeviceConversionMeasurementWithPhoneNumber).toBeDefined();
|
903
|
+
});
|
904
|
+
|
905
|
+
it('`initiateOnDeviceConversionMeasurementWithHashedPhoneNumber` function is properly exposed to end user', function () {
|
906
|
+
expect(initiateOnDeviceConversionMeasurementWithHashedPhoneNumber).toBeDefined();
|
907
|
+
});
|
908
|
+
|
909
|
+
it('`isSupported` function is properly exposed to end user', function () {
|
910
|
+
expect(isSupported).toBeDefined();
|
911
|
+
});
|
912
|
+
|
913
|
+
it('`setConsent` function is properly exposed to end user', function () {
|
914
|
+
expect(setConsent).toBeDefined();
|
915
|
+
});
|
916
|
+
|
917
|
+
it('`settings` function is properly exposed to end user', function () {
|
918
|
+
expect(settings).toBeDefined();
|
919
|
+
});
|
920
|
+
});
|
598
921
|
});
|
@@ -164,6 +164,20 @@ RCT_EXPORT_METHOD(initiateOnDeviceConversionMeasurementWithEmailAddress
|
|
164
164
|
return resolve([NSNull null]);
|
165
165
|
}
|
166
166
|
|
167
|
+
RCT_EXPORT_METHOD(initiateOnDeviceConversionMeasurementWithHashedEmailAddress
|
168
|
+
: (NSString *)hashedEmailAddress resolver
|
169
|
+
: (RCTPromiseResolveBlock)resolve rejecter
|
170
|
+
: (RCTPromiseRejectBlock)reject) {
|
171
|
+
@try {
|
172
|
+
NSData *emailAddress = [hashedEmailAddress dataUsingEncoding:NSUTF8StringEncoding];
|
173
|
+
[FIRAnalytics initiateOnDeviceConversionMeasurementWithHashedEmailAddress:emailAddress];
|
174
|
+
} @catch (NSException *exception) {
|
175
|
+
return [RNFBSharedUtils rejectPromiseWithExceptionDict:reject exception:exception];
|
176
|
+
}
|
177
|
+
|
178
|
+
return resolve([NSNull null]);
|
179
|
+
}
|
180
|
+
|
167
181
|
RCT_EXPORT_METHOD(initiateOnDeviceConversionMeasurementWithPhoneNumber
|
168
182
|
: (NSString *)phoneNumber resolver
|
169
183
|
: (RCTPromiseResolveBlock)resolve rejecter
|
@@ -177,6 +191,20 @@ RCT_EXPORT_METHOD(initiateOnDeviceConversionMeasurementWithPhoneNumber
|
|
177
191
|
return resolve([NSNull null]);
|
178
192
|
}
|
179
193
|
|
194
|
+
RCT_EXPORT_METHOD(initiateOnDeviceConversionMeasurementWithHashedPhoneNumber
|
195
|
+
: (NSString *)hashedPhoneNumber resolver
|
196
|
+
: (RCTPromiseResolveBlock)resolve rejecter
|
197
|
+
: (RCTPromiseRejectBlock)reject) {
|
198
|
+
@try {
|
199
|
+
NSData *phoneNumber = [hashedPhoneNumber dataUsingEncoding:NSUTF8StringEncoding];
|
200
|
+
[FIRAnalytics initiateOnDeviceConversionMeasurementWithHashedPhoneNumber:phoneNumber];
|
201
|
+
} @catch (NSException *exception) {
|
202
|
+
return [RNFBSharedUtils rejectPromiseWithExceptionDict:reject exception:exception];
|
203
|
+
}
|
204
|
+
|
205
|
+
return resolve([NSNull null]);
|
206
|
+
}
|
207
|
+
|
180
208
|
RCT_EXPORT_METHOD(setConsent
|
181
209
|
: (NSDictionary *)consentSettings resolver
|
182
210
|
: (RCTPromiseResolveBlock)resolve rejecter
|
package/lib/index.d.ts
CHANGED
@@ -94,7 +94,7 @@ export namespace FirebaseAnalyticsTypes {
|
|
94
94
|
/**
|
95
95
|
* The Google [Place ID](https://developers.google.com/places/place-id) that corresponds to the associated item (String). Alternatively, you can supply your own custom Location ID.
|
96
96
|
*/
|
97
|
-
|
97
|
+
location_id?: string;
|
98
98
|
/**
|
99
99
|
* The Item variant.
|
100
100
|
*/
|
@@ -109,6 +109,38 @@ export namespace FirebaseAnalyticsTypes {
|
|
109
109
|
* See https://github.com/invertase/react-native-firebase/issues/4578#issuecomment-771703420 for more information
|
110
110
|
*/
|
111
111
|
price?: number;
|
112
|
+
/**
|
113
|
+
* The affiliation of the item.
|
114
|
+
*/
|
115
|
+
affiliation?: string;
|
116
|
+
/**
|
117
|
+
* The coupon associated with the item.
|
118
|
+
*/
|
119
|
+
coupon?: string;
|
120
|
+
/**
|
121
|
+
* The creative name associated with the item.
|
122
|
+
*/
|
123
|
+
creative_name?: string;
|
124
|
+
/**
|
125
|
+
* The creative slot associated with the item.
|
126
|
+
*/
|
127
|
+
creative_slot?: string;
|
128
|
+
/**
|
129
|
+
* The discount applied to the item.
|
130
|
+
*/
|
131
|
+
discount?: Currency;
|
132
|
+
/**
|
133
|
+
* The index of the item.
|
134
|
+
*/
|
135
|
+
index?: number;
|
136
|
+
/**
|
137
|
+
* The promotion ID associated with the item.
|
138
|
+
*/
|
139
|
+
promotion_id?: string;
|
140
|
+
/**
|
141
|
+
* The promotion name associated with the item.
|
142
|
+
*/
|
143
|
+
promotion_name?: string;
|
112
144
|
}
|
113
145
|
|
114
146
|
export interface AddPaymentInfoEventParameters {
|
@@ -1723,23 +1755,51 @@ export namespace FirebaseAnalyticsTypes {
|
|
1723
1755
|
setDefaultEventParameters(params?: { [key: string]: any }): Promise<void>;
|
1724
1756
|
|
1725
1757
|
/**
|
1726
|
-
*
|
1758
|
+
* Start privacy-sensitive on-device conversion management.
|
1727
1759
|
* This is iOS-only.
|
1728
|
-
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile
|
1760
|
+
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile.
|
1729
1761
|
*
|
1762
|
+
* @platform ios
|
1730
1763
|
* @param emailAddress email address, properly formatted complete with domain name e.g, 'user@example.com'
|
1731
1764
|
*/
|
1732
1765
|
initiateOnDeviceConversionMeasurementWithEmailAddress(emailAddress: string): Promise<void>;
|
1733
1766
|
|
1734
1767
|
/**
|
1735
|
-
*
|
1768
|
+
* Start privacy-sensitive on-device conversion management.
|
1736
1769
|
* This is iOS-only.
|
1737
|
-
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile
|
1770
|
+
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile.
|
1771
|
+
* You need to pass the sha256-hashed of normalized email address to this function. See [this link](https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials) for more information.
|
1738
1772
|
*
|
1773
|
+
* @platform ios
|
1774
|
+
* @param hashedEmailAddress sha256-hashed of normalized email address, properly formatted complete with domain name e.g, 'user@example.com'
|
1775
|
+
*/
|
1776
|
+
initiateOnDeviceConversionMeasurementWithHashedEmailAddress(
|
1777
|
+
hashedEmailAddress: string,
|
1778
|
+
): Poromise<void>;
|
1779
|
+
|
1780
|
+
/**
|
1781
|
+
* Start privacy-sensitive on-device conversion management.
|
1782
|
+
* This is iOS-only.
|
1783
|
+
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile.
|
1784
|
+
*
|
1785
|
+
* @platform ios
|
1739
1786
|
* @param phoneNumber phone number in E.164 format - that is a leading + sign, then up to 15 digits, no dashes or spaces.
|
1740
1787
|
*/
|
1741
1788
|
initiateOnDeviceConversionMeasurementWithPhoneNumber(phoneNumber: string): Promise<void>;
|
1742
1789
|
|
1790
|
+
/**
|
1791
|
+
* Start privacy-sensitive on-device conversion management.
|
1792
|
+
* This is iOS-only.
|
1793
|
+
* This is a no-op if you do not include '$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile.
|
1794
|
+
* You need to pass the sha256-hashed of phone number in E.164 format. See [this link](https://firebase.google.com/docs/tutorials/ads-ios-on-device-measurement/step-3#use-hashed-credentials) for more information.
|
1795
|
+
*
|
1796
|
+
* @platform ios
|
1797
|
+
* @param hashedPhoneNumber sha256-hashed of normalized phone number in E.164 format - that is a leading + sign, then up to 15 digits, no dashes or spaces.
|
1798
|
+
*/
|
1799
|
+
initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(
|
1800
|
+
hashedPhoneNumber: string,
|
1801
|
+
): Promise<void>;
|
1802
|
+
|
1743
1803
|
/**
|
1744
1804
|
* For Consent Mode!
|
1745
1805
|
*
|
package/lib/index.js
CHANGED
@@ -40,58 +40,6 @@ import fallBackModule from './web/RNFBAnalyticsModule';
|
|
40
40
|
import version from './version';
|
41
41
|
import * as structs from './structs';
|
42
42
|
|
43
|
-
export {
|
44
|
-
getAnalytics,
|
45
|
-
logEvent,
|
46
|
-
setAnalyticsCollectionEnabled,
|
47
|
-
setSessionTimeoutDuration,
|
48
|
-
getAppInstanceId,
|
49
|
-
getSessionId,
|
50
|
-
setUserId,
|
51
|
-
setUserProperty,
|
52
|
-
setUserProperties,
|
53
|
-
resetAnalyticsData,
|
54
|
-
logAddPaymentInfo,
|
55
|
-
logScreenView,
|
56
|
-
logAddShippingInfo,
|
57
|
-
logAddToCart,
|
58
|
-
logAddToWishlist,
|
59
|
-
logAppOpen,
|
60
|
-
logBeginCheckout,
|
61
|
-
logCampaignDetails,
|
62
|
-
logEarnVirtualCurrency,
|
63
|
-
logGenerateLead,
|
64
|
-
logJoinGroup,
|
65
|
-
logLevelEnd,
|
66
|
-
logLevelStart,
|
67
|
-
logLevelUp,
|
68
|
-
logLogin,
|
69
|
-
logPostScore,
|
70
|
-
logSelectContent,
|
71
|
-
logPurchase,
|
72
|
-
logRefund,
|
73
|
-
logRemoveFromCart,
|
74
|
-
logSearch,
|
75
|
-
logSelectItem,
|
76
|
-
logSetCheckoutOption,
|
77
|
-
logSelectPromotion,
|
78
|
-
logShare,
|
79
|
-
logSignUp,
|
80
|
-
logSpendVirtualCurrency,
|
81
|
-
logTutorialBegin,
|
82
|
-
logTutorialComplete,
|
83
|
-
logUnlockAchievement,
|
84
|
-
logViewCart,
|
85
|
-
logViewItem,
|
86
|
-
logViewItemList,
|
87
|
-
logViewPromotion,
|
88
|
-
logViewSearchResults,
|
89
|
-
setDefaultEventParameters,
|
90
|
-
initiateOnDeviceConversionMeasurementWithEmailAddress,
|
91
|
-
initiateOnDeviceConversionMeasurementWithPhoneNumber,
|
92
|
-
setConsent,
|
93
|
-
} from './modular/index';
|
94
|
-
|
95
43
|
const ReservedEventNames = [
|
96
44
|
'ad_activeview',
|
97
45
|
'ad_click',
|
@@ -795,6 +743,22 @@ class FirebaseAnalyticsModule extends FirebaseModule {
|
|
795
743
|
return this.native.initiateOnDeviceConversionMeasurementWithEmailAddress(emailAddress);
|
796
744
|
}
|
797
745
|
|
746
|
+
initiateOnDeviceConversionMeasurementWithHashedEmailAddress(hashedEmailAddress) {
|
747
|
+
if (!isString(hashedEmailAddress)) {
|
748
|
+
throw new Error(
|
749
|
+
"firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedEmailAddress(*) 'hashedEmailAddress' expected a string value.",
|
750
|
+
);
|
751
|
+
}
|
752
|
+
|
753
|
+
if (!isIOS) {
|
754
|
+
return;
|
755
|
+
}
|
756
|
+
|
757
|
+
return this.native.initiateOnDeviceConversionMeasurementWithHashedEmailAddress(
|
758
|
+
hashedEmailAddress,
|
759
|
+
);
|
760
|
+
}
|
761
|
+
|
798
762
|
initiateOnDeviceConversionMeasurementWithPhoneNumber(phoneNumber) {
|
799
763
|
if (!isE164PhoneNumber(phoneNumber)) {
|
800
764
|
throw new Error(
|
@@ -808,6 +772,28 @@ class FirebaseAnalyticsModule extends FirebaseModule {
|
|
808
772
|
|
809
773
|
return this.native.initiateOnDeviceConversionMeasurementWithPhoneNumber(phoneNumber);
|
810
774
|
}
|
775
|
+
|
776
|
+
initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(hashedPhoneNumber) {
|
777
|
+
if (isE164PhoneNumber(hashedPhoneNumber)) {
|
778
|
+
throw new Error(
|
779
|
+
"firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(*) 'hashedPhoneNumber' expected a sha256-hashed value of a phone number in E.164 format.",
|
780
|
+
);
|
781
|
+
}
|
782
|
+
|
783
|
+
if (!isString(hashedPhoneNumber)) {
|
784
|
+
throw new Error(
|
785
|
+
"firebase.analytics().initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(*) 'hashedPhoneNumber' expected a string value.",
|
786
|
+
);
|
787
|
+
}
|
788
|
+
|
789
|
+
if (!isIOS) {
|
790
|
+
return;
|
791
|
+
}
|
792
|
+
|
793
|
+
return this.native.initiateOnDeviceConversionMeasurementWithHashedPhoneNumber(
|
794
|
+
hashedPhoneNumber,
|
795
|
+
);
|
796
|
+
}
|
811
797
|
}
|
812
798
|
|
813
799
|
// import { SDK_VERSION } from '@react-native-firebase/analytics';
|
@@ -826,6 +812,8 @@ export default createModuleNamespace({
|
|
826
812
|
ModuleClass: FirebaseAnalyticsModule,
|
827
813
|
});
|
828
814
|
|
815
|
+
export * from './modular/index';
|
816
|
+
|
829
817
|
// import analytics, { firebase } from '@react-native-firebase/analytics';
|
830
818
|
// analytics().logEvent(...);
|
831
819
|
// firebase.analytics().logEvent(...);
|