K+ フリークエンシー リーチを測定する

「効果的な頻度」と表現されることもあります。多くの場合、一定回数以上視聴されたユーザーが特定のコンテンツを認識または想起するまでは、広告視聴のコンテキストでよく使用されます。共有ストレージを使用して、コンテンツを K 回以上見たユニーク ユーザーのレポートを作成できます。

Shared Storage API は、汎用のクロスサイト ストレージ向けのプライバシー サンドボックスの提案で、多くのユースケースに対応しています。Private Aggregation API は、共有ストレージで使用できる出力で、クロスサイト データを集約できます。

K+ 頻度測定を試す

共有ストレージとプライベート アグリゲーションで K+ の周波数測定をテストするには、Chrome M107 以降を使用していることを確認してください。chrome://settings/adPrivacy で、すべての広告プライバシー API を有効にします。

コマンドラインで --enable-features=PrivacySandboxAdsAPIsOverride,OverridePrivacySandboxSettingsLocalTesting,SharedStorageAPI,FencedFrames フラグを使用して共有ストレージを有効にすることもできます。

コードサンプルでテストする

複数のサイトをまたいで、1 つのクライアントで K 回以上お客様のコンテンツを閲覧したユーザーの数を測定したい場合もあるでしょう。この例では、インプレッション数は共有ストレージに追加され、コンテンツが読み込まれるたびに 1 ずつ増えます。インプレッション数が 3 に達すると、Private Aggregation API が呼び出されます。Content ID ディメンションが集計キーとしてエンコードされ、そのカウントが集計可能な値として使用されます。概要レポートには、「約 391 人のユーザーが広告キャンペーン ID 123 を 3 回以上表示した」などの情報が表示されます。

この例では、次のようになります。

  • 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();

k-frequency-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 simply 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 this.sharedStorage.get(hasReportedContentKey)) === 'true';
    const impressionCount = parseInt((await this.sharedStorage.get(impressionCountKey)) || 0);

    // Do not report if a report has been sent already
    if (hasReportedContent) {
      return;
    }

    // Check impression count against frequency limit
    if (impressionCount < kFreq) {
      await this.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 via the Private Aggregation API
    privateAggregation.contributeToHistogram({ bucket, value });

    // Set the report submission status flag
    await this.sharedStorage.set(hasReportedContentKey, 'true');
  }
}

// Register the operation

register('k-freq-measurement', KFreqMeasurementOperation); \

フィードバックを共有

共有ストレージの提案は現在検討中であり、将来変更される可能性があります。この API をお試しいただき、フィードバックがございましたら、ぜひお寄せください。