这是indexloc提供的服务,不要输入任何密码
Skip to content

Replace aggregatable_expiry with event_attribution_window #577

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 15 commits into from
Oct 25, 2022
Merged
13 changes: 6 additions & 7 deletions AGGREGATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ example an ad-tech will use the API to collect:
* Aggregate purchase values at a per geo level
### Attribution source registration

Registering sources eligible for aggregate reporting entails adding new
`aggregation_keys` and `aggregatable_expiry` dictionary fields to the JSON dictionary of the
Registering sources eligible for aggregate reporting entails adding a new
`aggregation_keys` dictionary field to the JSON dictionary of the
[`Attribution-Reporting-Register-Source` header](https://github.com/WICG/conversion-measurement-api/blob/main/EVENT.md#registering-attribution-sources):
```jsonc
{
Expand All @@ -85,7 +85,7 @@ Registering sources eligible for aggregate reporting entails adding new
"geoValue": "0x5" // Source-side geo region = 5 (US), out of a possible ~100 regions
},

"aggregatable_expiry": "[64-bit signed integer]"
"aggregatable_report_window": "86400"
}
```
This defines a dictionary of named aggregation keys, each with a piece of the
Expand All @@ -96,10 +96,9 @@ trigger-side pieces.
Final keys will be restricted to a maximum of 128 bits. This means that hex
strings in the JSON must be limited to at most 32 digits.

`aggregatable_expiry` is an optional string field containing a signed 64-bit
integer representing the number of seconds for which the source is eligible for
aggregatable attribution. If omitted, the field defaults to the value specified
in the `expiry` field.
There is also a new optional field, `aggregatable_report_window`, which is the duration
in seconds after source registration during which aggregatable reports may be created
for this source.

### Attribution trigger registration

Expand Down
12 changes: 8 additions & 4 deletions EVENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,8 @@ header `Attribution-Reporting-Register-Source` of the form:
"source_event_id": "12340873456",
"destination": "[eTLD+1]",
"expiry": "[64-bit signed integer]",
"priority": "[64-bit signed integer]"
"priority": "[64-bit signed integer]",
"event_report_window": "[64-bit signed integer]"
}
```

Expand All @@ -199,6 +200,10 @@ received, the browser will find the matching source with highest
`priority` value and generate a report. The other sources will not
generate reports.

- `event_report_window`: (optional) duration in seconds after source registration
during which event reports may be created for this source. Also controls the last
window in which reports will be sent.

Once this header is received, the browser will proceed with [handling an
attribution source event](#handling-an-attribution-source-event). Note that it
is possible to register multiple sources for the same request using HTTP
Expand Down Expand Up @@ -419,11 +424,10 @@ different sites.

### Sending Scheduled Reports

Reports for `event` sources will be sent 1 hour after the source expires at its
`expiry`.
Reports for `event` sources will be sent 1 hour after the source's `event_report_window`.

Reports for `navigation` sources may be reported earlier than the source's
`expiry`, at specified points in time relative to when the source event was
`event_report_window`, at specified points in time relative to when the source event was
registered. See
[here](https://wicg.github.io/conversion-measurement-api/#delivery-time) for the
precise algorithm.
Expand Down
3 changes: 2 additions & 1 deletion header-validator/data.source.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,12 @@ export const validSourceHeadersAsObjects = [
priority: '4567898765678',
debug_key: '9876786543456',
expiry: '123',
aggregatable_expiry: '456',
aggregation_keys: {
campaignCounts: '0x159',
geoValue: '0x5',
},
aggregatable_report_window: '86400',
event_report_window: '86400',
debug_reporting: true
},
]
Expand Down
3 changes: 2 additions & 1 deletion header-validator/validate-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,8 @@ const aggregationKeys = object((state, key, value) => {
export function validateSource(source) {
const state = new State()
state.validate(source, {
aggregatable_expiry: optional(int64),
aggregatable_report_window: optional(int64),
event_report_window: optional(int64),
aggregation_keys: optional(aggregationKeys),
debug_key: optional(uint64),
debug_reporting: optional(bool),
Expand Down
39 changes: 24 additions & 15 deletions index.bs
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,10 @@ An attribution source is a [=struct=] with the following items:
:: A [=source type=].
: <dfn>expiry</dfn>
:: A length of time.
: <dfn>event report window</dfn>
:: A length of time.
: <dfn>aggregatable report window</dfn>
:: A length of time.
: <dfn>priority</dfn>
:: A 64-bit integer.
: <dfn>source time</dfn>
Expand All @@ -307,8 +311,6 @@ An attribution source is a [=struct=] with the following items:
: <dfn>aggregation keys</dfn>
:: An [=ordered map=] whose [=map/key|keys=] are [=strings=] and whose [=map/value|values=] are
non-negative 128-bit integers.
: <dfn>aggregatable expiry</dfn>
:: A length of time.
: <dfn>aggregatable budget consumed</dfn>
:: A non-negative integer, total [=aggregatable contribution/value=] of all [=aggregatable contributions=] created with this [=attribution source=].
: <dfn>aggregatable dedup keys</dfn>
Expand Down Expand Up @@ -683,6 +685,14 @@ Given an [=attribution rate-limit record=] |record|:

An [=attribution source=] |source|'s <dfn for="attribution source">expiry time</dfn> is |source|'s [=attribution source/source time=] + |source|'s [=attribution source/expiry=].

<h3 id="obtaining-attribution-source-event-report-window-time">Obtaining an attribution source's event report window time</h3>

An [=attribution source=] |source|'s <dfn for="attribution source">event report window time</dfn> is |source|'s [=attribution source/source time=] + |source|'s [=attribution source/event report window=].

<h3 id="obtaining-attribution-source-aggregatable-report-window-time">Obtaining an attribution source's aggregatable report window time</h3>

An [=attribution source=] |source|'s <dfn for="attribution source">aggregatable report window time</dfn> is |source|'s [=attribution source/source time=] + |source|'s [=attribution source/aggregatable report window=].

<h3 id="obtaining-attribution-source-site">Obtaining an attribution source's source site</h3>

An [=attribution source=] |source|'s <dfn for="attribution source">source site</dfn> is the result
Expand Down Expand Up @@ -795,6 +805,10 @@ To <dfn noexport>parse source-registration JSON</dfn> given a [=string=]
1. If |attributionDestination| is null, return null.
1. Let |expiry| be the result of running [=obtain a source expiry=] on |value|["`expiry`"].
1. If |expiry| is null, set |expiry| to 30 days.
1. Let |eventReportWindow| be the result of running [=obtain a source expiry=] on |value|["`event_report_window`"].
1. If |eventReportWindow| is null, set |eventReportWindow| to |expiry|.
1. Let |aggregatableReportWindow| be the result of running [=obtain a source expiry=] on |value|["`aggregatable_report_window`"].
1. If |aggregatableReportWindow| is null, set |aggregatableReportWindow| to |expiry|.
1. Let |priority| be 0.
1. If |value|["`priority`"] [=map/exists=] and is a [=string=]:
1. Set |priority| to the result of applying the
Expand All @@ -817,7 +831,6 @@ To <dfn noexport>parse source-registration JSON</dfn> given a [=string=]
|reportingOrigin| is <strong>blocked</strong>, set |debugKey| to null.
1. Let |aggregationKeys| be the result of running [=parse aggregation keys=] with |value|.
1. If |aggregationKeys| is null, return null.
1. Let |aggregatableExpiry| be the result of running [=obtain a source expiry=] on |value|["`aggregatable_expiry`"].
1. If |aggregatableExpiry| is null, set |aggregatableExpiry| to |expiry|.
1. Let |triggerDataCardinality| be the user agent's
[=navigation-source trigger data cardinality=].
Expand Down Expand Up @@ -849,6 +862,10 @@ To <dfn noexport>parse source-registration JSON</dfn> given a [=string=]
:: |reportingOrigin|
: [=attribution source/expiry=]
:: |expiry|
: [=attribution source/event report window=]
:: |eventReportWindow|
: [=attribution source/aggregatable report window=]
:: |aggregatableReportWindow|
: [=attribution source/priority=]
:: |priority|
: [=attribution source/source time=]
Expand All @@ -867,8 +884,6 @@ To <dfn noexport>parse source-registration JSON</dfn> given a [=string=]
:: |debugKey|
: [=attribution source/aggregation keys=]
:: |aggregationKeys|
: [=attribution source/aggregatable expiry=]
:: |aggregatableExpiry|
: [=attribution source/aggregatable budget consumed=]
:: 0
1. Return |source|.
Expand Down Expand Up @@ -1292,6 +1307,7 @@ To <dfn>trigger event-level attribution</dfn> given an [=attribution trigger=] |
1. If |sourceToAttribute|'s [=attribution source/event-level attributable=] value is false, return <strong>dropped</strong>.
1. Assert: |sourceToAttribute|'s [=attribution source/randomized response=] is
null or an [=set/is empty|empty=] [=set=].
1. If |sourceToAttribute|'s [=attribution source/event report window time=] is less than the current time, return.
1. Let |matchedConfig| be null.
1. [=map/iterate|For each=] [=event-level trigger configuration=] |config| of |trigger|'s
[=attribution trigger/event-level trigger configurations=]:
Expand Down Expand Up @@ -1351,6 +1367,7 @@ To <dfn>trigger event-level attribution</dfn> given an [=attribution trigger=] |
To <dfn>trigger aggregatable attribution</dfn> given an [=attribution trigger=] |trigger| and an
[=attribution source=] |sourceToAttribute|, run the following steps:

1. If |sourceToAttribute|'s [=attribution source/aggregatable report window time=] is less than the current time, return.
1. Let |report| be the result of running [=obtain an aggregatable report=] with |sourceToAttribute| and |trigger|.
1. If |report|'s [=aggregatable report/contributions=] [=list/is empty=], return <strong>dropped</strong>.
1. If |trigger|'s [=attribution trigger/aggregatable dedup key=] is not null and
Expand Down Expand Up @@ -1428,12 +1445,6 @@ To <dfn noexport>trigger attribution</dfn> given an [=attribution trigger=] |tri

<h3 algorithm id="delivery-time">Establishing report delivery time</h3>

To <dfn>obtain an expiry deadline</dfn> given an [=attribution source=]
|source|:

1. Return the maximum of |source|'s [=attribution source/expiry=] and 2 days
(172800 seconds).

To <dfn>obtain early deadlines</dfn> given a [=source type=] |sourceType|:

1. If |sourceType| is "`event`", return «».
Expand All @@ -1456,17 +1467,15 @@ To <dfn>obtain the report time at a window</dfn> given an

1. Let |earlyDeadlines| be the result of running [=obtain early deadlines=]
with |source|'s [=attribution source/source type=].
1. Let |deadline| be the result of running [=obtain an expiry deadline=] with
|source|.
1. Let |deadline| be |source|'s [=attribution source/event report window=].
1. If |earlyDeadlines|[|window|] [=list/exists=], set |deadline| to it.
1. Return the result of running [=obtain a report time from deadline=] with
|source|'s [=attribution source/source time=] and |deadline|.

To <dfn>obtain an event-level report delivery time</dfn> given an [=attribution source=]
|source| and a time |triggerTime|:

1. Let |deadlineToUse| be the result of running [=obtain an expiry deadline=]
with |source|.
1. Let |deadlineToUse| be |source|'s [=attribution source/event report window=].
1. Let |earlyDeadlines| be the result of running [=obtain early deadlines=]
with |source|'s [=attribution source/source type=].
1. [=list/iterate|For each=] |earlyDeadline| of |earlyDeadlines|:
Expand Down