[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-08-31。"],[],[],null,["iOS+ Android \n\n\u003cbr /\u003e\n\n| **Note:** If you're using the Unity SDK, select the platform option above (iOS+ or Android) for your build target.\n\n\u003cbr /\u003e\n\nThis page describes the features that Google Analytics offers which allow\nyou to control the collection and use of Analytics data.\n\nDisable Analytics data collection\n\nIn some cases, you may wish to temporarily or permanently disable collection of\nAnalytics data, such as to collect end-user consent or to fulfill legal\nobligations. Google Analytics offers multiple options for disabling\nand deactivating Analytics collection. Used together, they support many\ntypical use cases.\n\nTemporarily disable collection\n\nIf you wish to temporarily disable Analytics collection, such as to get\nend-user consent before collecting data, you can set the value of\n`FIREBASE_ANALYTICS_COLLECTION_ENABLED` to `NO` (Boolean) in your app's\n`Info.plist` file. For example, viewed in the source XML: \n\n \u003ckey\u003eFIREBASE_ANALYTICS_COLLECTION_ENABLED\u003c/key\u003e\u003cfalse/\u003e\n\nTo re-enable collection, such as after an end-user provides consent, call the\n[`setAnalyticsCollectionEnabled`](/docs/reference/swift/firebaseanalytics/api/reference/Classes/Analytics#setanalyticscollectionenabled_:)\ninstance method of `Analytics`. For example: \n\nSwift\n\n\n**Note:** This Firebase product is not available on the macOS target. \n\n Analytics.setAnalyticsCollectionEnabled(true)\n\nObjective-C\n\n\n**Note:** This Firebase product is not available on the macOS target. \n\n [FIRAnalytics setAnalyticsCollectionEnabled:YES];\n\nUnity \n\n Firebase.Analytics.FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);\n\nIf you need to suspend collection again for any reason, you can call the\nfollowing and collection is suspended until you re-enable it. \n\nSwift\n\n\n**Note:** This Firebase product is not available on the macOS target. \n\n Analytics.setAnalyticsCollectionEnabled(false)\n\nObjective-C \n\n [FIRAnalytics setAnalyticsCollectionEnabled:NO];\n\nUnity \n\n Firebase.Analytics.FirebaseAnalytics.SetAnalyticsCollectionEnabled(false);\n\nThe value set by the `setAnalyticsCollectionEnabled` method persists across app\nexecutions and overrides the value for `FIREBASE_ANALYTICS_COLLECTION_ENABLED`\nin your app's `Info.plist` file. Once you set a value for\n`setAnalyticsCollectionEnabled`, Analytics collection remains in that state\nuntil `setAnalyticsCollectionEnabled` is called again, even if a user closes\nand re-opens your app.\n\nPermanently deactivate collection\n\nIf you need to deactivate Analytics collection permanently in a version of your\napp, set `FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED` to `YES` (Boolean) in your\napp's `Info.plist` file. Setting `FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED` to\n`YES` (Boolean) takes priority over any values for\n`FIREBASE_ANALYTICS_COLLECTION_ENABLED` in your app's `Info.plist` as well as any\nvalues set with `setAnalyticsCollectionEnabled`.\n\nTo re-enable collection, remove `FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED` from\nyour `Info.plist`. Setting `FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED` to `NO`\n(Boolean) has no effect and results in the same behavior as not having\n`FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED` set in your `Info.plist` file.\n\nDisable IDFA collection\n\nIf you installed Firebase through CocoaPods by adding `pod 'FirebaseAnalytics'`\nto your app's Podfile and wish to disable collection of the IDFA (a device's\nadvertising identifier) in your Apple app, ensure that the AdSupport framework\nis not included in your app.\n\nTo install Firebase without any IDFA collection capability, use the following\nsubspec in place of `pod 'FirebaseAnalytics'`: \n\n pod 'FirebaseAnalytics/Core'\n\nLearn more about IDFA in Apple's documentation:\n\n- [User Privacy and Data Use](https://developer.apple.com/app-store/user-privacy-and-data-use/)\n- [App Tracking Transparency](https://developer.apple.com/documentation/apptrackingtransparency)\n\nDisable IDFV collection\n\nIf you wish to disable collection of the IDFV (Identifier for Vendor) in your\nApple app, set the value of `GOOGLE_ANALYTICS_IDFV_COLLECTION_ENABLED` to `NO`\n(Boolean) in your app's `Info.plist` file.\n\nControl data collection for personalized advertising\n\nIf you have linked your Google Analytics project to an ads account or\notherwise enabled an ads integration, or opted into\n[data sharing](https://support.google.com/firebase/answer/6383877),\nyour Analytics data may be eligible for use in personalized advertising.\nThis means for instance, that you may use collected events such as `first_open`\nto create and deploy audience lists for remarketing unless you indicate that\nsuch data is not available for personalized advertising.\n\nYou can programmatically control whether a user's Analytics data should be used\nfor personalized advertising using any of the following options:\n\n- **Recommended** : Dynamically enable or disable ad personalization by\n honoring the user's consent choice.\n [Implement Google's consent mode API](https://developers.google.com/tag-platform/security/guides/app-consent).\n\n- Enable or disable ad personalization at the user level:\n [Control ad personalization as a user property](#disable-personalization-as-user-property).\n\n- Enable or disable ad personalization at the Analytics property level:\n [Disable ads personalization per geographical region in your Analytics property](https://support.google.com/analytics/answer/9626162).\n\nDisable personalized advertising features via a user property [Google's consent mode API](https://developers.google.com/tag-platform/security/guides/app-consent?platform=ios) is the recommended way to enable and disable personalized advertising.\n\n\u003cbr /\u003e\n\nHowever, if your app doesn't use consent mode yet, you can control\npersonalization with the following option.\n\nTo disable personalized advertising behavior by default, set the value of\n`GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_PERSONALIZATION_SIGNALS` to `NO` (Boolean)\nin your app's `Info.plist` file.\n| **Note:** In certain circumstances, Google may disable personalized advertising for Analytics data collected from an end user, even when you have not done so, where Google has information that the respective end user is not eligible for personalized advertising (for example, [the end user on an Android device is under the applicable age per our advertising policies](//support.google.com/adspolicy/answer/143465)).\n\nRe-enable personalized advertising features via a user property\n\nIf you use the `AnalyticsUserPropertyAllowAdPersonalizationSignals` parameter\nto control ad personalization, you can re-enable ad personalization with the\n[`setUserProperty`](/docs/reference/swift/firebaseanalytics/api/reference/Classes/Analytics#setuserproperty_:forname:)\nmethod as shown below: \n\nSwift\n\n\n**Note:** This Firebase product is not available on the macOS target. \n\n Analytics.setUserProperty(\"true\", forName: AnalyticsUserPropertyAllowAdPersonalizationSignals)\n\nObjective-C\n\n\n**Note:** This Firebase product is not available on the macOS target. \n\n [FIRAnalytics setUserPropertyString:@\"YES\" forName:kFIRUserPropertyAllowAdPersonalizationSignals];\n\nUnity \n\n Firebase.Analytics.FirebaseAnalytics.SetUserProperty(FirebaseAnalytics.UserPropertyAllowAdPersonalizationSignals, true);\n\nIf you have chosen to temporarily disable analytics collection (for example,\nuntil an end-user provides consent), and you want to control personalized\nadvertising features upon re-enabling analytics collection for a user, ensure\nthat your call to specify this setting precedes your call to re-enable analytics\ncollection. For example: \n\nSwift\n\n\n**Note:** This Firebase product is not available on the macOS target. \n\n Analytics.setUserProperty(..., forName: AnalyticsUserPropertyAllowAdPersonalizationSignals)\n Analytics.setAnalyticsCollectionEnabled(true)\n\nObjective-C\n\n\n**Note:** This Firebase product is not available on the macOS target. \n\n [FIRAnalytics setUserPropertyString:... forName:kFIRUserPropertyAllowAdPersonalizationSignals];\n [FIRAnalytics setAnalyticsCollectionEnabled:YES];\n\nUnity \n\n Firebase.Analytics.FirebaseAnalytics.SetUserProperty(FirebaseAnalytics.UserPropertyAllowAdPersonalizationSignals, ...);\n Firebase.Analytics.FirebaseAnalytics.SetAnalyticsCollectionEnabled(true);\n\nConfirm your settings\n\nWhen ad personalization signals have been disabled for a user via one of the\nmechanisms defined above, subsequent event bundles logged from that user's\ndevice will contain a user property named `non_personalized_ads` with a value of\n1 to indicate that events in that bundle are not available for personalized\nadvertising. Disabling personalized advertising does not affect the use of the\ndata for measurement purposes, including reporting and attribution.\n| **Note:** If a user withdraws their previously given consent for Analytics or Ad storage, Google Analytics deletes all user properties, including consent for [`ad personalization`](https://developers.google.com/tag-platform/security/concepts/consent-mode#consent-type). To preserve the user's consent choice for ad personalization, restore the previous value for ad personalization using `setConsent` ([Swift](/docs/reference/swift/firebaseanalytics/api/reference/Categories/FIRAnalytics(Consent)#setconsent_:) \\| [Obj-C](/docs/reference/ios/firebaseanalytics/api/reference/Classes/FIRAnalytics#+setconsent:)) .\n\nSee your configuration changes\n\nOnce you've made changes to your Google Analytics settings, the SDK\ndownloads the changes. The process is fast and seamless, so you can quickly test\nyour changes. When you make changes in Analytics, it may take a few minutes\nto deploy in your app. If your app is live, the full deployment process may take\nup to one hour to complete."]]