Skip to content

Commit

Permalink
Update window.open interface to use features parameter (#138)
Browse files Browse the repository at this point in the history
* Update window.open interface to use features parameter

This updates the window.open overload to supply attribution reporting attributes in the features parameter, rather than in a new window.open overload per #130

* Update event_attribution_reporting.md

* Update README.md

* Update README.md
  • Loading branch information
johnivdel authored Apr 29, 2021
1 parent 6427560 commit 360d16e
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 19 deletions.
23 changes: 5 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -120,28 +120,15 @@ Clicking on an anchor tag that specifies these attributes will create a new attr

An attribution source can be registered for navigations initiated by [`window.open()`](https://html.spec.whatwg.org/multipage/window-object.html#dom-open).

A source is registered through a new `window.open()` overload:
A source is registered in a call to `window.open()` by providing attribution source attributes within the `features` parameter:

```
WindowProxy? open(
optional USVString url = "",
optional DOMString target = "_blank",
optional [LegacyNullToEmptyString] DOMString features = "",
optional AttributionSourceParams attribution_source_params)
window.open("https://dest.example", "_blank",
"noopener,attributionsourceeventid=1234,attributiondestination=https://dest.example,\
attributionreportto=https://reporter.example,attributionexpiry=604800000");)
```

`AttributionSourceParams` is a dictionary which contains the same attributes used by attribution source anchor tags:

```
dictionary AttributionSourceParams {
required DOMString attributionSourceEventId;
required USVString attributionDestination;
optional USVString attributionReportTo;
optional unsigned long attributionExpiry;
}
```

At the time window.open() is invoked, if the associated window has a [transient activation](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation), an attribution source event will be created and handled following [Handling an attribution source event](#handling-an-attribution-source-event).
At the time window.open() is invoked with these attributes specified in `features`, if the associated window has a [transient activation](https://html.spec.whatwg.org/multipage/interaction.html#transient-activation), an attribution source event will be created and handled following [Handling an attribution source event](#handling-an-attribution-source-event).

### Handling an attribution source event

Expand Down
13 changes: 12 additions & 1 deletion event_attribution_reporting.md
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,18 @@ The browser will expose a new interface:
}
```

See [this section](https://github.com/WICG/conversion-measurement-api/blob/main/README.md#registering-attribution-sources-for-windowopen-navigations) of the Attribution Reporting explainer for the definition of `AttributionSourceParams`. When invoked the browser will directly add the specified source to storage, and return whether the browser was successful in parsing the params.
`AttributionSourceParams` is a dictionary which contains the same attributes used by attribution source anchor tags:

```
dictionary AttributionSourceParams {
required DOMString attributionSourceEventId;
required USVString attributionDestination;
optional USVString attributionReportTo;
optional unsigned long attributionExpiry;
}
```

When invoked the browser will directly add the specified source to storage, and return whether the browser was successful in parsing the params.


### Different Classes of Attribution Sources
Expand Down

0 comments on commit 360d16e

Please sign in to comment.