GoogleChromeLabs / ps-analysis-tool

Privacy Sandbox Analysis Chrome Extension and CLI for analysis and understanding of cookie usage on web pages, and new privacy-preserving Chrome APIs
https://www.privacysandbox.com
Apache License 2.0
103 stars 23 forks source link

Baseline Attribution Reporting API Menu Element in Privacy Sandbox Analysis DevTools panel #40

Open amedina opened 1 year ago

amedina commented 1 year ago

Feature Request

Description: Today, ad conversion measurement often relies on third-party cookies. The Attribution Reporting API (ARA) enables to collect such measurements in a privacy-preserving way; that is, without third-party cookies. Specifically, this API enables advertisers and ad tech providers to measure conversions in the following cases:

Motivation: The goal of this feature is to include an Attribution Reporting API Menu Element in the DevTools PS Analysis panel, initially surfacing information from chrome://attribution-internals, and progress from there to enable users of the extension to learn about the API in an user-friendly way, and debug its use cases.

The ARA Menu Element can also capture information and insights provided in prior demos such as this and this.

Acceptance Criteria:

Additional Information:

mohdsayed commented 1 year ago

I am thinking how we would get data from chrome://attribution-internals/. I did a quick attempt by injecting a script into that page through the service worker, but it seems to function properly on all tabs except for this one.

chrome.tabs.onUpdated.addListener((tabId, changeInfo, tab) => {
  if (
    changeInfo.status === 'complete' &&
    tab.url === 'chrome://attribution-internals/'
  ) {
    chrome.scripting
      .executeScript({
        target: { tabId: tabId },
        func: () => {
          // Do window operations here.
        },
      })
      .then((result) => {
        // work with the result.
      });
  }
});

throws the following error

Uncaught (in promise) Error: Cannot access a chrome:// URL

Looks like accessing internal pages like chrome://attribution-internals/ have limitations due to the security restrictions imposed by Chrome extensions.

apasel422 commented 1 year ago

I am thinking how we would get data from chrome://attribution-internals/.

I am actively working on exposing Attribution Reporting data and events in the DevTools protocol, e.g. source-registration events.