Skip to content
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

Feature: Protected audience analysis in PSAT #811

Merged
merged 44 commits into from
Oct 30, 2024
Merged

Conversation

amovar18
Copy link
Collaborator

@amovar18 amovar18 commented Aug 20, 2024

Description

This PR aims to give service worker the capability to run analysis of the protected audience events that run on a site.

Relevant Technical Choices

Testing Instructions

Additional Information:

Screenshot/Screencast


Checklist

  • I have thoroughly tested this code to the best of my abilities.
  • I have reviewed the code myself before requesting a review.
  • This code is covered by unit tests to verify that it works as intended.
  • The QA of this PR is done by a member of the QA team (to be checked by QA).

Partially fixes #785

@amovar18 amovar18 self-assigned this Aug 20, 2024
@amovar18 amovar18 added the enhancement New feature or request label Aug 20, 2024
@amovar18 amovar18 changed the title Feat/pa service worker Feature: Protected audience analysis in PSAT Aug 26, 2024
@gagan0123
Copy link
Collaborator

@amovar18

image
image

In case the auction runs and no interest groups are joined by the browser, the Ad Units tab remain empty

@gagan0123
Copy link
Collaborator

gagan0123 commented Oct 28, 2024

Inconsistent Bid History in Privacy Sandbox Panel

Describe the bug
Previously recorded bids are reappearing in the 'Bids' tab of the Protected Audience section in Privacy Sandbox panel after closing and reopening the developer tools. This behavior is inconsistent with the expected functionality of clearing the table upon closing the developer tools or maintaining a persistent view of past bids.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://privacysandboxdemos.domain-aaa.com/
  2. Open the Chrome Developer Tools and go to Privacy Sandbox panel.
  3. Navigate to the 'Protected Audience' section.
  4. Select the 'Bids' tab.
  5. Run the auction by clicking on "Run Auction" button in the demo site.
  6. Observe the recorded bids.
  7. Close the Chrome Developer Tools.
  8. Reopen the Chrome Developer Tools and go back to Privacy Sandbox panel.
  9. Return to the 'Bids' tab in the 'Protected Audience' section.
  10. Trigger the auction again by clicking on "Run Auction" button in the demo site.
  11. Observe that the previously recorded bids have reappeared.

Expected behavior
There are two possibilities for expected behavior, and the PSAT extension should consistently adhere to one of them:

  • Scenario 1: Persistent Bid History: If the 'Bids' tab is intended to display a history of bids, then the previously recorded bids should be visible immediately upon opening the 'Protected Audience' section, even before triggering a new auction.

  • Scenario 2: Cleared Bids on Close: If the 'Bids' tab is intended to reflect only the bids from the time when Chrome DevTools is open again, then the table should be empty upon opening the 'Bids' tab in 'Protected Audience' section. Only new bids should appear in the that table when the auction is triggered again.

Screencast

Google.-.PSAT.-.Bids.Table.Issue.mp4

Additional context

cc @amovar18

@gagan0123
Copy link
Collaborator

Hovering over Ad Units unexpectedly loads Cookies Landing page

Describe the bug
In the 'Ad Units' tab of the 'Protected Audience' section within the Privacy Sandbox panel, hovering over an ad unit with the frame overlay icon should display additional information about that ad unit in a frame overlay. However, upon hovering over the ad unit on the website, instead of staying within the Protected Audience section, the extension navigates to the 'Cookies' landing page.

To Reproduce
Steps to reproduce the behavior:

  1. Go to https://privacysandboxdemos.domain-aaa.com/
  2. Open the Chrome Developer Tools and navigate to the Privacy Sandbox panel.
  3. Go to the 'Protected Audience' section.
  4. Select the 'Ad Units' tab.
  5. Join an interest group and click on “Run Auction” button to trigger an auction.
  6. Hover over any Ad Unit Code with the frame overlay icon (looks like a box with smaller boxes inside).
  7. Now hover over the highlighted ad unit on the website.

Expected behavior
A frame overlay should appear, providing additional details about the hovered ad unit, while remaining within the 'Ad Units' tab of the 'Protected Audience' section.

Screencast

Google.-.PSAT.-.Ad.Units.Frame.Overlay.Issue.mp4

Additional context

cc @amovar18

@amovar18 amovar18 marked this pull request as ready for review October 29, 2024 09:28
@mohdsayed mohdsayed merged commit 2fca892 into develop Oct 30, 2024
6 checks passed
@mohdsayed mohdsayed deleted the feat/pa-service-worker branch October 30, 2024 11:02
amovar18 added a commit that referenced this pull request Dec 12, 2024
* Add PA analysis in service worker.
Improve attach CDP function.

* Add storage.interestGroupAccessed method to service worker.

* Add bid value to the auction events.

* Split syncCookieStore into dataStore, CookieStore and PAStore.
Change its references.

* Export interface from dataStore.

* Change some more references.

* Add protected audience provider to the devtools.

* Convert bid to null.

* Add last mile connection to the devtools

* Add method to incorporate multiple auction ID.

* Handle multiSeller auctions.
Console.log data in app.tsx.

* Descructure details in the extension.

* Refactor service worker.
Move service worker PA methods to PAStore.

* Fix errors in the refactor.

* Fix lint errors

* Fix tests.

* Move PA types to common package.

* Update devtools protocol package to latest version

* Move InterestGroup and auctionEvents to common package

* Add support to hear globalEvents.

* Add comment to explain auctionEvents structure.
Refactor PA store to fix some bug when it was made to accomodate global events.

* Use globalEvents instead of interestGroupEvents.

* compute received Bids and noBids.

* Fix noBids in the protected audience provider.

* Fix nobids value.
Add object diff in state update.
Remove console.log.
Add adUnit code to the data being provided in the bids and noBids.

* Add ads and Bidders in protectedAudience API provider.

* Add adUnitCode optional chaining.
Fix set spread of bidders.

* Fix data being displayed on the panel.

* Fix data refresh on tab reload.

* Reduce state updates.
Refactor code move udeCallback to separate functions.

* Fix error of not updating.

* Fix undefined error.

* Remove logic to reset interest group data on page load or navigation.

* Fix failing tests.

* Fix merge conflicts.

* Fix failing build.

* Fix failing tests

* Fix initial sync override.

* Fix failing tests.

* Fix tab reload data refresh.

---------

Co-authored-by: sayedtaqui <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants