docs.rodeo

MDN Web Docs mirror

Attribution-Reporting-Register-Source

{{HTTPSidebar}} {{seecompattable}} 

The HTTP Attribution-Reporting-Register-Source {{Glossary("response header")}}  registers a page feature as an attribution source. This header is included as part of a response to a request that contains the {{HTTPHeader("Attribution-Reporting-Eligible")}}  header. It provides the information that the browser should store when a user interacts with the attribution source. The information you include in this header also determines the types of reports the browser can generate.

See the Attribution Reporting API for more details.

[!NOTE] If the calling site does not have the Attribution Reporting API included in a successful privacy sandbox enrollment process, the Attribution-Reporting-Register-Source header is ignored and attribution sources are not registered.

Header type `{{Glossary("Response header")}}` 
`{{Glossary("Forbidden header name")}}`  No
`{{Glossary("CORS-safelisted response header")}}`  No

Syntax

Attribution-Reporting-Register-Source: <json-string>

Directives

Examples

Registering a source for an event-level report

A Node.js server might set the Attribution-Reporting-Register-Source response header as follows to make a browser generate an event-level report when a trigger is matched to a source:

res.set(
  "Attribution-Reporting-Register-Source",
  JSON.stringify({
    source_event_id: "412444888111012",
    destination: "https://shop.example",
    trigger_data: [0, 1, 2, 3, 4],
    trigger_data_matching: "exact",
    expiry: "604800",
    priority: "100",
    debug_key: "122939999",
    event_report_window: "86400",
  }),
);

Registering a source for a summary report

To make the browser generate a summary report when a trigger is matched to a source, you need to include some extra fields, in addition to those required for event-level report generation.

res.set(
  "Attribution-Reporting-Register-Source",
  JSON.stringify({
    source_event_id: "412444888111012",
    destination: "https://shop.example",
    trigger_data: [0, 1, 2, 3, 4],
    trigger_data_matching: "exact",
    expiry: "604800",
    priority: "100",
    debug_key: "122939999",
    event_report_window: "86400",

    aggregation_keys: {
      campaignCounts: "0x159",
      geoValue: "0x5",
    },
    aggregatable_report_window: "86400",
  }),
);

Specifications

{{Specifications}} 

Browser compatibility

{{Compat}} 

See also

In this article

View on MDN