This feature is not Baseline because it does not work in some of the most widely-used browsers.
Experimental: This is an experimental technology
Check the Browser compatibility table carefully before using this in production.
The setReportEventDataForAutomaticBeacons() method of the Fence interface 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 the registerAdBeacon() method of the Protected Audience API, for the purpose of collecting reporting data for ad auction results.
Note: reportEvent() provides similar report data submission, except in that case the submission is triggered via an explicit method call rather than a navigation.
setReportEventDataForAutomaticBeacons(event)
eventan object representing the data to send. The possible properties are as follows:
eventTypeA string representing the type of event that is being reported. The available values are:
reserved.top_navigation_start: An event fired when a top-level navigation begins.reserved.top_navigation_commit: An event fired when a top-level navigation completes.eventDataA string representing the data to be sent.
destinationAn array containing one or more enumerated values representing destination types. These are the involved parties that will receive the data to their registered URLs (i.e., via registerAdBeacon()). The possible values are:
"buyer": The bidder in the ad auction."seller": The top-level seller running the ad auction."component-seller": The seller for a component auction in a multi-level auction."direct-seller": The seller that directly ran the auction the buyer bid in. If the ad was a single-level auction, the value used will be "seller". If the ad was a multi-level auction, the value used will be "component-seller"."shared-storage-select-url": A Shared Storage API storage location, as defined in a Window.sharedStorage.selectURL() method call.once OptionalA boolean value. If set to true, the automatic beacon will only be sent for the next event, and beacons will not be sent for subsequent events until setReportEventDataForAutomaticBeacons() is invoked again. For example, when used with a click handler this can be used to send beacon data only for specific top-level navigations, rather than for every top-level navigation. This property defaults to false.
None (Undefined).
window.fence.setReportEventDataForAutomaticBeacons({
eventType: "reserved.top_navigation_start",
eventData: "an example string",
destination: ["seller", "buyer"],
});
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | WebView on iOS | |
setReportEventDataForAutomaticBeacons |
126 | 126 | No | 112 | No | 126 | No | 83 | No | 28.0 | 126 | No |
start_commit_eventType |
126Previously only a singleeventType was available, reserved.top_navigation, but this has been replaced by the new values. |
126Previously only a singleeventType was available, reserved.top_navigation, but this has been replaced by the new values. |
No | 112Previously only a singleeventType was available, reserved.top_navigation, but this has been replaced by the new values. |
No | 126Previously only a singleeventType was available, reserved.top_navigation, but this has been replaced by the new values. |
No | 83Previously only a singleeventType was available, reserved.top_navigation, but this has been replaced by the new values. |
No | 28.0Previously only a singleeventType was available, reserved.top_navigation, but this has been replaced by the new values. |
126Previously only a singleeventType was available, reserved.top_navigation, but this has been replaced by the new values. |
No |
© 2005–2025 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/Fence/setReportEventDataForAutomaticBeacons