Fence
Fence 介面是 Fenced Frame API 的一部分,其中包含幾個與 <fencedframe> 功能相關的函式。
Fence 物件可以透過 Window.fence 屬性訪問,但它們僅對嵌入在 <fencedframe>(透過 FencedFrameConfig 載入)或 <iframe>(透過不透明 URN 載入)中的文件可用。
注意:有關 FencedFrameConfig 和不透明 URN 的說明,請參閱 <fencedframe> 如何工作?。
例項方法
getNestedConfigs()實驗性-
返回載入到當前
<fencedframe>中嵌入的<fencedframe>的FencedFrameConfig。 reportEvent()實驗性-
觸發透過 信標 向一個或多個透過
registerAdBeacon()方法(來自 Protected Audience API)註冊的特定 URL 提交報告資料,用於收集廣告競價結果。 setReportEventDataForAutomaticBeacons()實驗性-
指定當
<fencedframe>發生導航時將傳送的事件資料。這些資料將透過自動信標傳送到一個或多個透過registerAdBeacon()方法(來自 Protected Audience API)註冊的特定 URL,用於收集廣告競價結果的報告資料。
示例
js
window.fence.reportEvent({
eventType: "click",
eventData: JSON.stringify({ clickX: "123", clickY: "456" }),
destination: ["buyer", "seller"],
});
規範
| 規範 |
|---|
| 圍欄框架 # fence-interface |
瀏覽器相容性
載入中…
另見
- privacysandbox.google.com 上的Fenced frames
- 隱私沙盒(位於 privacysandbox.google.com)