Skip to content

Commit

Permalink
feat(analytics, ATT): allow use of AnalyticsWithoutAdIdSupport pod
Browse files Browse the repository at this point in the history
- not compatible with AdMob, so put a warning in there
- requires firebase-ios-sdk 7.11.0 but desire non-breaking, fail on install if req not met
- add messaging during install to make new option more developer discoverable
  • Loading branch information
mikehardy committed Apr 29, 2021
1 parent f25d25d commit da6b811
Show file tree
Hide file tree
Showing 6 changed files with 82 additions and 27 deletions.
4 changes: 4 additions & 0 deletions .spellcheck.dict.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ APIs
APIs.
APNs
async
ATT
ATT-compatible
auth
Auth
authenticator
Expand Down Expand Up @@ -46,6 +48,7 @@ Fastlane
FCM
firebase
Firebase
firebase-ios-sdk
Firestore
GDPR
globals
Expand All @@ -55,6 +58,7 @@ Hesp
Homebrew
HTTP
HTTPS
IDFA
installable
Interstitials
interstitials
Expand Down
21 changes: 21 additions & 0 deletions docs/analytics/usage/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,27 @@ import analytics from '@react-native-firebase/analytics';
const appInstanceId = await analytics().getAppInstanceId();
```

# Disable Ad Id usage on iOS

Apple has a strict ban on the usage of Ad Ids ("IDFA") in Kids Category apps. They will not accept any app
in the Kids category if the app accesses the IDFA iOS symbols.

Additionally, apps must implement Apples "App Tracking Transparency" (or "ATT") requirements if they access IDFA symbols.
However, if an app does not use IDFA and otherwise handles data in an ATT-compatible way, it eliminates this ATT requirement.

If avoiding the usage of IDFA is a requirement for your app, you must use firebase-ios-sdk 7.11.0 or greater, then you may define a variable in your Podfile like this:

```ruby
$RNFirebaseAnalyticsWithoutAdIdSupport = true
```

During `pod install`, using that variable installs a new
["Analytics With No Ad Ids"](https://firebase.google.com/support/release-notes/ios#version_7110_-_april_20_2021)
pod the firebase-ios-sdk team has created, and allows both the use of Firebase Analytics in Kids Category apps,
and use of Firebase Analytics without needing the App Tracking Transparency handling (assuming no other parts
of your app handle data in a way that requires ATT)

Note that for obvious reasons, configuring Firebase Analytics for use without IDFA is incompatible with AdMob
# firebase.json

## Disable Auto-Initialization
Expand Down
5 changes: 5 additions & 0 deletions packages/admob/RNFBAdMob.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ Pod::Spec.new do |s|
firebase_sdk_version = $FirebaseSDKVersion
end

if defined?($RNFirebaseAnalyticsWithoutAdIdSupport)
# Trying to use AdMob *and* AnalyticsWIthoutAdIdSupport is not a valid combination
raise "#{s.name} and Firebase/AnalyticsWithoutAdIdSupport are not compatible. Ad Ids are required for #{s.name}"
end

# Firebase dependencies
s.dependency 'Firebase/AdMob', firebase_sdk_version

Expand Down
15 changes: 14 additions & 1 deletion packages/analytics/RNFBAnalytics.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,20 @@ Pod::Spec.new do |s|
end

# Firebase dependencies
s.dependency 'Firebase/Analytics', firebase_sdk_version
if defined?($RNFirebaseAnalyticsWithoutAdIdSupport)
Pod::UI.puts "#{s.name}: Using Firebase/AnalyticsWithoutAdIdSupport pod in place of default Firebase/Analytics"

# Releasing as non-breaking change as it is optional but it raises minimum requirements, validate just in case
if (Gem::Version.new(firebase_sdk_version) < Gem::Version.new("7.11.0"))
raise "Firebase/AnalyticsWithoutAdIdSupport requires firebase-ios-sdk 7.11.0 or greater."
end

s.dependency 'Firebase/AnalyticsWithoutAdIdSupport', firebase_sdk_version
else
Pod::UI.puts "#{s.name}: Using default Firebase/Analytics with Ad Ids. May require App Tracking Transparency. Not allowed for Kids apps."
Pod::UI.puts "#{s.name}: You may set variable `$RNFirebaseAnalyticsWithoutAdIdSupport=true` in Podfile to use analytics without ad ids."
s.dependency 'Firebase/Analytics', firebase_sdk_version
end

if defined?($RNFirebaseAsStaticFramework)
Pod::UI.puts "#{s.name}: Using overridden static_framework value of '#{$RNFirebaseAsStaticFramework}'"
Expand Down
9 changes: 8 additions & 1 deletion tests/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,14 @@ $FirebaseSDKVersion = appPackage['sdkVersions']['ios']['firebase']
Pod::UI.puts "react-native-firebase/tests: Using Firebase SDK version '#{$FirebaseSDKVersion}'"
#$RNFirebaseAsStaticFramework = false # toggle this to true (and set 'use_frameworks!' below to test static frameworks)

# Toggle this to true for the no-ad-tracking Analytics subspec. Useful at minimum for Kids category apps.
# See: https://firebase.google.com/support/release-notes/ios#analytics - requires firebase-ios-sdk 7.11.0+
#$RNFirebaseAnalyticsWithoutAdIdSupport = true # toggle this to true for the no-ad-tracking Analytics subspec

# This is needed to reduce flakiness where leveldb is transitively included by database, and packed as framework
# from the pre-compiled firestore-ios-sdk-frameworks
$FirebaseFirestoreExcludeLeveldb = true

# Versions used below, for quick reference / outdated+upgrade checks
$iOSMinimumDeployVersion = '10.0'

Expand All @@ -28,7 +36,6 @@ target 'testing' do
)

# Use pre-compiled firestore frameworks to optimize compile time. But make sure there are not leveldb conflicts.
$FirebaseFirestoreExcludeLeveldb = true
pod 'FirebaseFirestore', :git => 'https://github.com/invertase/firestore-ios-sdk-frameworks.git', :tag => $FirebaseSDKVersion

# Enables Flipper.
Expand Down
55 changes: 30 additions & 25 deletions tests/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,14 @@ PODS:
- Firebase/AdMob (7.11.0):
- Firebase/CoreOnly
- Google-Mobile-Ads-SDK (~> 7.66)
- Firebase/AnalyticsWithoutAdIdSupport (7.11.0):
- Firebase/CoreOnly
- FirebaseAnalytics/WithoutAdIdSupport (~> 7.11.0)
- Firebase/Analytics (7.11.0):
- Firebase/Core
- Firebase/Auth (7.11.0):
- Firebase/CoreOnly
- FirebaseAuth (~> 7.11.0)
- Firebase/Core (7.11.0):
- Firebase/CoreOnly
- FirebaseAnalytics (~> 7.11.0)
- Firebase/CoreOnly (7.11.0):
- FirebaseCore (= 7.11.0)
- Firebase/Crashlytics (7.11.0):
Expand Down Expand Up @@ -55,19 +57,28 @@ PODS:
- FirebaseStorage (~> 7.11.0)
- FirebaseABTesting (7.11.0):
- FirebaseCore (~> 7.0)
- FirebaseAnalytics/Base (7.11.0):
- FirebaseAnalytics (7.11.0):
- FirebaseAnalytics/AdIdSupport (= 7.11.0)
- FirebaseCore (~> 7.0)
- FirebaseInstallations (~> 7.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.0)
- GoogleUtilities/MethodSwizzler (~> 7.0)
- GoogleUtilities/Network (~> 7.0)
- "GoogleUtilities/NSData+zlib (~> 7.0)"
- nanopb (~> 2.30908.0)
- FirebaseAnalytics/WithoutAdIdSupport (7.11.0):
- FirebaseAnalytics/AdIdSupport (7.11.0):
- FirebaseAnalytics/Base (= 7.11.0)
- FirebaseCore (~> 7.0)
- FirebaseInstallations (~> 7.0)
- GoogleAppMeasurement/WithoutAdIdSupport (= 7.11.0)
- GoogleAppMeasurement/AdIdSupport (= 7.11.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.0)
- GoogleUtilities/MethodSwizzler (~> 7.0)
- GoogleUtilities/Network (~> 7.0)
- "GoogleUtilities/NSData+zlib (~> 7.0)"
- nanopb (~> 2.30908.0)
- FirebaseAnalytics/Base (7.11.0):
- FirebaseCore (~> 7.0)
- FirebaseInstallations (~> 7.0)
- GoogleUtilities/AppDelegateSwizzler (~> 7.0)
- GoogleUtilities/MethodSwizzler (~> 7.0)
- GoogleUtilities/Network (~> 7.0)
Expand Down Expand Up @@ -184,12 +195,6 @@ PODS:
- GoogleUtilities/Network (~> 7.0)
- "GoogleUtilities/NSData+zlib (~> 7.0)"
- nanopb (~> 2.30908.0)
- GoogleAppMeasurement/WithoutAdIdSupport (7.11.0):
- GoogleUtilities/AppDelegateSwizzler (~> 7.0)
- GoogleUtilities/MethodSwizzler (~> 7.0)
- GoogleUtilities/Network (~> 7.0)
- "GoogleUtilities/NSData+zlib (~> 7.0)"
- nanopb (~> 2.30908.0)
- GoogleDataTransport (8.4.0):
- GoogleUtilities/Environment (~> 7.2)
- nanopb (~> 2.30908.0)
Expand All @@ -207,25 +212,25 @@ PODS:
- "GoogleToolboxForMac/NSString+URLArguments (= 2.3.1)"
- "GoogleToolboxForMac/NSString+URLArguments (2.3.1)"
- GoogleUserMessagingPlatform (1.4.0)
- GoogleUtilities/AppDelegateSwizzler (7.3.1):
- GoogleUtilities/AppDelegateSwizzler (7.4.0):
- GoogleUtilities/Environment
- GoogleUtilities/Logger
- GoogleUtilities/Network
- GoogleUtilities/Environment (7.3.1):
- GoogleUtilities/Environment (7.4.0):
- PromisesObjC (~> 1.2)
- GoogleUtilities/ISASwizzler (7.3.1)
- GoogleUtilities/Logger (7.3.1):
- GoogleUtilities/ISASwizzler (7.4.0)
- GoogleUtilities/Logger (7.4.0):
- GoogleUtilities/Environment
- GoogleUtilities/MethodSwizzler (7.3.1):
- GoogleUtilities/MethodSwizzler (7.4.0):
- GoogleUtilities/Logger
- GoogleUtilities/Network (7.3.1):
- GoogleUtilities/Network (7.4.0):
- GoogleUtilities/Logger
- "GoogleUtilities/NSData+zlib"
- GoogleUtilities/Reachability
- "GoogleUtilities/NSData+zlib (7.3.1)"
- GoogleUtilities/Reachability (7.3.1):
- "GoogleUtilities/NSData+zlib (7.4.0)"
- GoogleUtilities/Reachability (7.4.0):
- GoogleUtilities/Logger
- GoogleUtilities/UserDefaults (7.3.1):
- GoogleUtilities/UserDefaults (7.4.0):
- GoogleUtilities/Logger
- GTMSessionFetcher (1.5.0):
- GTMSessionFetcher/Full (= 1.5.0)
Expand Down Expand Up @@ -506,7 +511,7 @@ PODS:
- React-Core
- RNFBApp
- RNFBAnalytics (11.3.3):
- Firebase/AnalyticsWithoutAdIdSupport (= 7.11.0)
- Firebase/Analytics (= 7.11.0)
- React-Core
- RNFBApp
- RNFBApp (11.3.3):
Expand Down Expand Up @@ -786,7 +791,7 @@ SPEC CHECKSUMS:
GoogleDataTransport: cd9db2180fcecd8da1b561aea31e3e56cf834aa7
GoogleToolboxForMac: 471e0c05d39506e50e6398f46fa9a12ae0efeff9
GoogleUserMessagingPlatform: b168e8c46cd8f92aa3e34b584c4ca78a411ce367
GoogleUtilities: e1d9ed4e544fc32a93e00e721400cbc3f377200d
GoogleUtilities: 284cddc7fffc14ae1907efb6f78ab95c1fccaedc
GTMSessionFetcher: b3503b20a988c4e20cc189aa798fd18220133f52
Jet: 84fd0e2e9d49457fc04bc79b5d8857737a01c507
leveldb-library: 50c7b45cbd7bf543c81a468fe557a16ae3db8729
Expand Down Expand Up @@ -818,7 +823,7 @@ SPEC CHECKSUMS:
React-runtimeexecutor: cad74a1eaa53ee6e7a3620231939d8fe2c6afcf0
ReactCommon: cfe2b7fd20e0dbd2d1185cd7d8f99633fbc5ff05
RNFBAdMob: 7d5a6b026782a1b5f91bd863d2299e4a328cade0
RNFBAnalytics: 45e0aaa4919d5dc82a2605f01984cd4dfff706c8
RNFBAnalytics: 4747ea51be1b2f003c889aad0207bf3fcc8309ad
RNFBApp: 097a73b10972939bade8ad720ef92c3867baf2e5
RNFBAuth: e554b8c1d3cddcb1ead741794be055acc1defcda
RNFBCrashlytics: a045da0758ed559db99ed049a11ffc995fececb9
Expand All @@ -835,6 +840,6 @@ SPEC CHECKSUMS:
RNFBStorage: af7814531e503ea094f65f24fc5aa98491823bb8
Yoga: 8c8436d4171c87504c648ae23b1d81242bdf3bbf

PODFILE CHECKSUM: 425de7af0490cb14d4d9a6f7f39d3eb34cd31fb6
PODFILE CHECKSUM: 89dba385c805fb62e8343576922b9b86427aa683

COCOAPODS: 1.10.1

1 comment on commit da6b811

@vercel
Copy link

@vercel vercel bot commented on da6b811 Apr 29, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.