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

Update Private Aggregation calls to use the newer names #37

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,11 @@ class PrivateAggregationTest {
}

if (Math.random() < DEBUG_MODE_CHANCE) {
const debug_key = BigInt(54321);
privateAggregation.enableDebugMode({ debug_key });
const debugKey = BigInt(54321);
privateAggregation.enableDebugMode({ debugKey });
}

privateAggregation.sendHistogramReport({
privateAggregation.contributeToHistogram({
bucket: BigInt(testKey),
value: parseInt(testValue),
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function generateAggregationKey(contentId, ageGroup, continent) {
class DemographicsMeasurementOperation {
async run(data) {
try {
const { contentId, debug_key } = data;
const { contentId, debugKey } = data;

// Read from Shared Storage
const key = 'has-reported-content';
Expand All @@ -105,8 +105,8 @@ class DemographicsMeasurementOperation {
const value = 1 * SCALE_FACTOR;

// Send an aggregatable report via the Private Aggregation API
privateAggregation.enableDebugMode({ debug_key });
privateAggregation.sendHistogramReport({ bucket, value });
privateAggregation.enableDebugMode({ debugKey });
privateAggregation.contributeToHistogram({ bucket, value });

// Set the report submission status flag
await sharedStorage.set(key, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function measureDemographics() {
await window.sharedStorage.worklet.addModule('demographics-measurement-worklet.js');

// Run the demographics measurement operation
await window.sharedStorage.run('demographics-measurement', { data: { contentId: '123', debug_key: 888n } });
await window.sharedStorage.run('demographics-measurement', { data: { contentId: '123', debugKey: 888n } });
}

measureDemographics();
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ function convertContentIdToBucket(contentId) {
class KFreqMeasurementOperation {
async run(data) {
try {
const { kFreq, contentId, debug_key } = data;
const { kFreq, contentId, debugKey } = data;

// Read from Shared Storage
const hasReportedContentKey = 'has-reported-content';
Expand Down Expand Up @@ -73,8 +73,8 @@ class KFreqMeasurementOperation {
const value = 1 * SCALE_FACTOR;

// Send an aggregatable report via the Private Aggregation API
privateAggregation.enableDebugMode({ debug_key });
privateAggregation.sendHistogramReport({ bucket, value });
privateAggregation.enableDebugMode({ debugKey });
privateAggregation.contributeToHistogram({ bucket, value });

// Set the report submission status flag
await sharedStorage.set(hasReportedContentKey, 'true');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ async function injectAd() {
await window.sharedStorage.worklet.addModule('k-freq-measurement-worklet.js');

// Run the K-frequency measurement operation
await window.sharedStorage.run('k-freq-measurement', { data: { kFreq: 3, contentId: 123, debug_key: 999n } });
await window.sharedStorage.run('k-freq-measurement', { data: { kFreq: 3, contentId: 123, debugKey: 999n } });
}

injectAd();
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ function convertContentIdToBucket(contentId) {
class ReachMeasurementOperation {
async run(data) {
try {
const { contentId, debug_key } = data;
const { contentId, debugKey } = data;

// Read from Shared Storage
const key = 'has-reported-content';
Expand All @@ -61,8 +61,8 @@ class ReachMeasurementOperation {
const value = 1 * SCALE_FACTOR;

// Send an aggregatable report via the Private Aggregation API
privateAggregation.enableDebugMode({ debug_key });
privateAggregation.sendHistogramReport({ bucket, value });
privateAggregation.enableDebugMode({ debugKey });
privateAggregation.contributeToHistogram({ bucket, value });

// Set the report submission status flag
await sharedStorage.set(key, true);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ async function measureUniqueReach() {
await window.sharedStorage.worklet.addModule('reach-measurement-worklet.js');

// Run the reach measurement operation
await window.sharedStorage.run('reach-measurement', { data: { contentId: '1234', debug_key: 777n } });
await window.sharedStorage.run('reach-measurement', { data: { contentId: '1234', debugKey: 777n } });
}

measureUniqueReach();