SDK'larla ilgili Google Geliştirici Kılavuzları'na göz atın:
Google izin modu SDK işlevselliği
Genel SDK gereksinimleri ve uygulama için bu belgenin başındaki kılavuzlara bakın. Gizlilik ve Mesajlaşma'nın kullanıcı rızası modu desteğini etkinleştirdiyseniz burada ele alınan ek işlevleri de uygulamak isteyebilirsiniz.
İzin modu: temel mod desteği
İlgili SDK'yı uyguladıktan, Gizlilik ve Mesajlaşma bölümünde Google izin modunu etkinleştirdikten ve temel izin modunu uygulayacağınızı belirledikten sonra aşağıdaki talimatları uygulayın.
Temel modu uygulamak için:
- Analytics toplama özelliğini geçici olarak devre dışı bırakın (Android, iOS).
- Google Analytics işlevinin engellemesini kaldırmaya hazır olduğunuzda Analytics toplama özelliğini yeniden etkinleştirin (Android, iOS).
2. adımda, Analytics işlevini yeniden etkinleştirme ölçütlerinizi belirlemek için bir hukuk uzmanına danışın.
Örneğin, kullanıcı izin seçimini yaptıktan sonra loadAndShowConsentFormIfRequired geri çağırmasında Google Analytics işlevselliğini yeniden etkinleştirerek Google Analytics işlevselliğini yeniden etkinleştirebilirsiniz (API referansı: Android, iOS).
Alternatif olarak, kullanıcının izin modu tercihlerine göre Analytics toplama özelliğinin yeniden etkinleştirilip etkinleştirilmeyeceğini belirlemek için UMP_consentModeValues yerel depolama anahtarını okuyun. Değer, dört haneli bir dizedir.
- İlk rakam, ad_storage amacı değerini gösterir.
- İkinci rakam, ad_user_data amacı değerini gösterir.
- Üçüncü rakam, ad_personalization amacının değerini gösterir.
- Dördüncü rakam, analytics_storage amacı değerini gösterir.
Aşağıdaki tabloda her bir rakam için olası değerler açıklanmıştır:
| Değer | Anlamı |
|---|---|
0 |
Henüz değer yok. |
1 |
Kullanıcı, bu amaç için GRANTED. |
2 |
Kullanıcı, bu amaç için DENIED. |
3 |
İzin modu bu kullanıcı için geçerli değildir. |
4 |
İzin modu bu amaç için yapılandırılmamış. |
Aşağıdaki örnekte UMP_consentModeValues ayrıştırılır, tüm amaçlar GRANTED ise veya geçerli değilse Google Analytics etkinleştirilir, aksi takdirde Analytics toplama devre dışı bırakılır:
Java
// Helper function that sets Analytics collection based on the value of the
// UMP_consentModeValues local storage key.
private void maybeReEnableAnalyticsCollection() {
String consentModeValues = sharedPreferences.getString("UMP_consentModeValues", null);
if (shouldReEnableAnalyticsCollection(consentModeValues)) {
firebaseAnalytics.setAnalyticsCollectionEnabled(true);
} else {
firebaseAnalytics.setAnalyticsCollectionEnabled(false);
}
}
// Helper function to determine whether Analytics collection should be enabled. Returns true
// if all consent mode values are either granted, not applicable, or not configured.
private boolean shouldReEnableAnalyticsCollection(String consentModeValues) {
if (consentModeValues.isEmpty()) {
return false;
}
for (int i = 0; i < consentModeValues.length(); i++) {
char consentModeValue = consentModeValues.charAt(i);
switch (consentModeValue) {
case '0':
// Consent mode data not ready yet.
return false;
case 1:
// Consent mode is granted for this purpose.
break;
case '2':
// Consent is denied for this consent mode purpose.
return false;
case '3':
// Consent does not apply for this purpose at this time.
break;
case '4':
// Consent mode is not configured for this purpose.
break;
default:
// Unexpected value encountered.
return false;
}
}
// If all checks pass, re-enable Analytics collection.
return true;
}
Kotlin
// Helper function that may re-enable Analytics collection based on the value of the
// UMP_consentModeValues local storage key.
private fun maybeReEnableAnalyticsCollection() {
val consentModeValues = sharedPreferences.getString("UMP_consentModeValues", null)
if (shouldReEnableAnalyticsCollection(consentModeValues)) {
firebaseAnalytics.setAnalyticsCollectionEnabled(true)
}
}
// Helper function to determine whether Analytics collection should be re-enabled. Returns true
// if all consent mode values are either granted, not applicable, or not configured.
private fun shouldReEnableAnalyticsCollection(consentModeValues: String?): Boolean {
if (consentModeValues.isNullOrEmpty()) {
return false
}
for (consentModeValue in consentModeValues) {
when (consentModeValue) {
'0' -> {
// Consent mode data not ready yet.
return false
}
'1' -> {
// Consent mode is granted for this purpose.
}
'2' -> {
// Consent is denied for this consent mode purpose.
return false
}
'3' -> {
// Consent does not apply for this purpose at this time.
}
'4' -> {
// Consent mode is not configured for this purpose.
}
else -> {
// Unexpected value encountered.
return false
}
}
}
// If all checks pass, can re-enable Analytics collection.
return true
}
Swift
// Helper function that may re-enable Analytics collection based on the value of the
// UMP_consentModeValues local storage key.
private func maybeReEnableAnalyticsCollection() {
let consentModeValues = userDefaults.string(forKey: "UMP_consentModeValues")
if shouldReEnableAnalyticsCollection(consentModeValues) {
Analytics.setAnalyticsCollectionEnabled(true)
}
}
// Helper function to determine whether Analytics collection should be re-enabled. Returns true
// if all consent mode values are either granted, not applicable, or not configured.
private func shouldReEnableAnalyticsCollection(_ consentModeValues: String?) -> Bool {
guard let consentModeValues = consentModeValues, !consentModeValues.isEmpty else {
return false
}
for consentModeValue in consentModeValues {
switch consentModeValue {
case "0":
// Consent mode data not ready yet.
return false
case "1":
// Consent mode is granted for this purpose.
break
case "2":
// Consent is denied for this consent mode purpose.
return false
case "3":
// Consent does not apply for this purpose at this time.
break
case "4":
// Consent mode is not configured for this purpose.
break
default:
// Unexpected value encountered.
return false
}
}
// If all checks pass, can re-enable Analytics collection.
return true
}
Objective-C
// Helper function that may re-enable Analytics collection based on the value of the
// UMP_consentModeValues local storage key.
- (void)maybeReEnableAnalyticsCollection {
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
NSString *consentModeValues = [defaults stringForKey:@"UMP_consentModeValues"];
if ([self shouldReEnableAnalyticsCollection:consentModeValues]) {
[FIRAnalytics setAnalyticsCollectionEnabled:YES];
}
}
// Helper function to determine whether Analytics collection should be re-enabled. Returns true
// if all consent mode values are either granted, not applicable, or not configured.
- (BOOL)shouldReEnableAnalyticsCollection:(NSString *)consentModeValues {
if (!consentModeValues || [consentModeValues length] == 0) {
return NO;
}
for (NSUInteger i = 0; i < [consentModeValues length]; i++) {
unichar consentModeValue = [consentModeValues characterAtIndex:i];
switch (consentModeValue) {
case '0':
// Consent mode data not ready yet.
return NO;
case '1':
// Consent mode is granted for this purpose.
break;
case '2':
// Consent is denied for this consent mode purpose.
return NO;
case '3':
// Consent does not apply for this purpose at this time.
break;
case '4':
// Consent mode is not configured for this purpose.
break;
default:
// Unexpected value encountered.
return NO;
}
}
// If all checks pass, can re-enable Analytics collection.
return YES;
}
maybeReEnableAnalyticsCollection numaralı telefonu şu durumlarda arayın:
- izin bilgileri güncellenir
- izin alınır.