Başlama

Google Kullanıcı Mesajlaşma Platformu (UMP) SDK'sı, gizlilik seçeneklerini yönetmenize yardımcı olur. Daha fazla bilgi için bkz. . Gizlilik ve Hakkında . .

Mesaj türü oluşturma

Kullanıcı mesajlarını Kullanılabilir kullanıcı mesajı türleri Gizlilik ve mesajlaşma Reklam Yöneticisi hesap. UMP SDK'sı bir uygulama kimliğinden oluşturulan Ad Manager gizlilik mesajı birçok yolu vardır.

Daha fazla bilgi için bkz. . Gizlilik ve mesajlaşma hakkında

Uygulama kimliğini ekleyin

Uygulama kimliğinizi şurada bulabilirsiniz: . Ad Manager kullanıcı arayüzü. . Kimliği aşağıdaki kod snippet'i ile:

Her uygulamada kullanıcının rıza bilgilerinin güncellenmesini istemelisiniz. Update()kullanarak başlat. Bu istek, şu:

  • İzin gerekip gerekmediği. Örneğin, veya önceki rıza kararının süresinin dolduğu anlamına gelir.
  • Gizlilik seçenekleri giriş noktasının gerekli olup olmadığı. Bazı gizlilik mesajları uygulamaların, kullanıcıların gizlilik seçeneklerini istedikleri zaman değiştirmesine izin vermesini zorunlu kılmak.

Uygulama başlangıcında durumun nasıl kontrol edileceğine ilişkin bir örneği aşağıda bulabilirsiniz:

void Start()
{
    // Create a ConsentRequestParameters object.
    ConsentRequestParameters request = new ConsentRequestParameters();

    // Check the current consent information status.
    ConsentInformation.Update(request, OnConsentInfoUpdated);
}

void OnConsentInfoUpdated(FormError consentError)
{
    if (consentError != null)
    {
        // Handle the error.
        UnityEngine.Debug.LogError(consentError);
        return;
    }

    // If the error is null, the consent information state was updated.
    // You are now ready to check if a form is available.
}

Gerekirse bir gizlilik mesajı formu yükleyin ve gösterin

En güncel izin durumunu aldıktan sonra LoadAndShowConsentFormIfRequired() tüm formları kullanıcı izni almanız gerekir. Yüklemenin ardından formlar hemen görünür.

void Start()
{
    // Create a ConsentRequestParameters object.
    ConsentRequestParameters request = new ConsentRequestParameters();

    // Check the current consent information status.
    ConsentInformation.Update(request, OnConsentInfoUpdated);
}

void OnConsentInfoUpdated(FormError consentError)
{
    if (consentError != null)
    {
        // Handle the error.
        UnityEngine.Debug.LogError(consentError);
        return;
    }

    // If the error is null, the consent information state was updated.
    // You are now ready to check if a form is available.
    ConsentForm.LoadAndShowConsentFormIfRequired((FormError formError) =>
    {
        if (formError != null)
        {
            // Consent gathering failed.
            UnityEngine.Debug.LogError(consentError);
            return;
        }

        // Consent has been gathered.
    });
}

Kullanıcı seçim yaptıktan veya kapatıldıktan sonra herhangi bir işlem yapmanız gerekirse mantığını Action<FormError> callbackbölümüne yerleştirin. seçin.

Gizlilik seçenekleri

Bazı gizlilik mesajı formları, yayıncı tarafından oluşturulan bir gizlilikten sunulur seçenekleri giriş noktasından yararlanarak kullanıcıların gizlilik seçeneklerini istedikleri zaman yönetmelerine olanak tanıyor. Kullanıcılarınızın gizlilik seçeneklerinde hangi mesajı gördüğü hakkında daha fazla bilgi edinmek için giriş noktası, bkz. . Kullanılabilir kullanıcı mesajı türleri.

Gizlilik seçenekleri giriş noktası uygulamak için aşağıdaki adımları tamamlayın:

  1. Çek PrivacyOptionsRequirementStatus.
  2. Gizlilik seçenekleri giriş noktası Uygulamanıza görünür ve etkileşimde bulunulabilir bir kullanıcı arayüzü öğesi ekleyin.
  3. Gizlilik seçenekleri formunu şu komutla tetikleyin: ShowPrivacyOptionsForm()

Aşağıdaki kod örneğinde bu adımlar gösterilmektedir:

[SerializeField, Tooltip("Button to show the privacy options form.")]
private Button _privacyButton;

private void Start()
{
  // Enable the privacy settings button.
  if (_privacyButton != null)
  {
      _privacyButton.onClick.AddListener(UpdatePrivacyButton);
      // Disable the privacy settings button by default.
      _privacyButton.interactable = false;
  }
}

