diff --git a/README.md b/README.md index 239de48..8d06ecb 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ Visit [https://shared-storage-demo.web.app](https://shared-storage-demo.web.app) The ad rendered in a fenced frame must be served from an HTTPS origin. However the Firebase emulator [does not support HTTPS localhost](https://github.com/firebase/firebase-tools/issues/1908). Therefore, we will use `nginx` to setp up a reverse proxy. -We need to setup nginx to respond to port 4337 that proxies content from port 3007 +We need to setup nginx to respond to port 4437 that proxies content from port 3007. #### Generate the certs with `mkcert` @@ -61,7 +61,7 @@ http { 4. Stop the `nginx` server with `nginx -s stop` 5. Restart the `nginx` server with `nginx` -The above `nginx` configuration proxies `https://localhost:4437` to `http://localhost:8087` (Content producer server). +The above `nginx` configuration proxies `https://localhost:4437` to `http://localhost:3007` (Content producer server). ### Setup Firebase @@ -75,15 +75,21 @@ The above `nginx` configuration proxies `https://localhost:4437` to `http://loca ### Start emulator -``` +```bash npm run dev ``` ### Shared storage -To run this demo, [follow the instructions](https://developer.chrome.com/docs/privacy-sandbox/shared-storage/#try-the-shared-storage-api) for enabling the Privacy Sandbox Ads APIs experiment flag at **chrome://flags/#privacy-sandbox-ads-apis**. +To run this demo, enable the experiment flag **chrome://flags/#privacy-sandbox-enrollment-overrides**. + +Then, [open Google Chrome from the command line](https://www.chromium.org/developers/how-tos/run-chromium-with-flags/) with the additional flags below to disable the need for attestations when running locally. + +``` +--enable-privacy-sandbox-ads-apis --disable-features=EnforcePrivacySandboxAttestations +``` -And visit `http://localhost:8080` for the main page +And visit `http://localhost:3000` for the main page ### Deploy code diff --git a/functions/view/home/index.hbs b/functions/view/home/index.hbs index 62d9dba..1c957d3 100644 --- a/functions/view/home/index.hbs +++ b/functions/view/home/index.hbs @@ -20,19 +20,13 @@ GitHub.

How to run the demo

- -
-

To run the URL selection demo, - follow the instructions - for enabling the - Privacy Sandbox Ads APIs - experiment flag at - chrome://flags/#privacy-sandbox-ads-apis and chrome://flags/#privacy-sandbox-enrollment-overrides, using the following value for the latter: - https://shared-storage-demo-content-producer.web.app,https://shared-storage-demo-publisher-a.web.app -

+

+ To run the URL selection demo, enable the Privacy Sandbox experiment flag chrome://flags/#privacy-sandbox-enrollment-overrides, + and add the below URLs to the allowlist: +

+

+ https://shared-storage-demo-content-producer.web.app,https://shared-storage-demo-publisher-a.web.app,https://shared-storage-demo-publisher-b.web.app +

diff --git a/sites/content-producer/url-selection/ab-testing.js b/sites/content-producer/url-selection/ab-testing.js index 8997937..576fbe7 100644 --- a/sites/content-producer/url-selection/ab-testing.js +++ b/sites/content-producer/url-selection/ab-testing.js @@ -44,7 +44,7 @@ async function injectAd() { // Load the worklet module await window.sharedStorage.worklet.addModule('ab-testing-worklet.js'); - // Set the initial value in the storage to o a random experiment group + // Set the initial value in the storage to a random experiment group window.sharedStorage.set('ab-testing-group', getRandomExperiment(), { ignoreIfPresent: true, });