web api interface
Fence
Limited availability
The Fence interface of the Fenced Frame API contains several functions relevant to <fencedframe> functionality.
Fence objects are accessed through the fence property, but they are only available to documents embedded inside <fencedframe>s (loaded via FencedFrameConfigs) or <iframe>s (loaded via opaque URNs).
[!NOTE] See How do
<fencedframe>s work? for some description aroundFencedFrameConfigs and opaque URNs.
Instance methods
getNestedConfigs()Experimental- : Returns the
FencedFrameConfigs loaded into<fencedframe>s embedded inside the current<fencedframe>.
- : Returns the
reportEvent()Experimental- : Triggers the submission of report data via a beacon to one ore more specific URLs registered via the
registerAdBeacon()method of the Protected Audience API, for the purpose of collecting ad auction results.
- : Triggers the submission of report data via a beacon to one ore more specific URLs registered via the
setReportEventDataForAutomaticBeacons()Experimental- : Specifies event data that will be sent when a navigation occurs inside a
<fencedframe>. This data will be sent via an automatic beacon to one or more specific URLs registered via theregisterAdBeacon()method of the Protected Audience API, for the purpose of collecting reporting data for ad auction results.
- : Specifies event data that will be sent when a navigation occurs inside a
Examples
window.fence.reportEvent({
eventType: "click",
eventData: JSON.stringify({ clickX: "123", clickY: "456" }),
destination: ["buyer", "seller"],
});
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.
See also
- Fenced frames on privacysandbox.google.com
- The Privacy Sandbox on privacysandbox.google.com