Google Analytics offers features which allow you to control the collection and use of Analytics data.
Disable Analytics data collection
In some cases, you may wish to temporarily or permanently disable collection of Analytics data, such as to collect end-user consent or to fulfill legal obligations. Google Analytics offers multiple options for disabling and deactivating Analytics collection. Used together, they support many typical use cases.
Temporarily disable collection
If you wish to temporarily disable Analytics collection, such as to get
end-user consent before collecting data, you can set the value of
NO (Boolean) in your app's
Info.plist file. For example, viewed in the source XML:
To re-enable collection, such as after an end-user provides consent, call the
instance method of
Analytics. For example:
If you need to suspend collection again for any reason, you can call
and collection is suspended until you re-enable it. The value set by the
setAnalyticsCollectionEnabled method persists across app executions and
overrides the value for
FIREBASE_ANALYTICS_COLLECTION_ENABLED in your app's
Info.plist file. Once you set a value for
Analytics collection remains in that state until
is called again, even if a user closes and re-opens your app.
Permanently deactivate collection
If you need to deactivate Analytics collection permanently in a version of your
YES (Boolean) in your
Info.plist file. Setting
YES (Boolean) takes priority over any values for
FIREBASE_ANALYTICS_COLLECTION_ENABLED in your app's
Info.plist as well as any
values set with
To re-enable collection, remove
(Boolean) has no effect and results in the same behavior as not having
FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED set in your
Disable IDFA collection
If you installed Firebase through CocoaPods by adding
to your app's Podfile and wish to disable collection of the IDFA (a device's
advertising identifier) in your Apple app, ensure that the AdSupport framework is
not included in your app.
To install Firebase without any IDFA collection capability, use the following
subspec in place of
Learn more about IDFA in Apple's documentation:
Disable IDFV collection
If you wish to disable collection of the IDFV (Identifier for Vendor) in your
Apple app, set the value of
(Boolean) in your app's
Control data collection for personalized advertising
If you have linked your Google Analytics project to an ads account or
otherwise enabled an ads integration, or opted into
your Analytics data may be eligible for use in personalized advertising.
This means for instance, that you may use collected events such as
to create and deploy audience lists for remarketing unless you indicate that
such data is not available for personalized advertising.
You can programmatically control whether a user's Analytics data should be used for personalized advertising using any of the following options:
Recommended: Dynamically enable or disable ad personalization by honoring the user's consent choice. Implement Google's consent mode API.
Enable or disable ad personalization at the user level: Control ad personalization as a user property.
Enable or disable ad personalization at the Analytics property level: Disable ads personalization per geographical region in your Analytics property.
Disable personalized advertising features via a user propertyGoogle's consent mode API is the recommended way to enable and disable personalized advertising.
However, if your app doesn't use consent mode yet, you can control personalization with the following option.
To disable personalized advertising behavior by default, set the value of
in your app's
Re-enable personalized advertising features via a user propertyIf you use the
to control ad personalization, you can re-enable ad personalization with the
method as shown below:
Analytics.setUserProperty("true", forName: AnalyticsUserPropertyAllowAdPersonalizationSignals)
[FIRAnalytics setUserPropertyString:@"YES" forName:kFIRUserPropertyAllowAdPersonalizationSignals];
If you have chosen to temporarily disable analytics collection (for example, until an end-user provides consent), and you want to control personalized advertising features upon re-enabling analytics collection for a user, ensure that your call to specify this setting precedes your call to re-enable analytics collection. For example:
Analytics.setUserProperty(..., forName: AnalyticsUserPropertyAllowAdPersonalizationSignals)
[FIRAnalytics setUserPropertyString:... forName:kFIRUserPropertyAllowAdPersonalizationSignals];
Confirm your settings
When ad personalization signals have been disabled for a user via one of the
mechanisms defined above, subsequent event bundles logged from that user's
device will contain a user property named
non_personalized_ads with a value of
1 to indicate that events in that bundle are not available for personalized
advertising. Disabling personalized advertising does not affect the use of the
data for measurement purposes, including reporting and attribution.
See your configuration changes
Once you've made changes to your Google Analytics settings, the SDK downloads the changes. The process is fast and seamless, so you can quickly test your changes. When you make changes in Analytics, it may take a few minutes to deploy in your app. If your app is live, the full deployment process may take up to one hour to complete.