File tree Expand file tree Collapse file tree 8 files changed +73
-0
lines changed Expand file tree Collapse file tree 8 files changed +73
-0
lines changed Original file line number Diff line number Diff line change 75
75
"jest" : " ^28.1.1" ,
76
76
"lerna" : " 5.1.4" ,
77
77
"prettier" : " ^2.7.1" ,
78
+ "regenerator-transform" : " ^0.15.0" ,
78
79
"rimraf" : " ^3.0.2" ,
79
80
"shelljs" : " ^0.8.5" ,
80
81
"ts-jest" : " ^28.0.5" ,
Original file line number Diff line number Diff line change @@ -49,6 +49,18 @@ Pod::Spec.new do |s|
49
49
s . dependency 'Firebase/Analytics' , firebase_sdk_version
50
50
end
51
51
52
+ # Special pod for on-device conversion
53
+ if defined? ( $RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion) && ( $RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion == true )
54
+ Pod ::UI . puts "#{ s . name } : GoogleAppMeasurementOnDeviceConversion pod added"
55
+
56
+ # Releasing as non-breaking change as it is optional but it raises minimum requirements, validate just in case
57
+ if ( Gem ::Version . new ( firebase_sdk_version ) < Gem ::Version . new ( "9.0.0" ) )
58
+ raise "GoogleAppMeasurementOnDeviceConversion requires firebase-ios-sdk 9.0.0 or greater."
59
+ end
60
+
61
+ s . dependency 'GoogleAppMeasurementOnDeviceConversion' , firebase_sdk_version
62
+ end
63
+
52
64
if defined? ( $RNFirebaseAsStaticFramework)
53
65
Pod ::UI . puts "#{ s . name } : Using overridden static_framework value of '#{ $RNFirebaseAsStaticFramework} '"
54
66
s . static_framework = $RNFirebaseAsStaticFramework
Original file line number Diff line number Diff line change @@ -521,4 +521,15 @@ describe('Analytics', function () {
521
521
) ;
522
522
} ) ;
523
523
} ) ;
524
+
525
+ describe ( 'initiateOnDeviceConversionMeasurementWithEmailAddress()' , function ( ) {
526
+ it ( 'throws if not a string' , function ( ) {
527
+ expect ( ( ) =>
528
+ // @ts -ignore
529
+ firebase . analytics ( ) . initiateOnDeviceConversionMeasurementWithEmailAddress ( true ) ,
530
+ ) . toThrowError (
531
+ "firebase.analytics().initiateOnDeviceConversionMeasurementWithEmailAddress(*) 'emailAddress' expected a string value." ,
532
+ ) ;
533
+ } ) ;
534
+ } ) ;
524
535
} ) ;
Original file line number Diff line number Diff line change @@ -425,6 +425,15 @@ describe('analytics()', function () {
425
425
} ) ;
426
426
} ) ;
427
427
428
+ // Test this last so it does not stop delivery to DebugView
429
+ describe ( 'initiateOnDeviceConversionMeasurementWithEmailAddress()' , function ( ) {
430
+ it ( 'calls native API successfully' , async function ( ) {
431
+ await firebase
432
+ . analytics ( )
433
+ . initiateOnDeviceConversionMeasurementWithEmailAddress ( 'conversionTest@example.com' ) ;
434
+ } ) ;
435
+ } ) ;
436
+
428
437
// Test this last so it does not stop delivery to DebugView
429
438
describe ( 'setAnalyticsCollectionEnabled()' , function ( ) {
430
439
it ( 'false' , async function ( ) {
Original file line number Diff line number Diff line change @@ -138,6 +138,19 @@ - (dispatch_queue_t)methodQueue {
138
138
return resolve ([NSNull null ]);
139
139
}
140
140
141
+ RCT_EXPORT_METHOD (initiateOnDeviceConversionMeasurementWithEmailAddress
142
+ : (NSString *)emailAddress resolver
143
+ : (RCTPromiseResolveBlock)resolve rejecter
144
+ : (RCTPromiseRejectBlock)reject) {
145
+ @try {
146
+ [FIRAnalytics initiateOnDeviceConversionMeasurementWithEmailAddress: emailAddress];
147
+ } @catch (NSException *exception) {
148
+ return [RNFBSharedUtils rejectPromiseWithExceptionDict: reject exception: exception];
149
+ }
150
+
151
+ return resolve ([NSNull null ]);
152
+ }
153
+
141
154
#pragma mark -
142
155
#pragma mark Private methods
143
156
Original file line number Diff line number Diff line change @@ -1502,6 +1502,15 @@ export namespace FirebaseAnalyticsTypes {
1502
1502
* will clear all parameters.
1503
1503
*/
1504
1504
setDefaultEventParameters ( params ?: { [ key : string ] : any } ) : Promise < void > ;
1505
+
1506
+ /**
1507
+ * start privacy-sensitive on-device conversion management.
1508
+ * This is iOS-only.
1509
+ * This is a no-op if you do not include '#RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true' in your Podfile
1510
+ *
1511
+ * @param emailAddress email address, properly formatted complete with domain name e.g, 'user@example.com'
1512
+ */
1513
+ initiateOnDeviceConversionMeasurementWithEmailAddress ( emailAddress : string ) : Promise < void > ;
1505
1514
}
1506
1515
}
1507
1516
Original file line number Diff line number Diff line change 17
17
18
18
import {
19
19
isAlphaNumericUnderscore ,
20
+ isIOS ,
20
21
isNull ,
21
22
isNumber ,
22
23
isObject ,
@@ -676,6 +677,20 @@ class FirebaseAnalyticsModule extends FirebaseModule {
676
677
677
678
return this . native . setDefaultEventParameters ( params ) ;
678
679
}
680
+
681
+ initiateOnDeviceConversionMeasurementWithEmailAddress ( emailAddress ) {
682
+ if ( ! isString ( emailAddress ) ) {
683
+ throw new Error (
684
+ "firebase.analytics().initiateOnDeviceConversionMeasurementWithEmailAddress(*) 'emailAddress' expected a string value." ,
685
+ ) ;
686
+ }
687
+
688
+ if ( ! isIOS ) {
689
+ return ;
690
+ }
691
+
692
+ return this . native . initiateOnDeviceConversionMeasurementWithEmailAddress ( emailAddress ) ;
693
+ }
679
694
}
680
695
681
696
// import { SDK_VERSION } from '@react-native-firebase/analytics';
Original file line number Diff line number Diff line change @@ -11,6 +11,9 @@ $RNFirebaseAsStaticFramework = true # toggle this to true (and set 'use_framewor
11
11
# See: https://firebase.google.com/support/release-notes/ios#analytics - requires firebase-ios-sdk 7.11.0+
12
12
#$RNFirebaseAnalyticsWithoutAdIdSupport = true # toggle this to true for the no-ad-tracking Analytics subspec
13
13
14
+ # Toggle this to true if you want to include support for on device conversion measurement APIs
15
+ $RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true
16
+
14
17
# Versions used below, for quick reference / outdated+upgrade checks
15
18
$iOSMinimumDeployVersion = '11.0'
16
19
You can’t perform that action at this time.
0 commit comments