有効フリークエンシーとも呼ばれるこの数値は、ユーザーが特定のコンテンツを認識または思い出すまでに必要な最小視聴回数です(多くの場合、広告の視聴回数のコンテキストで使用されます)。共有ストレージを使用すると、コンテンツを K 回以上視聴したユニーク ユーザーのレポートを作成できます。
Shared Storage API は、さまざまなユースケースをサポートする、汎用のクロスサイト ストレージのためのプライバシー サンドボックスの提案です。Private Aggregation API は、共有ストレージで利用できる出力で、クロスサイト データを集計できます。
K 回以上のフリークエンシーの測定を試す
共有ストレージと非公開集計を使用した K+ 頻度測定をテストするには、Chrome M107 以降を使用していることを確認してください。chrome://settings/adPrivacy
で、すべての広告プライバシー API を有効にします。
コマンドラインから --enable-features=PrivacySandboxAdsAPIsOverride,OverridePrivacySandboxSettingsLocalTesting,SharedStorageAPI,FencedFrames
フラグを使用して共有ストレージを有効にすることもできます。
コードサンプルを試す
特定のクライアントのコンテンツを、異なるサイト間で K 回以上見たユーザーの数を測定したい場合などです。この例では、表示回数が共有ストレージに追加され、コンテンツが読み込まれるたびに 1 ずつ増加します。インプレッション数が 3 に達すると、Private Aggregation API が呼び出されます。コンテンツ ID ディメンションは集計キーとしてエンコードされ、カウントが集計可能な値として使用されます。概要レポートには、「広告キャンペーン ID 123 を 3 回以上見たユーザーは約 391 人」などの情報が表示されます。
この例では、次のようになります。
k-frequency-measurement.js
はフレームを使用して読み込まれ、共有ストレージ ワークレットの読み込みを担当します。k-frequency-measurement-worklet.js
は、共有ストレージ内のインプレッション数を読み取り、Private Aggregation API を使用してレポートを送信する共有ストレージ ワークレットです。
k-frequency-measurement.js
async function injectContent() {
// Load the Shared Storage worklet
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 });
}
injectContent();
kuency-measurement-worklet.js
// Learn more about noise and scaling from the Private Aggregation fundamentals
// documentation on Chrome blog
const SCALE_FACTOR = 65536;
/**
* The bucket key must be a number, and in this case, it is just the content
* ID itself. For more complex bucket key construction, see other use cases in
* this demo.
*/
function convertContentIdToBucket(contentId) {
return BigInt(contentId);
}
class KFreqMeasurementOperation {
async run(data) {
const { kFreq, contentId } = data;
// Read from Shared Storage
const hasReportedContentKey = 'has-reported-content';
const impressionCountKey = 'impression-count';
const hasReportedContent = (await sharedStorage.get(hasReportedContentKey)) === 'true';
const impressionCount = parseInt((await sharedStorage.get(impressionCountKey)) || 0);
// Don't report if a report has been sent already
if (hasReportedContent) {
return;
}
// Check impression count against frequency limit
if (impressionCount < kFreq) {
await sharedStorage.set(impressionCountKey, impressionCount + 1);
return;
}
// Generate the aggregation key and the aggregatable value
const bucket = convertContentIdToBucket(contentId);
const value = 1 * SCALE_FACTOR;
// Send an aggregatable report using the Private Aggregation API
privateAggregation.contributeToHistogram({ bucket, value });
// Set the report submission status flag
await sharedStorage.set(hasReportedContentKey, 'true');
}
}
// Register the operation
register('k-freq-measurement', KFreqMeasurementOperation); \
意見交換とフィードバックの提供
Shared Storage API の提案は現在議論と開発が進められているため、変更される可能性があります。
Shared Storage API について、ぜひご意見をお聞かせください。
- 提案書: 詳細な提案書を確認します。
- ディスカッション: 進行中のディスカッションに参加して、質問したり、分析情報を共有したりできます。
最新情報を入手する
- メーリング リスト: メーリング リストに登録すると、Shared Storage API に関する最新情報やお知らせを受け取ることができます。
ご不明な点がある場合
- デベロッパー サポート: プライバシー サンドボックス デベロッパー サポート リポジトリで他のデベロッパーと交流し、質問に答えてもらうことができます。