Skip to content

Commit e4db9bb

Browse files
committed
feat(analytics, ios): add Podfile toggle to optionally link AdSupport
See https://firebase.google.com/support/guides/analytics-adsupport
1 parent 44a2efe commit e4db9bb

File tree

5 files changed

+59
-53
lines changed

5 files changed

+59
-53
lines changed

docs/analytics/usage/index.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,18 @@ of your app handle data in a way that requires ATT)
157157

158158
Note that for obvious reasons, configuring Firebase Analytics for use without IDFA is incompatible with AdMob
159159

160+
# Device Identification
161+
162+
If you would like to enable Firebase Analytics to generate automatic audience metrics for iOS (as it does by default in Android), you must link additional iOS libraries, [as documented by the Google Firebase team](https://support.google.com/firebase/answer/6318039). Specifically you need to link in `AdSupport.framework`.
163+
164+
The way to do this using CocoaPods is to add this variable to your `Podfile` so `@react-native-firebase/analytics` will link it in for you:
165+
166+
```ruby
167+
$RNFirebaseAnalyticsEnableAdSupport = true
168+
```
169+
170+
Note: this is setting will have no effect if you disabled Ad IDs as described above, since this setting is specifically linking in the `AdSupport` framework which requires the Ad IDs.
171+
160172
# firebase.json
161173

162174
## Disable Auto-Initialization

docs/analytics/usage/installation/ios.md

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,12 @@ end
2525
You may need to update your local Pods in order for the `RNFBAnalytics` Pod to be installed in your project:
2626

2727
```bash
28-
$ cd ios/
29-
$ pod install --repo-update
28+
cd ios/
29+
pod install --repo-update
3030
```
3131

3232
Once the Pods have installed locally, rebuild your iOS project:
3333

3434
```bash
3535
npx react-native run-ios
3636
```
37-
38-
# Device Identification
39-
40-
If you would like to enable Firebase Analytics to generate automatic audience metrics for iOS (as it does by default in Android), you must link additional iOS libraries, [as documented by the Google Firebase team](https://support.google.com/firebase/answer/6318039). Specifically you need `libAdIdAccess.a` and `AdSupport.framework`.
41-
42-
The way to do this using CocoaPods is to add this to your `Podfile` (though please use [the most current Pod version](https://cocoapods.org/pods/GoogleIDFASupport) supported by React Native Firebase):
43-
44-
```ruby
45-
# ...
46-
target 'app' do
47-
# ...
48-
pod 'RNFBAnalytics', :path => '../node_modules/@react-native-firebase/analytics'
49-
pod 'GoogleIDFASupport', '~> 3.14.0'
50-
end
51-
```

packages/analytics/RNFBAnalytics.podspec

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,12 @@ Pod::Spec.new do |s|
5252
Pod::UI.puts "#{s.name}: You may set variable `$RNFirebaseAnalyticsWithoutAdIdSupport=true` in Podfile to use analytics without ad ids."
5353
end
5454
s.dependency 'Firebase/Analytics', firebase_sdk_version
55+
56+
# Special pod for on-device conversion
57+
if defined?($RNFirebaseAnalyticsEnableAdSupport) && ($RNFirebaseAnalyticsEnableAdSupport == true)
58+
Pod::UI.puts "#{s.name}: Adding Apple AdSupport.framework dependency for optional analytics features"
59+
s.frameworks = 'AdSupport'
60+
end
5561
end
5662

5763
# Special pod for on-device conversion

tests/ios/Podfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ appPackage = JSON.parse(File.read(File.join('..', 'node_modules', '@react-native
1010
$FirebaseSDKVersion = appPackage['sdkVersions']['ios']['firebase']
1111
# $FirebaseSDKVersion = '10.17.0' # https://firebase.google.com/support/release-notes/ios
1212
Pod::UI.puts "react-native-firebase/tests: Using Firebase SDK version '#{$FirebaseSDKVersion}'"
13-
$RNFirebaseAsStaticFramework = true # toggle this to true (and set 'use_frameworks!' below to test static frameworks)
13+
$RNFirebaseAnalyticsEnableAdSupport = true # toggle this to true (and set 'use_frameworks!' below to test static frameworks)
1414

1515
# Toggle this to true for the no-ad-tracking Analytics subspec. Useful at minimum for Kids category apps.
1616
# See: https://firebase.google.com/support/release-notes/ios#analytics - requires firebase-ios-sdk 7.11.0+
@@ -19,6 +19,9 @@ $RNFirebaseAsStaticFramework = true # toggle this to true (and set 'use_framewor
1919
# Toggle this to true if you want to include support for on device conversion measurement APIs
2020
$RNFirebaseAnalyticsGoogleAppMeasurementOnDeviceConversion = true
2121

22+
# Toggle this to true if you want to include optional support for extended analytics features
23+
$RNFirebaseAnalyticsEnableAdSupport = true
24+
2225
# react-native 0.73 is currently iOS 13.4 as a minimum
2326
min_ios_version_supported = 13.4
2427

tests/ios/Podfile.lock

Lines changed: 35 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2004,74 +2004,74 @@ PODS:
20042004
- RecaptchaInterop (100.0.0)
20052005
- RNDeviceInfo (10.12.0):
20062006
- React-Core
2007-
- RNFBAnalytics (18.8.0):
2007+
- RNFBAnalytics (18.9.0):
20082008
- Firebase/Analytics (= 10.21.0)
20092009
- GoogleAppMeasurementOnDeviceConversion (= 10.21.0)
20102010
- React-Core
20112011
- RNFBApp
2012-
- RNFBApp (18.8.0):
2012+
- RNFBApp (18.9.0):
20132013
- Firebase/CoreOnly (= 10.21.0)
20142014
- React-Core
2015-
- RNFBAppCheck (18.8.0):
2015+
- RNFBAppCheck (18.9.0):
20162016
- Firebase/AppCheck (= 10.21.0)
20172017
- React-Core
20182018
- RNFBApp
2019-
- RNFBAppDistribution (18.8.0):
2019+
- RNFBAppDistribution (18.9.0):
20202020
- Firebase/AppDistribution (= 10.21.0)
20212021
- React-Core
20222022
- RNFBApp
2023-
- RNFBAuth (18.8.0):
2023+
- RNFBAuth (18.9.0):
20242024
- Firebase/Auth (= 10.21.0)
20252025
- React-Core
20262026
- RNFBApp
2027-
- RNFBCrashlytics (18.8.0):
2027+
- RNFBCrashlytics (18.9.0):
20282028
- Firebase/Crashlytics (= 10.21.0)
20292029
- FirebaseCoreExtension (= 10.21.0)
20302030
- React-Core
20312031
- RNFBApp
2032-
- RNFBDatabase (18.8.0):
2032+
- RNFBDatabase (18.9.0):
20332033
- Firebase/Database (= 10.21.0)
20342034
- React-Core
20352035
- RNFBApp
2036-
- RNFBDynamicLinks (18.8.0):
2036+
- RNFBDynamicLinks (18.9.0):
20372037
- Firebase/DynamicLinks (= 10.21.0)
20382038
- GoogleUtilities/AppDelegateSwizzler
20392039
- React-Core
20402040
- RNFBApp
2041-
- RNFBFirestore (18.8.0):
2041+
- RNFBFirestore (18.9.0):
20422042
- Firebase/Firestore (= 10.21.0)
20432043
- nanopb (< 2.30910.0, >= 2.30908.0)
20442044
- React-Core
20452045
- RNFBApp
2046-
- RNFBFunctions (18.8.0):
2046+
- RNFBFunctions (18.9.0):
20472047
- Firebase/Functions (= 10.21.0)
20482048
- React-Core
20492049
- RNFBApp
2050-
- RNFBInAppMessaging (18.8.0):
2050+
- RNFBInAppMessaging (18.9.0):
20512051
- Firebase/InAppMessaging (= 10.21.0)
20522052
- React-Core
20532053
- RNFBApp
2054-
- RNFBInstallations (18.8.0):
2054+
- RNFBInstallations (18.9.0):
20552055
- Firebase/Installations (= 10.21.0)
20562056
- React-Core
20572057
- RNFBApp
2058-
- RNFBMessaging (18.8.0):
2058+
- RNFBMessaging (18.9.0):
20592059
- Firebase/Messaging (= 10.21.0)
20602060
- FirebaseCoreExtension (= 10.21.0)
20612061
- React-Core
20622062
- RNFBApp
2063-
- RNFBML (18.8.0):
2063+
- RNFBML (18.9.0):
20642064
- React-Core
20652065
- RNFBApp
2066-
- RNFBPerf (18.8.0):
2066+
- RNFBPerf (18.9.0):
20672067
- Firebase/Performance (= 10.21.0)
20682068
- React-Core
20692069
- RNFBApp
2070-
- RNFBRemoteConfig (18.8.0):
2070+
- RNFBRemoteConfig (18.9.0):
20712071
- Firebase/RemoteConfig (= 10.21.0)
20722072
- React-Core
20732073
- RNFBApp
2074-
- RNFBStorage (18.8.0):
2074+
- RNFBStorage (18.9.0):
20752075
- Firebase/Storage (= 10.21.0)
20762076
- React-Core
20772077
- RNFBApp
@@ -2427,26 +2427,26 @@ SPEC CHECKSUMS:
24272427
ReactCommon: dcc65c813041388dead6c8b477444757425ce961
24282428
RecaptchaInterop: 7d1a4a01a6b2cb1610a47ef3f85f0c411434cb21
24292429
RNDeviceInfo: db5c64a060e66e5db3102d041ebe3ef307a85120
2430-
RNFBAnalytics: ff81444ec0af9a0d32fc2e085585834e4879411e
2431-
RNFBApp: 56a281957e52f9c23f024f16dc17d8f0a610f244
2432-
RNFBAppCheck: dbbf105bcda64b4bd978bf34295ca1f047177f74
2433-
RNFBAppDistribution: 82028d037519ab87795a9ae41e0651c6f132f77f
2434-
RNFBAuth: d5ee2761b9748fe730d5cdd470d568bcafc1f8eb
2435-
RNFBCrashlytics: 3f3dff6239d00a5a9a9a47d8df2f88fe3a65e981
2436-
RNFBDatabase: 8fff0ee1052d384a7a844bd813f8e6d41368de76
2437-
RNFBDynamicLinks: 6878b413bcb72c5bd01819506be8a13f3c60756b
2438-
RNFBFirestore: ab1c7a336ea8ce19da8243731286cabb03953c53
2439-
RNFBFunctions: 1f2b93a3a2016e8fe2b9b25c1068f48d31232a8f
2440-
RNFBInAppMessaging: 91000e8458ea2a2c91bac6f741ee8e488be3902d
2441-
RNFBInstallations: 8825144a553575d99f698976cbaf52ea5c8e2609
2442-
RNFBMessaging: 0be46df1f7009af910e45ff6e47a45b6b19fef27
2443-
RNFBML: 1d9637b717778133a057ddf86d1915d016d9aabf
2444-
RNFBPerf: a58db4862d77c1e32f5fbf37089540faee123021
2445-
RNFBRemoteConfig: 68281f1dcdf2cdab0d8bb1be339d2dcefd7169a2
2446-
RNFBStorage: 0d25208f4fc71500b6fee6e9d9b7f5f360a1b906
2430+
RNFBAnalytics: 28840e05f67e0b063c4a6642febf46c274da8bf5
2431+
RNFBApp: 9ad5e218542797f24df746b89887f47900519671
2432+
RNFBAppCheck: ba152b4c52ffe737729466a3021fc53081b34e6d
2433+
RNFBAppDistribution: d5af915085f83d3c88185616bf0c52ad7c06437e
2434+
RNFBAuth: 38326a2195bd8913e971ddda59b409aef3ab9897
2435+
RNFBCrashlytics: 671a91763469cdbfae711ac9357dafcf06eb829b
2436+
RNFBDatabase: 32f1f0a67f418e43df6b8a318c28d283b3964b40
2437+
RNFBDynamicLinks: 48a5e45e6a835d860a155a76a42bb8fd8154a1f2
2438+
RNFBFirestore: 7970e0b69768477c5832976b0adeabb8aa27f0b2
2439+
RNFBFunctions: c73d51f0ba1bde31d646c570ea0da96dc21c59aa
2440+
RNFBInAppMessaging: cd28938866f1626b51c914414dcd64c01efd3d92
2441+
RNFBInstallations: 8eb55cf03245658b7e3a49d173808b5f724a4ade
2442+
RNFBMessaging: 5b0918878553a92797497037e70a020caf26d710
2443+
RNFBML: f61cb56fb8d4dcdc650dd6ec966c872d177cde82
2444+
RNFBPerf: 6f4993ccd261fb28815966cd491a0596c1e4d7ce
2445+
RNFBRemoteConfig: fd694687de1e60e0c0728d1e39e7003fd229d694
2446+
RNFBStorage: 0e42af1e780858bd342478a92413f0b93d1be194
24472447
SocketRocket: f32cd54efbe0f095c4d7594881e52619cfe80b17
24482448
Yoga: 1b901a6d6eeba4e8a2e8f308f708691cdb5db312
24492449

2450-
PODFILE CHECKSUM: fd2f683bc28d2fe2477257935924fd91d3c54766
2450+
PODFILE CHECKSUM: 116cc4e9d1ef07a0b698eff4bacd90df81838371
24512451

24522452
COCOAPODS: 1.14.3

0 commit comments

Comments
 (0)