共用儲存空間和私密匯總功能的偵錯

如要啟用偵錯功能,請在使用共用儲存空間和私人匯總功能的相同情境中呼叫 enableDebugMode() JavaScript 方法。這項設定會套用至相同情境中的日後報表。

privateAggregation.enableDebugMode();

如要將報表與觸發報表的內容關聯,您可以設定 64 位元未簽署整數偵錯金鑰,並將其傳遞至 JavaScript 呼叫。debugKeyBigInt

privateAggregation.enableDebugMode({debugKey: 1234});

偵錯共用儲存空間

Shared Storage 傳回一般錯誤訊息:

Promise is rejected without and explicit error message

您可以將呼叫納入 try-catch 區塊包裝,藉此對共用儲存空間進行偵錯。

try {
  privateAggregation.contributeToHistogram({bucket, value});
} catch (e){
  console.log(e);
}

私密匯總偵錯

系統會將報表傳送至 /.well-known/private-aggregation/report-shared-storage/.well-known/private-aggregation/debug/report-shared-storage。偵錯報表會接收類似下方 JSON 的酬載。這個酬載會將 api 欄位定義為「shared-storage」。

{
   "aggregation_coordinator_origin": "https://publickeyservice.msmt.gcp.privacysandboxservices.com",
   "aggregation_service_payloads": [ {
      "debug_cleartext_payload": "omRkYXRhlKJldmFsdWVEAAAAgGZidWNrZXRQAAAAAAAAAAAAAAAAB1vNFaJldmFsdWVEAAAAAGZidWNrZXRQAAAAAAAAAAAAAAAAAAAAAKJldmFsdWVEAAAAAGZidWNrZXRQAAAAAAAAAAAAAAAAAAAAAKJldmFsdWVEAAAAAGZidWNrZXRQAAAAAAAAAAAAAAAAAAAAAKJldmFsdWVEAAAAAGZidWNrZXRQAAAAAAAAAAAAAAAAAAAAAKJldmFsdWVEAAAAAGZidWNrZXRQAAAAAAAAAAAAAAAAAAAAAKJldmFsdWVEAAAAAGZidWNrZXRQAAAAAAAAAAAAAAAAAAAAAKJldmFsdWVEAAAAAGZidWNrZXRQAAAAAAAAAAAAAAAAAAAAAKJldmFsdWVEAAAAAGZidWNrZXRQAAAAAAAAAAAAAAAAAAAAAKJldmFsdWVEAAAAAGZidWNrZXRQAAAAAAAAAAAAAAAAAAAAAKJldmFsdWVEAAAAAGZ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ph5OUEaaztwwzh2mnhwIBxMkPnfsGihiF+5KDEajVfMZ3NLsIDoZO+l4RTZrkqE+jVkAqaZGBiCIx42Edp/JV0DXfrryypCdQBZr8iEbSzCM9hKsMfLN7S/VkPe5rDwOZbhKCn5XXgfGz5tSx/KbZgsQf4OCEhwAyNPHAh3MHU7xmkQ3pKg4EIUC/WOtKAlVDOtDMmPPoQY1eAwJhw9SxZaYF1kHjUkTm3EnGhgXgOwCRWqeboNenSFaCyp6DbFNI3+ImONMi2oswrrZO+54Tyhca5mnLIiInI+C3SlP4Sv1jFECIUdf/mifJRM5hMj6OChzHf4sEifjqtD4A30c4OzGexWarie2xakdQej9Go4Lm0GZEDBfcAdWLT9HwmpeI2u4HDAblXDvLN8jYFDOOtzOl90oU7AwdhkumUCFLRadXAccXW9SvLfDswRkXMffMJLFqkRKVE1GPonFFtlzaRqp7IgE8L6AOtz6NDcxAjHnEuzDPPMcWMl1AFH0gq7h"
   } ],
   "debug_key": "1234",
   "shared_info": "{\"api\":\"shared-storage\",\"debug_mode\":\"enabled\",\"report_id\":\"80d93c0a-a94e-4ab7-aeb5-a4ecd4bfc598\",\"reporting_origin\":\"https://privacy-sandbox-demos-dsp.dev\",\"scheduled_report_time\":\"1717784740\",\"version\":\"0.1\"}"
}

偵錯明文酬載

debug_cleartext_payload 採用 Base64 CBOR 編碼。您可以使用解碼器查看值區和值,也可以使用共用儲存空間解碼器中的 JavaScript 程式碼。

互動及分享意見回饋

共用儲存空間提案正在進行討論,因此可能隨時會有變動 如果您試用這個 API 並有意見,請不吝與我們分享。