指定目標


本指南說明如何為廣告請求提供指定目標資訊。

先備知識

RequestConfiguration

RequestConfiguration 這個結構體會收集要下載的指定目標資訊 透過 SetRequestConfiguration() 全域函式套用全域

如要更新要求設定,請先取得目前的設定。 執行任何所需的更新,並依照下列方式設定:

  firebase::gma::RequestConfiguration retrieved_configuration =
    firebase::gma::GetRequestConfiguration();

  // .. apply your changes, then:

  firebase::gma::SetRequestConfiguration(request_configuration);

兒童導向設定

用於《兒童網路隱私保護法》 (COPPA)、 有一項設定是「標記為兒童導向內容」設定。透過設定 標記,即表示您保證這項通知正確無誤,且您有權 代表應用程式擁有者執行動作您瞭解濫用這項設定 我們可能會終止您的 Google 帳戶。

如果您是應用程式開發人員,則可指明是否希望 Google 將 內容標示為兒童導向內容。如果指定 您希望 Google 將您的內容視為兒童導向內容,我們會採取相應措施 收到該廣告請求的 IBA 和再行銷廣告。

您可以指派 tag_for_child_directed_treatment 個結構體中的「RequestConfiguration」成員到 下列其中一個列舉值:

  • 指派「RequestConfiguration::tag_for_child_directed_treatment」給 RequestConfiguration::kChildDirectedTreatmentTrue 表示您想要 您的內容將視為兒童導向內容,以符合 COPPA 規範
  • 指派「RequestConfiguration::tag_for_child_directed_treatment」給 RequestConfiguration::kChildDirectedTreatmentFalse 表示 不要在符合 COPPA 規範的情況下,將您的內容視為兒童導向內容。
  • 指派「RequestConfiguration::tag_for_child_directed_treatment」給 RequestConfiguration::kChildDirectedTreatmentUnspecified如果您不想 中表明,您希望內容在遵守 COPPA 時,應如何處置 廣告請求。

以下範例表示您希望內容 以 COPPA 規範為兒童導向內容:

  firebase::gma::RequestConfiguration request_configuration =
    firebase::gma::GetRequestConfiguration();

  request_configuration.tag_for_child_directed_treatment =
    firebase::RequestConfiguration::kChildDirectedTreatmentTrue;

  firebase::gma::SetRequestConfiguration(request_configuration);

設定這個代碼,即表示您確認這項通知正確無誤,而且 。您瞭解濫用 這麼做可能會導致您的 Google 帳戶遭到終止。

您可以為廣告請求設定歐盟地區使用者的處理方式 未滿規定年齡的歐洲經濟區 (EEA)。這項功能旨在 協助遵守《一般資料保護規則》 (GDPR)。 請注意,您可能也需要配合 GDPR 遵守其他法律義務;請參閱 歐盟的指示,並諮詢您的法律顧問。請 別忘了,Google 工具專為協助遵循法規而設計 解除任何特定發布商的法律義務。瞭解詳情 GDPR 對發布商的影響

使用這項功能時,會加上未滿法定同意年齡使用者的代碼 (TFUA) 參數此參數會停用 個人化廣告 (包括再行銷) 功能。此外, 停止向第三方廣告供應商 (例如廣告評估像素和 第三方廣告伺服器

與兒童導向設定一樣,RequestConfiguration 中有一個成員 設定 TFUA 參數 tag_for_under_age_of_consent,針對需要 使用下列列舉值:

  • 指派「RequestConfiguration::tag_for_under_age_of_consent」給 RequestConfiguration::kUnderAgeOfConsentTrue 表示您想要 廣告請求:接受歐洲經濟區 (EEA) 使用者的待遇 未滿規定年齡。
  • 指派「RequestConfiguration::tag_for_under_age_of_consent」給 RequestConfiguration::kUnderAgeOfConsentFalse 表示您想要 廣告請求不得接受歐洲經濟區境內使用者的待遇 (歐洲經濟區),未滿規定年齡。
  • 指派「RequestConfiguration::tag_for_under_age_of_consent」給 RequestConfiguration::kUnderAgeOfConsentUnspecified 表示 尚未指定廣告請求是否應針對使用者採取行動 未滿規定年齡的歐洲經濟區 (EEA) 使用者。

以下舉例說明您想在廣告請求中加入 TFUA:

  firebase::gma::RequestConfiguration request_configuration =
    firebase::gma::GetRequestConfiguration();

  request_configuration.tag_for_under_age_of_consent =
    firebase::RequestConfiguration::kUnderAgeOfConsentTrue;

  firebase::gma::SetRequestConfiguration(request_configuration);

用來啟用「兒童導向內容」設定和未滿規定年齡使用者的代碼 不可同時將兩者設為 true。如果是的話,影片就是兒童導向內容 設定的優先順序較高。

廣告素材篩選功能

應用程式可透過 RequestConfiguration::max_ad_content_rating field。AdMob 廣告傳回的時間 這個等級的內容分級等於或低於該層級。「可能性」 這個值是依據數位內容標籤分類,必須 下列其中一個列舉值:

  • RequestConfiguration::kMaxAdContentRatingG
  • RequestConfiguration::kMaxAdContentRatingPG
  • RequestConfiguration::kMaxAdContentRatingT
  • RequestConfiguration::kMaxAdContentRatingMA

下列程式碼會設定 RequestConfiguration 結構來指定廣告 傳回的內容應符合「否」這個數位內容標籤標示 高於 G:

  firebase::gma::RequestConfiguration request_configuration =
    firebase::gma::GetRequestConfiguration();

  request_configuration.max_ad_content_rating =
    firebase::RequestConfiguration::kMaxAdContentRatingG;

  firebase::gma::SetRequestConfiguration(request_configuration);

AdRequest

AdRequest 物件會收集要與廣告一併傳送的指定目標資訊 請求。

內容網址

請求廣告時,應用程式可能會傳遞所放送內容的網址。 這樣可以讓關鍵字指定功能比對廣告與內容。

舉例來說,假設應用程式在顯示 https://www.example.com 中,您可以傳送這個網址,指定相關關鍵字:

  // AdRequest with content URL:
  firebase::admob::AdRequest ad_request(/*content_url=*/"https://www.example.com");

  // AdRequest without content URL:
  firebase::admob::AdRequest ad_request();