/// <summary>
/// Shows the privacy options form to the user.
/// </summary>
public void ShowPrivacyOptionsForm()
{
    Debug.Log("Showing privacy options form.");

    ConsentForm.ShowPrivacyOptionsForm((FormError showError) =>
    {
        if (showError != null)
        {
            Debug.LogError("Error showing privacy options form with error: " + showError.Message);
        }
        // Enable the privacy settings button.
        if (_privacyButton != null)
        {
            _privacyButton.interactable =
                ConsentInformation.PrivacyOptionsRequirementStatus ==
                PrivacyOptionsRequirementStatus.Required;
        }
    });
}

Reklam isteğinde bulun

Uygulamanızda reklam isteğinde bulunmadan önce izin alıp almadığınızı kontrol edin kullanan kullanıcıdan. İki tür izin alınırken kontrol edilecek yerler:

  • Mevcut oturumda izin alındıktan sonra.
  • Update()adlı kişiyi aramanızın hemen ardından. Önceki oturumda izin alınmış olabilir. Gecikme olarak en iyi uygulama olarak, geri arama işleminin tamamlanmasını beklememenizi öneririz. Uygulamanız kullanıma sunulduktan hemen sonra reklam yüklemeye başlamanızı öneririz.

İzin alma sürecinde bir hata oluşursa reklam isteğinde bulunmayı deneyin. UMP SDK'sı, Search Ads 360'ta önceki kabul edilir.

void Start()
{
    // Create a ConsentRequestParameters object.
    ConsentRequestParameters request = new ConsentRequestParameters();

    // Check the current consent information status.
    ConsentInformation.Update(request, OnConsentInfoUpdated);
}

void OnConsentInfoUpdated(FormError consentError)
{
    if (consentError != null)
    {
        // Handle the error.
        UnityEngine.Debug.LogError(consentError);
        return;
    }

    // If the error is null, the consent information state was updated.
    // You are now ready to check if a form is available.
    ConsentForm.LoadAndShowConsentFormIfRequired((FormError formError) =>
    {
        if (formError != null)
        {
            // Consent gathering failed.
            UnityEngine.Debug.LogError(consentError);
            return;
        }

        // Consent has been gathered.
        if (ConsentInformation.CanRequestAds())
        {
            MobileAds.Initialize((InitializationStatus initstatus) =>
            {
              // TODO: Request an ad.
            });
        }
    });
    
}

Test

Geliştirme sürecinde uygulamanızdaki entegrasyonu test etmek isterseniz bu adımları izleyerek test cihazınızı programlı olarak kaydedin. Etiketinizi kaldırdığınızda uygulamanızı yayınlamadan önce bu test cihazı kimliklerini belirleyen koddur.

  1. Update()numaralı telefonu arayın.
  2. Aşağıdaki örneğe benzer bir mesaj için günlük çıkışını kontrol edin: cihaz kimliğinizi ve test cihazı olarak nasıl ekleyeceğinizi gösterir:

    Android

    Use new ConsentDebugSettings.Builder().addTestDeviceHashedId("33BE2250B43518CCDA7DE426D04EE231")
    to set this as a debug device.
    

    iOS

    <UMP SDK>To enable debug mode for this device,
    set: UMPDebugSettings.testDeviceIdentifiers = @[2077ef9a63d2b398840261c8221a0c9b]
    
  3. Test cihazınızın kimliğini panoya kopyalayın.

  4. Kodunuzu şu şekilde değiştirin: için DebugGeography.TestDeviceHashedIds ve pas test cihazı kimliklerinizin listesi.

    void Start()
    {
        var debugSettings = new ConsentDebugSettings
        {
            TestDeviceHashedIds =
            new List<string>
            {
                "TEST-DEVICE-HASHED-ID"
            }
        };
    
        // Create a ConsentRequestParameters object.
        ConsentRequestParameters request = new ConsentRequestParameters
        {
            ConsentDebugSettings = debugSettings,
        };
    
        // Check the current consent information status.
        ConsentInformation.Update(request, OnConsentInfoUpdated);
    }
    

Bir coğrafi bölgeyi zorunlu kılın

UMP SDK'sı, uygulamanızın davranışını cihaz sanki AEA veya Birleşik Krallık'ta the DebugGeography field on ConsentDebugSettingskullanarak bulabilirsiniz. Lütfen Hata ayıklama ayarları yalnızca test cihazlarında çalışır.

void Start()
{
    var debugSettings = new ConsentDebugSettings
    {
        // Geography appears as in EEA for debug devices.
        DebugGeography = DebugGeography.EEA,
        TestDeviceHashedIds = new List<string>
        {
            "TEST-DEVICE-HASHED-ID"
        }
    };

    // Create a ConsentRequestParameters object.
    ConsentRequestParameters request = new ConsentRequestParameters
    {
        ConsentDebugSettings = debugSettings,
    };

    // Check the current consent information status.
    ConsentInformation.Update(request, OnConsentInfoUpdated);
}

Uygulamanızı UMP SDK'sı ile test ederken kullanıcının ilk yükleme deneyimini simüle edebilmek için SDK durumunu kontrol edin. SDK, bunu yapmak için Reset() yöntemini sağlar.

ConsentInformation.Reset();

GitHub'daki örnekler