Skip to content

Commit

Permalink
Merge pull request #49 from GoogleChromeLabs/update-docs
Browse files Browse the repository at this point in the history
Update documentation
  • Loading branch information
taraojo authored Sep 4, 2024
2 parents a2c2380 + 2af449e commit dfe5385
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 19 deletions.
16 changes: 11 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down Expand Up @@ -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

Expand All @@ -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

Expand Down
20 changes: 7 additions & 13 deletions functions/view/home/index.hbs
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,13 @@
<a href='https://github.com/GoogleChromeLabs/shared-storage-demo' target='_blank'>GitHub</a>.</p>

<h4>How to run the demo</h4>
<img src='https://wd.imgix.net/image/jc12tn44ghWnPdtbfjsmxHEaCUC3/ioMgXCp8CAyumX9Qqrgb.png?auto=format&w=700' />
<br />
<p>To run the URL selection demo,
<a
href='https://developer.chrome.com/docs/privacy-sandbox/shared-storage/#try-the-shared-storage-api'
target='_blank'
>follow the instructions</a>
for enabling the
<b>Privacy Sandbox Ads APIs</b>
experiment flag at
<b>chrome://flags/#privacy-sandbox-ads-apis</b> and <b>chrome://flags/#privacy-sandbox-enrollment-overrides</b>, using the following value for the latter:
<code>https://shared-storage-demo-content-producer.web.app,https://shared-storage-demo-publisher-a.web.app</code>
</p>
<p>
To run the URL selection demo, enable the Privacy Sandbox experiment flag <b>chrome://flags/#privacy-sandbox-enrollment-overrides</b>,
and add the below URLs to the allowlist:
</p>
<p>
<code>https://shared-storage-demo-content-producer.web.app,https://shared-storage-demo-publisher-a.web.app,https://shared-storage-demo-publisher-b.web.app</code>
</p>
</div>
<section class='demo__card-container'>
<section class='demo__gate-container'>
Expand Down
2 changes: 1 addition & 1 deletion sites/content-producer/url-selection/ab-testing.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
});
Expand Down

0 comments on commit dfe5385

Please sign in to comment.