files/en-us/web/api/fence/reportevent/index.md
{{SeeCompatTable}}{{APIRef("Fenced Frame API")}}
The reportEvent() method of the
{{domxref("Fence")}} interface triggers the submission of report data via a beacon to one or more specific URLs registered via the {{domxref("InterestGroupReportingScriptRunnerGlobalScope.registerAdBeacon", "registerAdBeacon()")}} method of the Protected Audience API, for the purpose of collecting ad auction results.
[!NOTE] {{domxref("Fence.setReportEventDataForAutomaticBeacons", "setReportEventDataForAutomaticBeacons()")}} provides similar report data submission, except in that case the submission is triggered via a navigation rather than by an explicit method call.
reportEvent(event)
event
eventType
click). This needs to match the event type specified in the associated {{domxref("InterestGroupReportingScriptRunnerGlobalScope.registerAdBeacon", "registerAdBeacon()")}} call in a Protected Audience API worklet.eventData
destination
"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 {{domxref("WindowSharedStorage.selectURL", "Window.sharedStorage.selectURL()")}} method call.eventType, for example "click" (see the earlier definition of eventType). When an eventType string is passed as the value of reportEvent(), it triggers all Private Aggregation contributions that were made conditional on that event type (for example via {{domxref("PrivateAggregation.contributeToHistogramOnEvent()")}}) to be sent.None (Undefined).
window.fence.reportEvent({
eventType: "click",
eventData: JSON.stringify({ clickX: "123", clickY: "456" }),
destination: ["buyer", "seller"],
});
{{Specifications}}
{{Compat}}