Fence: reportEvent() method

Limited availability

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 reportEvent() method of the Fence interface triggers the submission of report data via a beacon to one or more specific URLs registered via the registerAdBeacon() method of the Protected Audience API, for the purpose of collecting ad auction results.

Note: setReportEventDataForAutomaticBeacons() provides similar report data submission, except in that case the submission is triggered via a navigation rather than by an explicit method call.

Syntax

js
reportEvent(event)

Parameters

event

An object or string representing the data to send.

  • An object value defines a specific report event that you want to send. The required properties are as follows:
    eventType

    A string representing the type of event that is being reported — for example you might be interested in how many times an ad is clicked on. This string can be any relevant event name (for example click). This needs to match the event type specified in the associated registerAdBeacon() call in a Protected Audience API worklet.

    eventData

    A string representing the data to be sent.

    destination

    An 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.
  • A string value represents an 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 PrivateAggregation.contributeToHistogramOnEvent()) to be sent.

Return value

None (Undefined).

Examples

js
window.fence.reportEvent({
  eventType: "click",
  eventData: JSON.stringify({ clickX: "123", clickY: "456" }),
  destination: ["buyer", "seller"],
});

Specifications

Specification
Fenced Frame
# dom-fence-reportevent

Browser compatibility

desktop mobile
Chrome
Edge
Firefox
Opera
Safari
Chrome Android
Firefox for Android
Opera Android
Safari on iOS
Samsung Internet
WebView Android
WebView on iOS
reportEvent
Experimental
Chrome – Full support
Chrome 126 (Release date: 2024-06-11)
footnote Full support
Edge – Full support
Edge 126 (Release date: 2024-06-13)
footnote Full support
Firefox – No support
Firefox
footnote No support
Opera – Full support
Opera 112 (Release date: 2024-07-11)
footnote Full support
Safari – No support
Safari
footnote No support
Chrome Android – Full support
Chrome Android 126 (Release date: 2024-06-11)
footnote Full support
Firefox for Android – No support
Firefox for Android
footnote No support
Opera Android – Full support
Opera Android 83 (Release date: 2024-06-25)
footnote Full support
Safari on iOS – No support
Safari on iOS
footnote No support
Samsung Internet – Full support
Samsung Internet 28 (Release date: 2025-04-02)
footnote Full support
WebView Android – Full support
WebView Android 126 (Release date: 2024-06-11)
footnote Full support
WebView on iOS – No support
WebView on iOS
footnote No support

Legend

Tip: you can click/tap on a cell for more information.

Full support
Full support
No support
No support
Experimental. Expect behavior to change in the future.

See also