files/en-us/web/http/reference/headers/attribution-reporting-register-trigger/index.md
{{deprecated_header}}
The HTTP Attribution-Reporting-Register-Trigger {{Glossary("response header")}} registers a page feature as an attribution trigger. This header is included as part of a response to a request that contains the {{HTTPHeader("Attribution-Reporting-Eligible")}} header.
See the Attribution Reporting API for more details.
<table class="properties"> <tbody> <tr> <th scope="row">Header type</th> <td>{{Glossary("Response header")}}</td> </tr> <tr> <th scope="row"> {{Glossary("CORS-safelisted response header")}} </th> <td>No</td> </tr> </tbody> </table>[!NOTE] If the calling site does not have the Attribution Reporting API included in a successful privacy sandbox enrollment process, the
Attribution-Reporting-Register-Triggerheader is ignored and attribution triggers are not registered.
Attribution-Reporting-Register-Trigger: <json-string>
<json-string>
"aggregatable_trigger_data"
"key_piece"
"source_keys"
"aggregatable_values"
"aggregatable_trigger_data". In each case, the property name is equal to the name defined in "source_keys", and the property value is whatever arbitrary value you require."debug_key" {{optional_inline}}
"debug_reporting" {{optional_inline}}
debug_key is set, set this to true to specify that the generated debug report should be a verbose debug report."filters" {{optional_inline}}
"event_trigger_data"
"trigger_data"
: A string representing data that describes the trigger, which is typically used to indicate events such as "user added item to shopping cart" or "user signed up to mailing list". This value will be included in the generated event-level report, if any, although it will be subject to modification based on the attributed source's "trigger_data_matching" field.
[!NOTE] The values used to represent each event, and the number of elements in the array, are completely arbitrary and defined by you as the developer. The array may contain values that are not used, but values must be present in the array to be attributed to the source by the browser when a trigger is registered.
"priority" {{optional_inline}}
2 takes priority over the default value of 1. See Report priorities and limits for more information."deduplication_key" {{optional_inline}}
"filters" {{optional_inline}}
"trigger_data", "priority", and "deduplication_key" based on the filter_data set in a corresponding {{HTTPHeader("Attribution-Reporting-Register-Source")}} header. See Filters for more information.A Node.js server might set the Attribution-Reporting-Register-Trigger response header as follows to register a trigger intended to match an event-level report attribution source:
res.set(
"Attribution-Reporting-Register-Trigger",
JSON.stringify({
event_trigger_data: [
{
trigger_data: "4",
priority: "1000000000000",
deduplication_key: "2345698765",
},
],
debug_key: "1115698977",
}),
);
When registering a trigger intended to match with a summary report attribution source, you need to include the following fields:
res.set(
"Attribution-Reporting-Register-Trigger",
JSON.stringify({
aggregatable_trigger_data: [
{
key_piece: "0x400",
source_keys: ["campaignCounts"],
},
{
key_piece: "0xA80",
source_keys: ["geoValue", "nonMatchingKeyIdsAreIgnored"],
},
],
aggregatable_values: {
campaignCounts: 32768,
geoValue: 1664,
},
debug_key: "1115698977",
}),
);
{{Specifications}}
{{Compat}}