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

Dev uc event level report #558

Open
wants to merge 42 commits into
base: dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
1dd91be
add static img display page for demonstrating only event level report…
sinnew Jan 23, 2025
8fb8f23
add link to the new page
sinnew Jan 23, 2025
47e653c
add event trigger for event level report
sinnew Jan 23, 2025
0e2ae69
trigger event level report from shop
sinnew Jan 23, 2025
bcefc37
adding doc
sinnew Jan 23, 2025
2ae0e3a
Update services/ad-tech/src/lib/arapi.ts
sinnew Jan 24, 2025
167a8ec
Update services/ad-tech/src/lib/arapi.ts
sinnew Jan 24, 2025
26d317d
Update services/ad-tech/src/lib/arapi.ts
sinnew Jan 24, 2025
d9f4b65
pretify for pre-commit check
sinnew Jan 24, 2025
e3394e8
pretifying
sinnew Jan 24, 2025
72cffe1
replace hard coded url with constants
sinnew Jan 28, 2025
43dfb3d
replacing images with white background. fixing use case descriptions …
sinnew Jan 28, 2025
17b4f95
add better function comment
sinnew Jan 28, 2025
ba069e3
change param name from cvType to conversionType
sinnew Jan 28, 2025
5ad89a3
prettifying
sinnew Jan 28, 2025
63bc49a
prettifying
sinnew Jan 28, 2025
566fc75
resolving docsaurus build error and prettier rule conflict
sinnew Jan 28, 2025
cb581cb
Merge pull request #541 from sinnew/dev-uc-event-level-report
sinnew Jan 29, 2025
010a59f
bugfix run-ad-auction was moved to run-simple-ad-auction.js
sidneyzanetti Jan 23, 2025
acd6934
[doc] add instruction and scripts to use podman as an alternative to …
Seburan Jan 24, 2025
3210a73
[doc] update readme with Podman documentation
Seburan Jan 27, 2025
b11b9b7
changes for dsp tagging to add dsp-x and dsp-y
chasinandrew Jan 14, 2025
c103aac
add dsp-x and dsp-y dsp tags, iframe, logic for B&A interest group pa…
chasinandrew Jan 22, 2025
b1f3c0e
prettier formatter for pre-commit
chasinandrew Jan 24, 2025
2733105
add ssp-x and ssp-y participants
chasinandrew Jan 24, 2025
6b20f2a
add support for unknown keys in the metadata field for interest groups
chasinandrew Jan 27, 2025
c121fd6
changes for prettier formatting
chasinandrew Jan 27, 2025
fccf664
[infra] adding missing elements for dsp-x, dsp-y, ssp-x, ssp-y
Seburan Jan 29, 2025
f82324c
[infra] remove unused environment variables
Seburan Jan 29, 2025
f3f13c1
[infra] use dynamic env_file name in script
Seburan Jan 29, 2025
796e71e
[infra] fix attestation file name for dsp-x, dsp-y, ssp-x, ssp-y
Seburan Jan 29, 2025
24c8a8a
[infra] fix cloud build config for ssp-x, ssp-y
Seburan Jan 29, 2025
c235da3
[infra] fix environment variables for prod
Seburan Jan 29, 2025
19bf0b6
fixing the start command in package.json
sidneyzanetti Jan 28, 2025
b48f4a2
change hardcoded Shop domain url to use constant
sinnew Feb 5, 2025
cb9f718
change hardcoded Shop domain url to use constant
sinnew Feb 5, 2025
9b25e27
add ssp-x and ssp-y participants
chasinandrew Jan 24, 2025
26e9412
remove verbose 404 error by adding temporary endpoint
sinnew Feb 6, 2025
df22160
change sample code with the real examples and added link to the sourc…
sinnew Feb 6, 2025
ad78e7f
fix type-o and steps
sinnew Feb 10, 2025
487be45
Merge branch 'dev' into dev-uc-event-level-report
sinnew Feb 10, 2025
177be7e
prettier
sinnew Feb 10, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -84,12 +84,12 @@ SSP_B_DETAIL="Ad-Platform: SSP-B for publisher"

