本指南說明如何為廣告請求提供指定目標資訊。
先備知識
- 完成開始使用。
RequestConfiguration
RequestConfiguration
是一種結構,可收集要透過 SetRequestConfiguration()
全域函式在全域套用的指定目標資訊。
如要更新要求設定,請先取得目前的設定、執行任何需要的更新,然後依照以下方式設定:
firebase::gma::RequestConfiguration retrieved_configuration = firebase::gma::GetRequestConfiguration(); // .. apply your changes, then: firebase::gma::SetRequestConfiguration(request_configuration);
兒童導向設定
為符合《兒童網路隱私保護法 (COPPA)》的規範,系統提供了名為「tag for 兒童導向內容」的設定。設定這個標記,即表示您確認這項通知正確無誤,且您有權代表應用程式的擁有者行事。您瞭解濫用這項設定可能會導致您的 Google 帳戶遭到終止。
如果您是應用程式開發人員,則可指明是否希望 Google 在您提出廣告請求時將內容視為兒童導向內容。如果您表明希望 Google 將內容視為兒童導向內容,我們會採取措施,停用該廣告請求的 IBA 和再行銷廣告。
您可以將 RequestConfiguration
結構的 tag_for_child_directed_treatment
成員指派給下列其中一個列舉值,藉此進行設定:
- 將
RequestConfiguration::tag_for_child_directed_treatment
指派給RequestConfiguration::kChildDirectedTreatmentTrue
,代表您希望內容在 COPPA 中視為兒童導向內容。 - 將
RequestConfiguration::tag_for_child_directed_treatment
指派給RequestConfiguration::kChildDirectedTreatmentFalse
,代表您不希望內容在 COPPA 中視為兒童導向內容。 - 如果您不想在廣告請求中指出 Google 會根據 COPPA 將您的內容處理,請將
RequestConfiguration::tag_for_child_directed_treatment
指派給RequestConfiguration::kChildDirectedTreatmentUnspecified
。
以下範例表示您希望內容在符合 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
,表示您希望廣告請求不會收到未滿規定年齡歐洲經濟區 (EEA) 使用者適用的內容。 - 將
RequestConfiguration::tag_for_under_age_of_consent
指派給RequestConfiguration::kUnderAgeOfConsentUnspecified
,代表您尚未指定廣告請求是否應對歐洲經濟區未滿規定年齡的使用者採取治療措施。
以下舉例說明您想在廣告請求中加入 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();