廣告和第一方 ID 設定受限

如果使用者不同意分享個人資料,應用程式可透過放送受限制的廣告。受限制的廣告模式會停止收集、分享及使用個人資料,以利廣告選擇。如果使用者選擇不分享個人資料,這項功能可讓廣告繼續放送。

本指南說明如何在應用程式中使用受限制的廣告設定,以及如何讓應用程式行為符合 Google Ad Manager 聯播網的通用設定。

設定用戶端受限制的廣告設定

PAL 1.109.0 版導入了 forceLimitedAds 屬性,並移除了 allowStorage 屬性。這個屬性位於 ConsentSettings 類別中。

從 1.109.0 版開始,PAL 會從裝置讀取資訊公開和同意聲明架構 (TCF) 資料,判斷使用者是否同意將資料儲存於本機。先前,應用程式必須負責判斷儲存空間同意聲明。應用程式仍須在廣告代碼網址中傳遞 gdpr=gdpr_consent= 參數。

如果自動判斷結果不夠準確,請直接在應用程式中設定 forceLimitedAds 屬性。詳情請參閱「發布商的『歐洲 IAB 資訊公開和同意聲明架構』整合作業」一文。 將 forceLimitedAds 屬性設為 true 值,可防止 PAL 在傳送至伺服器的 Nonce 中儲存或傳送使用者 ID。將 forceLimitedAds 屬性設為 true 值,等同於在 IMA (互動式媒體廣告) SDK 中,將 ltd=1 參數新增至廣告請求網址。如要瞭解受限制的廣告,請參閱ltd (受限制的廣告)。將 forceLimitedAds 屬性設為 true 值時,PAL 會在隨機數中加入 ltd=1 參數。

如要讓應用程式維持目前的行為,即使先前未設定 allowStorage 屬性,也可能需要更新實作方式。allowStorage 屬性預設為 false 值,這會啟用受限制的廣告。forceLimitedAds 屬性預設為 false 值,不會啟用受限制的廣告。

比對 Google Ad Manager 全域設定

如果您更新 Ad Manager 設定「程式輔助受限制廣告」或「網站廣告第一方 Cookie」,請使用這些新 API 配合 Ad Manager 中的設定。如果您未使用 API,PAL 可能會在向伺服器發出的廣告請求中,將 ID 納入隨機碼。不過,Ad Manager 可能會根據 Ad Manager 中的設定捨棄信號。

API 如下:

  • disableLimitedAdsStorage - 停用無效流量偵測專用 Cookie, 並禁止受限制的廣告使用本機儲存空間。如果您在 Ad Manager 的「管理」>「通用設定」中更新了「程式輔助受限制廣告」設定,請使用這個 API 停用 PAL 中受限制的廣告的本機儲存空間。請注意,這項設定不適用於非受限制的廣告。
  • disableFirstPartyIdentifiers - 停用用於選擇廣告的第一方 ID。如果您在 Ad Manager 中更新了「網站廣告第一方 Cookie」設定 (位於「管理」>「通用」設定),請使用這個 API 在 PAL 中停用這類 ID。請注意,這項設定不適用於使用 Cookie 和本機儲存空間偵測無效流量。

以下範例說明如何在 PAL 實作中處理使用者隱私權和資料用量:

const consentSettings = new goog.pal.ConsentSettings();
consentSettings.allowStorage = true;
// During the PAL Phase 1 release, best practice is to always set the
// `allowStorage` property to a `true` value to allow PAL to automatically
// determine whether limited ads applies based on the TCF data.
// To enable limited ads regardless of the TCF determination, set the
// `forceLimitedAds` property to a `true` value.

const adManagerSettings = new goog.pal.GoogleAdManagerSettings();
// Add this line if the "Programmatic limited ads" toggle is turned off in
// Ad Manager.
adManagerSettings.disableLimitedAdsStorage = true;
// Add this line if the "First party cookies for ads on web" toggle
// is turned off in Ad Manager.
adManagerSettings.disableFirstPartyIdentifiers = true;

const nonceLoader = new goog.pal.NonceLoader(consentSettings, adManagerSettings);