SSP_X_HOST=privacy-sandbox-demos-ssp-x.dev
SSP_X_URI=http://privacy-sandbox-demos-ssp-x.dev:8080
SSP_X_TOKEN=""
SSP_X_HOST_INTERNAL=ssp-x
SSP_X_DETAIL="Ad-Platform: SSP-X for publisher"

SSP_Y_HOST=privacy-sandbox-demos-ssp-y.dev
SSP_Y_URI=http://privacy-sandbox-demos-ssp-y.dev:8080
SSP_Y_TOKEN=""
SSP_Y_HOST_INTERNAL=ssp-y
SSP_Y_DETAIL="Ad-Platform: SSP-Y for publisher"

## Collector for Aggregation Service
Expand Down
25 changes: 25 additions & 0 deletions services/ad-tech/src/lib/arapi.ts
Original file line number Diff line number Diff line change
Expand Up @@ -228,3 +228,28 @@ function test() {
}

// test();

// tmp for event level report
// Retrieves trigger data and priority based on the provided conversion type.
// This function maps conversion types to corresponding trigger data and priority values
// * trigger data is the metadata value representing the conversion
// used for event-level reporting. The trigger data and priority are returned as an array.
// @param conversionType The conversion type string (e.g., 'click-cart-icon', 'add-to-cart', 'purchase').
// @returns An array containing the trigger data (string) and priority (string),
// or `['0', '0']` for unknown conversion types.
// @example
// getTriggerData('purchase'); // Returns ['1', '100']
// getTriggerData('unknown-event'); // Returns ['0', '0']
export function getTriggerData(conversionType: string) {
console.log(`[arapi] getTriggerData: ${conversionType}`);
switch (conversionType) {
case `click-cart-icon`:
return [`5`, `60`];
case `add-to-cart`:
return [`6`, `80`];
case `purchase`:
return [`1`, `100`];
default:
return ['0', '0'];
}
}
18 changes: 18 additions & 0 deletions services/ad-tech/src/lib/attribution-reporting-helper.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import {
sourceEventId,
sourceKeyPiece,
triggerKeyPiece,
getTriggerData,
ADVERTISER,
PUBLISHER,
DIMENSION,
Expand Down Expand Up @@ -84,6 +85,23 @@ export const getAttributionTriggerHeaders = (requestQuery: {
debug_key: debugKey(),
};
};
/** Returns ARA trigger registration headers for event level. */
export const getEventLevelAttributionTriggerHeaders = (requestQuery: {
[key: string]: string;
}): {[key: string]: any} => {
const conversionType: string = requestQuery['conversion-type'] as string;
const [_data, _priority] = getTriggerData(conversionType);
return {
event_trigger_data: [
{
trigger_data: _data,
priority: _priority,
},
],
debug_key: debugKey(),
debug_reporting: true,
};
};

/** Returns ARA source registration headers for the request context. */
export const getAttributionSourceHeaders = (
Expand Down
14 changes: 14 additions & 0 deletions services/ad-tech/src/routes/common/attribution-reporting-router.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import {decodeDict} from 'structured-field-values';
import {
getAttributionSourceHeaders,
getAttributionTriggerHeaders,
getEventLevelAttributionTriggerHeaders,
getAttributionRedirectUrl,
} from '../../lib/attribution-reporting-helper.js';
import {getStructuredObject} from '../../lib/common-utils.js';
Expand Down Expand Up @@ -94,3 +95,16 @@ AttributionReportingRouter.get(
res.sendStatus(200);
},
);
/** Registers an attribution trigger (event) without aggr report. */
AttributionReportingRouter.get(
'/register-event-level-trigger',
async (req: Request, res: Response) => {
const queryParams = getStructuredObject(req.query);
const triggerHeaders = getEventLevelAttributionTriggerHeaders(queryParams);
res.setHeader(
'Attribution-Reporting-Register-Trigger',
JSON.stringify(triggerHeaders),
);
res.sendStatus(200);
},
);
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,17 @@ WellKnownAttributionReportingRouter.post(
},
);

