Supporting iOS 14

With iOS 14.5, Apple requires developers to receive the user’s permission through the App Tracking Transparency framework to track them or access their device’s advertising identifier (IDFA). See Apple's User Privacy and Data Use and Apple's App Tracking Transparency documentation for more details.

Affected Firebase products

Firebase SDKs do not access IDFA, though some have integrations with Google Analytics that may involve IDFA access.

The table below lists Firebase products that are available on Apple platforms and describes how the functionality of each product is impacted if IDFA is not accessible.

Product Impact if IDFA is not accessible
A/B Testing Some targeting data (like demographics) in the A/B Testing integration with Google Analytics is derived from the IDFA. In apps without access to the IDFA, this targeting is unavailable.
App Check No impact
App Distribution No impact
Authentication No impact across Authentication and first-party Authentication providers, such as Google Sign-In and Phone Authentication.
Crashlytics No impact. The Crashlytics integration with Google Analytics that provides real-time crash data and breadcrumbs is not dependent on the IDFA.
Dynamic Links No impact for link-opening functionality. When used with Google Analytics, attribution for link conversion events is unavailable.
Cloud Firestore No impact
Cloud Functions No impact
In-App Messaging No impact
Firebase installations No impact
InstanceID No impact
Cloud Messaging When used with Google Analytics, Google Analytics will automatically log some FCM-related conversion events. Attribution for these events requires IDFA access.
Firebase ML No impact
Performance Monitoring No impact
Remote Config When used with Google Analytics, Remote Config does not allow automatically-created user properties for targeting without IDFA access.
Realtime Database No impact
Cloud Storage No impact
Vertex AI in Firebase No impact

Affected Firebase integrations

The table below lists Firebase-integrated products that are affected if IDFA is not accessible.

Product Impact if IDFA is not accessible
Google Analytics Analytics event logging, event reporting, and conversion measurement are unaffected, but attribution is impacted if IDFA is not accessible. To learn more about Google’s response to iOS 14, see our blog post.

Requesting App Tracking Permission on iOS 14

If you would like your Apple application to be able to access IDFA, you can add Apple's App Tracking Transparency framework to your app and request permission to track or access your users' IDFA.

Many applications choose to present a warm-up, or explainer, screen prior to asking for permission. The explainer screen allows you to give users more context on how your app uses IDFA prior to requesting access.

If you are an AdMob or Ad Manager app publisher, consider using Funding Choices, which handles obtaining consent for serving personalized advertisements as well as consent for tracking the user according to Apple's guidelines automatically. See the AdMob Consent with User Messaging page for more details.

The following guide provides a solution using Firebase In-App Messaging for creating and displaying an explainer screen prior to requesting tracking access via App Tracking Transparency.

Add In-App Messaging to your app

Follow the instructions to add In-App Messaging to your Apple application.

Handle in-app message dismissal

First, avoid displaying the explainer screen on devices that cannot present the consent dialog, such as devices running iOS 13. Make sure this code executes immediately after FirebaseApp.configure().

Swift

if NSClassFromString("ATTrackingManager") == nil {
  // Avoid showing the App Tracking Transparency explainer if the
  // framework is not linked.
  InAppMessaging.inAppMessaging().messageDisplaySuppressed = true
}

Implement the InAppMessagingDisplayDelegate protocol to handle events when the user dismisses the explainer screen. If the user taps OK, display the system prompt via the App Tracking Transparency framework.

Swift

// The InAppMessaging delegate must be assigned before events can be handled.
InAppMessaging.inAppMessaging().delegate = self

func messageClicked(_ inAppMessage: InAppMessagingDisplayMessage,
                    with action: InAppMessagingAction) {
  switch action.actionText {
  case "OK":
    ATTrackingManager.requestTrackingAuthorization { status in
      switch status {
      case .authorized:
        // Optionally, log an event when the user accepts.
        Analytics.logEvent("tracking_authorized", parameters: nil)
      case _:
        // Optionally, log an event here with the rejected value.
      }
    }
  case _:
    // do nothing
  }
}

Create an In-App Messaging campaign

Once the code is in place in your application, create an in-app message in the Firebase console.

  1. In the Firebase console, create a new In-App Messaging campaign.
  2. Populate the in-app messages with your desired content and set the message to trigger on the app_launch event.
  3. In the Targeting section, make sure the campaign targets only the most recent version of your app and above.

You can customize the appearance of the explainer screen by following the instructions in the In-App Messaging documentation.

Optional: A/B Test different explainer screens

In-App Messaging has a built-in integration with Firebase A/B Testing, which you can use to experiment with different explainer screens.

Firebase A/B Testing automatically creates experiment groups and helps you visualize how users interact with different variants of your application.

Record app tracking permissions

If you didn't log a Google Analytics event when handling the app tracking permissions response, you will need to in order to measure changes in the response rate when running an A/B experiment.

Swift

ATTrackingManager.requestTrackingAuthorization { status in
  switch status {
  case .authorized:
    // Optionally, log an event when the user accepts.
    Analytics.logEvent("tracking_authorized", parameters: nil)
  case _:
    // Optionally, log an event here with the rejected value.
  }
}

Create a new conversion event

In the Analytics section of the Firebase console, navigate to the Conversions menu, then add a new conversion event with the same name as the event logged with the sample code above.

Create a new experiment

In the console's In-App Messaging menu, click New Experiment, then follow the instructions on the resulting screens.

  • In the Targeting section, make sure the campaign targets only the most recent version of your app and above.
  • In the Goals section, select the conversion event you created with the sample code above as well as any other metrics you would like to track.

Once you've published your experiment, it will need to collect data for some time before it can produce conclusive results.

Read the Firebase A/B Testing documentation for information on how to monitor an experiment and roll out a successful variant.