瞭解如何運用 Topics 中的興趣資料,輸入 Protected Audience 出價和競價程序。Protected Audience 有幾個點,買方和賣方可以將第一方信號傳遞至出價和競價程序。系統可透過 Topics 提供的信號,充實出價和廣告選擇程序期間的可用資料,提供有關目前使用者興趣的資訊,提高廣告空間潛在價值。
閱讀本指南前,請務必熟悉 Topics 和 Protected Audience。
取得主題
呼叫 Topics API 時,呼叫端會看到先前針對該瀏覽器觀察到的精選主題。
const currentTopics = await document.browsingTopics();
// Example result
[
{
"configVersion": "chrome.2",
"modelVersion": "4",
"taxonomyVersion": "2",
"topic": 310,
"version": "chrome.2:2:4"
}
]
在這個案例中,主題為:310
對應至「運動/自行車」。
這些範例說明直接使用的主題值,但完整導入方式可以選擇處理這些值,或是與其他資料合併。
使用主題有條件地定義興趣群組
產生的主題可直接用來選擇將使用者加入興趣群組。
if (currentTopics[0].topic === 310) { // Interest in "Sports/Cycling"
const interestGroup = {
owner: 'https://dsp.example',
name: 'custom-bikes',
}
}
提供買家主題給興趣群組
建立興趣群組時,您可以將目前的主題 (或用主題處理的資料) 加入 userBiddingSignals
。這樣一來,買方就能在設定出價時使用主題。
const interestGroup = {
owner: 'https://dsp.example',
name: 'custom-bikes',
userBiddingSignals: {
topics: currentTopics,
....
},
...
};
navigator.joinAdInterestGroup(interestGroup, 7 * kSecsPerDay);
提供賣方主題參與競價
賣方目前能看到的主題 (或由賣方處理的資料) 在設定競價時,可能會與 auctionSignals
、sellerSignals
或 perBuyerSignals
合併使用。這樣一來,買方就能在出價時使用主題,也讓賣方在評分時使用主題。
const myAuctionConfig = {
seller: 'https://ssp.example',
auctionSignals: {
topics: currentTopics,
},
sellerSignals: {
topics: currentTopics,
},
perBuyerSignals: {
'https://dsp.example': {
topics: currentTopics,
// ...
},
// ...
},
// ...
};
const result = await navigator.runAdAuction(myAuctionConfig);
使用主題設定出價
之後,當呼叫買方的 generateBid()
函式時,傳入的記錄主題就能做為出價輔助 (就像信號中提供的任何其他資料一樣)。舉例來說,出價方可以運用「運動/自行車」主題,針對這個 custom-bikes
興趣群組提高出價。
generateBid(interestGroup, auctionSignals, perBuyerSignals,
trustedBiddingSignals, browserSignals) {
const topics = interestGroup.userBiddingSignals.topics;
// Use the topic values in the bidding logic.
}
使用主題評分
在呼叫賣方的 scoreAd()
函式時出價後,您便可使用記錄的主題,就像從競價設定傳入的任何其他資料一樣。舉例來說,賣方想要針對與偵測到的主題比對成功的廣告提高出價。
scoreAd(adMetadata, bid, auctionConfig, trustedScoringSignals, browserSignals, directFromSellerSignals) {
const sellerTopics = actionConfig.auctionSignals.topics;
// or corresponding key in sellerSignals
// use the topics values to score the ads
//...
}