تنظيم صفحاتك في مجموعات
يمكنك حفظ المحتوى وتصنيفه حسب إعداداتك المفضّلة.
هذه الصفحة مخصّصة للمطوّرين الذين يستخدِمون حزمة تطوير البرامج (SDK) لخدمة "إحصاءات Google لبرنامج Firebase" في تطبيقاتهم ويريدون دمج "وضع الموافقة". للاطّلاع على مقدمة عن "وضع الموافقة"، يُرجى الاطّلاع على
نظرة عامة على "وضع الموافقة".
توفّر "إحصاءات Google" ميزة "وضع الموافقة" لتعديل سلوك حزمة تطوير البرامج (SDK) استنادًا إلى
حالة الموافقة للمستخدمين. يمكنك تنفيذ "وضع الموافقة" بطريقة أساسية أو متقدّمة إذا لم تكن متأكّدًا ممّا إذا كنت تريد تنفيذ "وضع الموافقة" الأساسي أو المتقدّم، يمكنك الاطّلاع على مزيد من المعلومات عن الفرق بين "وضع الموافقة" الأساسي والمتقدّم والرجوع إلى إرشادات شركتك.
قبل البدء
قبل أن تتمكّن من إدارة موافقة المستخدم، عليك تنفيذ ما يلي:
أضِف أزواج مفتاح/قيمة وضع الموافقة. يصف المفتاح نوع الموافقة وتشير القيمة إلى حالة الموافقة. يمكن أن تكون القيم true، ما يعني أنّه تم منح الموافقة، أو false، ما يعني أنّه تم رفض الموافقة.
وفقًا للتعديلات على "وضع الموافقة" في ما يتعلّق بالزيارات في
المنطقة الاقتصادية الأوروبية، يمكن ضبط القيمة eu_consent_policy
للمَعلمتَين ad_user_data وad_personalization، ما يعني أنّه يتم رفض الموافقة فقط
للمستخدمين في المناطق الخاضعة لـ "سياسة موافقة المستخدِم في الاتّحاد الأوروبي".
لتعديل قيم الموافقة بعد إطلاق التطبيق، يمكنك طلب الطريقة setConsent.
تلغي القيمة التي تحدّدها طريقة setConsent الإعداد التلقائي وتستمر في جميع عمليات تنفيذ التطبيقات. وتظل القيمة كما هي إلى أن يتم طلب setConsent مرة أخرى، حتى إذا أغلق المستخدم التطبيق وأعاد فتحه.
لا يعدّل setConsent سوى المَعلمات التي تحدِّدها.
إذا سحب مستخدم موافقته التي قدّمها سابقًا لخدمة "إحصاءات Google" أو لميزة "تخزين الإعلانات"، تحذف "إحصاءات Google" جميع مواقع المستخدم، بما في ذلك الموافقة على
ad_personalization.
للحفاظ على اختيار موافقة المستخدم لتخصيص الإعلانات، استعد
القيمة السابقة لتخصيص الإعلانات باستخدام setConsent
(Swift
| Obj-C)
.
يوضّح المثال التالي طريقة setConsent التي تعدّل قيم
الموافقة المختلفة إلى granted:
إذا قرّر أحد المستخدِمين إلغاء موافقته، تأكَّد من تعديل حالة الموافقة
وفقًا لذلك
الترقية إلى الإصدار 2 من "وضع الموافقة"
في إطار التزام Google المستمرّ بتوفير منظومة متكاملة للإعلانات الرقمية مصمّمة بالتوافق مع معايير الخصوصية، نعمل على تنفيذ سياسة موافقة المستخدم في الاتحاد الأوروبي بشكل أكثر صرامة.
تاريخ التعديل الأخير: 2024-11-09 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2024-11-09 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eThis guide helps Firebase developers integrate consent mode to control data collection based on user consent, covering both basic and advanced implementation options.\u003c/p\u003e\n"],["\u003cp\u003eBefore setup, ensure you've implemented the Google Analytics for Firebase SDK and a consent settings banner or CMP.\u003c/p\u003e\n"],["\u003cp\u003eTo set up consent mode, define default consent states in your app's info.plist file and use the \u003ccode\u003esetConsent\u003c/code\u003e method to dynamically update consent values based on user choices.\u003c/p\u003e\n"],["\u003cp\u003eConsent mode v2 introduces two additional parameters, \u003ccode\u003ead_user_data\u003c/code\u003e and \u003ccode\u003ead_personalization\u003c/code\u003e, to comply with Google's updated EU user consent policy, requiring updates to your app's info.plist and consent calls.\u003c/p\u003e\n"],["\u003cp\u003eVerify your implementation by checking the Xcode debug console for consent settings like \u003ccode\u003ead_storage\u003c/code\u003e, \u003ccode\u003eanalytics_storage\u003c/code\u003e, \u003ccode\u003ead_user_data\u003c/code\u003e, and \u003ccode\u003ead_personalization\u003c/code\u003e.\u003c/p\u003e\n"]]],["Developers integrate consent mode with the Google Analytics for Firebase SDK to manage user consent. Key actions involve setting default consent states in the `info.plist` file using keys like `GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_STORAGE` with `true` or `false` values, which now include `ad_user_data` and `ad_personalization`. The `setConsent` method updates consent after app launch, overriding defaults and persisting across sessions. Upgrading to consent mode v2 requires adding the two new consent parameters to both `info.plist` and `setConsent` calls. Verification is done via the Xcode debug console, checking for specific consent parameters.\n"],null,["# Set up consent mode for apps\n\n\u003e This page is for developers that use the Google Analytics for Firebase SDK in\n\u003e their app and want to integrate consent mode. For an introduction to consent\n\u003e mode, read [Consent mode\n\u003e overview](/tag-platform/security/concepts/consent-mode).\n\nGoogle Analytics offers consent mode to adjust how your SDK behaves based on the\nconsent status of your users. You can implement consent mode in a basic or\nadvanced way. If you aren't sure whether to implement basic or advanced consent\nmode, learn more about [basic versus advanced consent\nmode](/tag-platform/security/concepts/consent-mode#basic-vs-advanced) and check\nwith your company's guidelines. \nAdvanced consent mode Basic consent mode \niOS Android\n| **Important** : Consent mode for apps was updated Oct 30th 2023 and now contains two additional parameters. If you already use consent mode, [upgrade to consent mode v2](#upgrade-consent-v2). Learn more about Google's [Updates to consent mode for traffic in European Economic Area (EEA)](https://support.google.com/tagmanager/answer/13695607).\n\nBefore you begin\n----------------\n\nBefore you can manage user consent, you need to implement:\n\n- [Google Analytics for Firebase SDK](https://firebase.google.com/docs/analytics)\n- A consent settings banner to capture user consent\n\n | **Tip:** If you don't want to implement consent settings yourself, consider using a consent management platform (CMP).\n\nSet up consent mode\n-------------------\n\nTo set up consent mode, you need to:\n\n1. [Set the default consent state](#default-consent).\n\n### Set the default consent state\n\nBy default, no consent mode values are set. To set the default consent state for\nyour app:\n\n1. Open your app's [info.plist](https://developer.apple.com/documentation/bundleresources/information_property_list) file.\n2. Add the consent mode key-value pairs. The key describes the [consent\n type](/tag-platform/security/concepts/consent-mode#consent-types) and the\n value indicates consent state. Values can either be `true`, meaning consent\n was granted, or `false`, meaning consent was denied.\n\n In accordance with the updates to consent mode for traffic in\n European Economic Area (EEA), a value of `eu_consent_policy` can be set\n for `ad_user_data` and `ad_personalization`, meaning consent is denied only\n for users in regions subject to the EU User Consent Policy.\n\n Set the following:\n - `GOOGLE_ANALYTICS_DEFAULT_ALLOW_ANALYTICS_STORAGE`\n - `GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_STORAGE`\n - `GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_USER_DATA`\n - `GOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_PERSONALIZATION_SIGNALS`\n3. Save your changes. Next, implement the mechanism to update consent values.\n\nFor example, to set all grant consent for all parameters by default: \n\n \u003ckey\u003eGOOGLE_ANALYTICS_DEFAULT_ALLOW_ANALYTICS_STORAGE\u003c/key\u003e \u003ctrue/\u003e\n \u003ckey\u003eGOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_STORAGE\u003c/key\u003e \u003ctrue/\u003e\n \u003ckey\u003eGOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_USER_DATA\u003c/key\u003e \u003ctrue/\u003e\n \u003ckey\u003eGOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_PERSONALIZATION_SIGNALS\u003c/key\u003e \u003ctrue/\u003e\n\n### Update consent\n\nTo update consent values after an app has launched, call the\n[`setConsent`](https://firebase.google.com/docs/reference/android/com/google/firebase/analytics/FirebaseAnalytics#setConsent) method.\n\nThe value set by the `setConsent` method overrides the default setting and\npersists across app executions. The value remains in that state until\n`setConsent` is called again, even if a user closes and reopens the app.\n`setConsent` only updates the parameters you specify.\n\u003e If a user withdraws their previously given consent for Analytics or Ad\n\u003e storage, Google Analytics deletes all user properties, including consent for\n\u003e [`ad_personalization`](https://developers.google.com/tag-platform/security/concepts/consent-mode#consent-type).\n\u003e To preserve the user's consent choice for ad personalization, restore the\n\u003e previous value for ad personalization using `setConsent`\n\u003e\n\u003e ([Swift](https://firebase.google.com/docs/reference/swift/firebaseanalytics/api/reference/Categories/FIRAnalytics(Consent)#setconsent_:)\n\u003e \\| [Obj-C](https://firebase.google.com/docs/reference/ios/firebaseanalytics/api/reference/Classes/FIRAnalytics#+setconsent:))\n\u003e .\n\nThe following example shows the `setConsent` method updating the different\nconsent values to `granted`: \n\n### Swift\n\n Analytics.setConsent([\n .analyticsStorage: .granted,\n .adStorage: .granted,\n .adUserData: .granted,\n .adPersonalization: .granted,\n ])\n\n### Objective-C\n\n [FIRAnalytics setConsent:@{\n FIRConsentTypeAnalyticsStorage : FIRConsentStatusGranted,\n FIRConsentTypeAdStorage : FIRConsentStatusGranted,\n FIRConsentTypeAdUserData : FIRConsentStatusGranted,\n FIRConsentTypeAdPersonalization : FIRConsentStatusGranted,\n }];\n\nIf a user decides to revoke their consent, make sure you update the consent\nstates accordingly\n\n\nUpgrade to consent mode v2\n--------------------------\n\nAs a part of Google's ongoing commitment to a privacy-safe digital advertising\necosystem, we are strengthening the enforcement of our [EU user consent\npolicy](https://www.google.com/about/company/user-consent-policy/).\n\nLearn more about Google's [Updates to consent mode for traffic in European\nEconomic Area (EEA)](https://support.google.com/tagmanager/answer/13695607).\n\nConsent mode users need to send two new parameters in addition to ad storage and\nanalytics storage:\n\n1. Update your app's info.plist to include:\n\n \u003ckey\u003eGOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_USER_DATA\u003c/key\u003e \u003ctrue/\u003e\n \u003ckey\u003eGOOGLE_ANALYTICS_DEFAULT_ALLOW_AD_PERSONALIZATION_SIGNALS\u003c/key\u003e \u003ctrue/\u003e\n\n2. Update your consent calls to include the parameters for ad user data and ad\n personalization:\n\n ### Swift\n\n Analytics.setConsent([\n .analyticsStorage: .granted,\n .adStorage: .granted,\n .adUserData: .granted,\n .adPersonalization: .granted,\n ])\n\n ### Objective-C\n\n [FIRAnalytics setConsent:@{\n FIRConsentTypeAnalyticsStorage : FIRConsentStatusGranted,\n FIRConsentTypeAdStorage : FIRConsentStatusGranted,\n FIRConsentTypeAdUserData : FIRConsentStatusGranted,\n FIRConsentTypeAdPersonalization : FIRConsentStatusGranted,\n }];\n\nVerify consent settings\n-----------------------\n\nYou can verify that your consent settings are working as intended by viewing the\nXcode debug console for your app.\n\nFollow these steps:\n\n1. [Enable verbose logging](https://firebase.google.com/docs/analytics/events?platform=ios#view_events_in_the_xcode_debug_console) on your device.\n2. In the Xcode debug console, look for:\n\n - `ad_storage`\n - `analytics_storage`\n - `ad_user_data`\n - `ad_personalization`\n\n For example, if Ad storage are enabled, you'll see the following message: \n\n ad_storage is granted."]]