Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Bu sayfa, uygulamalarında Firebase için Google Analytics SDK'sını kullanan ve izin modunu entegre etmek isteyen geliştiriciler içindir. İzin moduna giriş için İzin moduna genel bakış başlıklı makaleyi inceleyin.
Google Analytics, SDK'nızın davranış şeklini kullanıcılarınızın izin durumuna göre ayarlamak için izin modu sunar. İzin modunu temel veya gelişmiş şekilde uygulayabilirsiniz. Temel mi yoksa gelişmiş izin modunu mu uygulayacağınızdan emin değilseniz temel ve gelişmiş izin modu hakkında daha fazla bilgi edinin ve şirketinizin yönergelerini inceleyin.
Başlamadan önce
Kullanıcı rızasını yönetebilmeniz için şunları uygulamanız gerekir:
İzin modu anahtar/değer çiftlerini ekleyin. Anahtar, izin türünü, değer ise izin durumunu belirtir. Değerler, izin verildi anlamına gelen true veya izin reddedildi anlamına gelen false olabilir.
Avrupa Ekonomik Alanı'ndaki (AEA) trafik için izin modunda yapılan güncellemelere uygun şekilde, ad_user_data ve ad_personalization için eu_consent_policy değeri ayarlanabilir. Bu durumda, izin yalnızca AB Kullanıcı Rızası Politikası'na tabi bölgelerdeki kullanıcılar için reddedilir.
Uygulama kullanıma sunulduktan sonra izin değerlerini güncellemek için setConsent yöntemini çağırın.
setConsent yöntemi tarafından ayarlanan değer, varsayılan ayarı geçersiz kılar ve uygulama çalıştırmalarında devam eder. Kullanıcı uygulamayı kapatıp yeniden açsa bile setConsent yeniden çağrılana kadar değer bu durumda kalır. setConsent yalnızca belirttiğiniz parametreleri günceller.
Bir kullanıcı daha önce Analytics veya reklam depolama için verdiği izni geri çekerse Google Analytics, ad_personalization izni de dahil olmak üzere tüm kullanıcı özelliklerini siler.
Kullanıcının reklam kişiselleştirmeyle ilgili izin seçimini korumak için setConsent
(Kotlin+KTX
| Java)
kullanarak reklam kişiselleştirmenin önceki değerini geri yükleyin.
Aşağıdaki örnekte, farklı izin değerlerini granted olarak güncelleyen setConsent yöntemi gösterilmektedir:
Java
// Set consent types.
Map<ConsentType, ConsentStatus> consentMap = new EnumMap<>(ConsentType.class);
consentMap.put(ConsentType.ANALYTICS_STORAGE, ConsentStatus.GRANTED);
consentMap.put(ConsentType.AD_STORAGE, ConsentStatus.GRANTED);
consentMap.put(ConsentType.AD_USER_DATA, ConsentStatus.GRANTED);
consentMap.put(ConsentType.AD_PERSONALIZATION, ConsentStatus.GRANTED);
mFirebaseAnalytics.setConsent(consentMap);
Bir kullanıcı iznini iptal etmeye karar verirse izin durumlarını buna göre güncellediğinizden
İzin modu v2'ye yükseltme
Google'ın gizlilik açısından güvenli dijital reklamcılık ekosistemine yönelik devam eden taahhüdü kapsamında, AB kullanıcı rızası politikamızın yaptırımını daha sıkı hale getiriyoruz.
Android Studio logcat'te Setting
consent ile başlayan günlük mesajını bulun. Örneğin, Reklam depolama alanı etkinse aşağıdaki günlük mesajını görürsünüz:
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2024-11-09 UTC."],[[["\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."]]