// TODO: Implement verbose debug reports for ARA.
// WellKnownAttributionReportingRouter.post('/debug/verbose',
// async (req: Request, res: Response) => {});
// temporarily console.logging verbose report
WellKnownAttributionReportingRouter.post(
'/debug/verbose',
async (req: Request, res: Response) => {
const debugReport = req.body;
console.log(
'\x1b[1;31m%s\x1b[0m',
`Received verbose debug reports from the browser`,
);
console.log('VERBOSE REPORT(S) RECEIVED:\n=== \n', debugReport, '\n=== \n');

res.sendStatus(200);
},
);
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
17 changes: 9 additions & 8 deletions services/home/docs/demos/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,15 @@ sidebar_position: 1
:::note Looking for running these demos on your local environment ? Check the
[deployment guide](https://github.com/privacysandbox/privacy-sandbox-demos/blob/main/README.md) on the GitHub. :::

| **Category** | **Use Case** | **Privacy Sandbox APIs** | **Relevant for** |
| :--------------------------------------: | :----------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------: | :----------------------------------------: |
| Show Relevant Video Ads | [Instream VAST video ad in a Protected Audience sequential auction setup](demos/instream-video-ad-multi-seller.md) | Protected Audience API | Publisher, Ad Server, SSP, Advertiser, DSP |
| Show Relevant Video Ads | [Instream VAST video ad in a Protected Audience single-seller auction](demos/vast-video-protected-audience.md) | Protected Audience API | Publisher, SSP, Advertiser, DSP |
| Show Relevant Content and Ads | [Retargeting / Remarketing](demos/retargeting-remarketing.md) | Protected Audience API | Publisher, SSP, Advertiser, DSP |
| Measure Digital Ads | [Single-touch conversion Attribution](demos/single-touch-conversion-attribution.md) | Attribution Reporting API, Aggregation Service | Publisher, SSP, Advertiser, DSP |
| Use SSP Key/Value service to exclude ads | [Enforcing publisher ad requirements in Protected Audience using K/V](demos/publisher-ad-quality-req.md) | Protected Audience API | Publisher, SSP |
| Measure Digital Ads | [Multi-touch conversion Attribution](demos/multi-touch-conversion-attribution.md) | Private Aggregation, Shared Storage, Aggregation Service | Publisher, Advertiser, DSP |
| **Category** | **Use Case** | **Privacy Sandbox APIs** | **Relevant for** |
| :---------------------------: | :----------------------------------------------------------------------------------------------------------------: | :------------------------------------------------------: | :----------------------------------------: |
| Show Relevant Video Ads | [Instream VAST video ad in a Protected Audience sequential auction setup](demos/instream-video-ad-multi-seller.md) | Protected Audience API | Publisher, Ad Server, SSP, Advertiser, DSP |
| Show Relevant Video Ads | [Instream VAST video ad in a Protected Audience single-seller auction](demos/vast-video-protected-audience.md) | Protected Audience API | Publisher, SSP, Advertiser, DSP |
| Show Relevant Content and Ads | [Retargeting / Remarketing](demos/retargeting-remarketing.md) | Protected Audience API | Publisher, SSP, Advertiser, DSP |
| Measure Digital Ads | [Single-touch conversion Attribution](demos/single-touch-conversion-attribution.md) <br/> (Summary Report) | Attribution Reporting API, Aggregation Service | Publisher, SSP, Advertiser, DSP |
| Measure Digital Ads | [Event Level Report](demos/single-touch-event-level-report.md) | Attribution Reporting API | Publisher, Advertiser, Ad Tech |
| Attribution Reporting API | [Enforcing publisher ad requirements in Protected Audience using K/V](demos/publisher-ad-quality-req.md) | Protected Audience API | Publisher, SSP |
| Measure Digital Ads | [Multi-touch conversion Attribution](demos/multi-touch-conversion-attribution.md) | Private Aggregation, Shared Storage, Aggregation Service | Publisher, Advertiser, DSP |

:::info Looking for a use case not listed here ? Help us growing this repository by
[contributing](https://github.com/privacysandbox/privacy-sandbox-demos/blob/main/CONTRIBUTING.md) or
Expand Down
Loading