Skip to content

feat(analytics, ATT): allow use of AnalyticsWithoutAdIdSupport pod #5224

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 29, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion packages/app/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
},
"sdkVersions": {
"ios": {
"firebase": "7.10.0"
"firebase": "7.11.0"
},
"android": {
"minSdk": 16,
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
Loading