指定目標


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

必要條件

  • 完成「開始使用」

RequestConfiguration

RequestConfiguration 是一個結構體,用於收集目標對象資訊,以便透過 SetRequestConfiguration() 全域函式套用至全域。

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

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

  // .. apply your changes, then:

  firebase::gma::SetRequestConfiguration(request_configuration);

兒童導向設定

為遵守《兒童網路隱私保護法》(COPPA),我們提供「將廣告請求標記為兒童導向內容」設定。設定這個標記即表示您確認這項通知正確無誤,而且您有權代表應用程式擁有者採取行動。您瞭解濫用這項設定可能會導致 Google 帳戶遭到終止。

如果您是應用程式開發人員,則可指明是否希望 Google 在您提出廣告請求時將內容視為兒童導向內容。如果您指明希望 Google 將內容視為兒童導向內容,我們會採取相應措施,針對該廣告請求停用按照興趣顯示的廣告和再行銷廣告。

如要設定這項設定,請將 RequestConfiguration 結構體的 tag_for_child_directed_treatment 成員指派給下列其中一個列舉值:

  • RequestConfiguration::tag_for_child_directed_treatment 指派給 RequestConfiguration::kChildDirectedTreatmentTrue,指明您希望內容視為兒童導向內容並接受 COPPA 規範。
  • 指派 RequestConfiguration::tag_for_child_directed_treatmentRequestConfiguration::kChildDirectedTreatmentFalse,表示您不希望內容視為兒童導向內容並接受 COPPA 規範。
  • 如果您不想在廣告請求中指出希望如何根據 COPPA 處理內容,請指派 RequestConfiguration::tag_for_child_directed_treatmentRequestConfiguration::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 帳戶遭到終止。

您可以替廣告請求設定未滿法定同意年齡的歐洲經濟區使用者標記。這項功能的立意是協助發布商遵守《一般資料保護規則》(GDPR)。請注意,您可能還有 GDPR 所衍生的其他法律義務。請查看歐盟發布的指南並諮詢您的法律顧問。提醒您,Google 提供工具的用意是協助發布商遵守規定,而非方便發布商規避法定義務。進一步瞭解 GDPR 對發布商的影響

使用這項功能時,廣告請求會包含「未滿法定同意年齡的歐洲使用者標記」(TFUA) 參數。這個參數會針對所有廣告請求停用個人化廣告功能 (包括再行銷),並且停止向第三方廣告供應商 (例如廣告評估像素和第三方廣告伺服器) 提出其他請求。

與兒童導向設定類似,RequestConfiguration 中也有一個成員可設定 TFUA 參數:tag_for_under_age_of_consent,可使用下列列舉值設定:

  • RequestConfiguration::tag_for_under_age_of_consent 指派給 RequestConfiguration::kUnderAgeOfConsentTrue,表示您希望廣告請求針對歐洲經濟區境內未滿規定年齡的使用者,採取相關處理模式。
  • RequestConfiguration::tag_for_under_age_of_consent 指派給 RequestConfiguration::kUnderAgeOfConsentFalse,表示您不希望針對歐洲經濟區 (EEA) 境內未滿規定年齡的使用者處理廣告請求。
  • 指派 RequestConfiguration::tag_for_under_age_of_consentRequestConfiguration::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();