सुरक्षित ऑडियंस की मदद से, कस्टम ऑडियंस डेलिगेशन की सुविधा में शामिल होना

fetchAndJoinCustomAudience एपीआई, खरीदारों को उनके पार्टनर एमएमपी या एसएसपी की डिवाइस पर मौजूदगी का इस्तेमाल करके, कस्टम ऑडियंस में शामिल होने की अनुमति देता है.

खास जानकारी

इसके काम करने के तरीके के बारे में खास जानकारी यह है कि डिवाइस पर मौजूद कॉलर (चाहे वह MMP हो या SSP SDK टूल हो) कुछ ऐसा fetchAndJoinCustomAudienceRequest बनाता है जो कुछ ऐसा दिखता है:

Kotlin

/**
 * @param fetchUri The URL to retrieve the CA from.
 * (optional)@param name The name of the CA to join.
 * (optional)@param activationTime The time when the CA will activate.
 * (optional)@param expirationTime The time when the CA will expire,
    must be a time in the future otherwise this will fail
 * (optional)@param userBiddingSignals The user bidding signals used at auction.
*/

val request = FetchAndJoinCustomAudienceRequest.Builder(fetchUri)
    .setName(name)
    .setActivationTime(activationTime)
    .setExpirationTime(expirationTime)
    .setUserBiddingSignals(userBiddingSignals)
    .build()

Java

/**
 * @param fetchUri The URL to retrieve the CA from.
 * (optional)@param name The name of the CA to join.
 * (optional)@param activationTime The time when the CA will activate.
 * (optional)@param expirationTime The time when the CA will expire,
    must be a time in the future otherwise this will fail
 * (optional)@param userBiddingSignals The user bidding signals used at auction.
*/

FetchAndJoinCustomAudienceRequest request =
 new FetchAndJoinCustomAudienceRequest.Builder(fetchUri)
  .setName(name) //Optional
  .setActivationTime(activationTime) //Optional
  .setExpirationTime(expirationTime) //Optional
  .setUserBiddingSignals(userBiddingSignals) //Optional
  .build();

सभी वैकल्पिक पैरामीटर के बारे में एक ज़रूरी बात यह है कि अगर उन्हें फे़च करने के अनुरोध के अंदर सेट किया जाता है, तो खरीदार के डेटा से उनके डेटा को बदला नहीं जा सकता. इससे ऑन-डिवाइस कॉलर को यह ज़्यादा कंट्रोल मिलता है कि कस्टम ऑडियंस को कैसे बनाए रखा जाए.

fetchUri को खरीदार की ओर से ऑपरेट करने वाले सर्वर एंडपॉइंट पर ले जाना चाहिए, जो यहां दिखाए गए फ़ॉर्मैट से मेल खाने वाला कस्टम ऑडियंस JSON ऑब्जेक्ट देगा:

//Return a 200 response with data matching the format of the following in the body
{
  "daily_update_uri": "https://js.example.com/bidding/daily",
  "bidding_logic_uri": "https://js.example.com/bidding",
  "user_bidding_signals": {
    "valid": true,
    "arbitrary": "yes"
  },
  "trusted_bidding_data": {
    "trusted_bidding_uri": "https://js.example.com/bidding/trusted",
    "trusted_bidding_keys": [
      "key1",
      "key2"
    ]
  },
  "ads": [
    {
      "render_uri": "https://js.example.com/render/fetch_and_join_ad1",
      "metadata": {
        "valid": 1
      }
    },
    {
      "render_uri": "https://js.example.com/render/fetch_and_join_ad2",
      "metadata": {
        "valid": 2
      }
    }
  ]
}

एपीआई साइड पर इसके समाधान के तरीके के बारे में ज़्यादा जानकारी, सीए डेलिगेशन से जुड़ने के लिए डिज़ाइन प्रपोज़ल में मिल सकती है.

टेस्ट करना

क्लाइंट कोड के अंदर फ़ेच कॉल लागू करने और कस्टम ऑडियंस डेटा पाने के लिए डीएसपी पर एंडपॉइंट सेट अप करने के बाद, कस्टम ऑडियंस में शामिल होने के डेलिगेशन की जांच की जा सकती है. अपना ऐप्लिकेशन चलाने से पहले, प्राइवसी सैंडबॉक्स को चालू करने के लिए, आपको यूज़र इंटरफ़ेस (यूआई) खोलने के लिए यहां दिए गए कमांड को चलाना होगा:

adb shell am start -n com.google.android.adservices.api/com.android.adservices.ui.settings.activities.AdServicesSettingsMainActivity

यूज़र इंटरफ़ेस (यूआई) पॉप-अप होने के बाद, प्राइवसी सैंडबॉक्स को चालू करें. इसके बाद, डिवाइस को टेस्टिंग के लिए सेट अप करने की प्रोसेस पूरी करने के लिए, नीचे दिए गए ADB कमांड चलाएं:

adb shell device_config set_sync_disabled_for_tests persistent
adb shell device_config put adservices ppapi_app_signature_allow_list \"\*\"
adb shell device_config put adservices ppapi_app_allow_list \"\*\"
adb shell device_config put adservices adservice_system_service_enabled true
adb shell device_config put adservices adservice_enabled true
adb shell device_config put adservices adservice_enable_status true
adb shell device_config put adservices global_kill_switch false
adb shell device_config put adservices fledge_js_isolate_enforce_max_heap_size false
adb shell device_config put adservices fledge_custom_audience_service_kill_switch false
adb shell device_config put adservices fledge_select_ads_kill_switch false
adb shell device_config put adservices adid_kill_switch false
adb shell setprop debug.adservices.disable_fledge_enrollment_check true
adb shell device_config put adservices fledge_fetch_custom_audience_enabled true

इन निर्देशों को चलाने के बाद, आपको फ़ेच एपीआई का इस्तेमाल करके कॉल करना शुरू करना होगा.

इस फ़्लो का उदाहरण देखने के लिए, GitHub पर प्राइवसी सैंडबॉक्स सैंपल रिपॉज़िटरी की डेवलपर झलक दिखाने वाली ब्रांच में फ़ेच किए गए कॉल जोड़े गए.