ユニークリーチの測定

多くのコンテンツ制作者や広告主は、自分のコンテンツを視聴したユニーク ユーザー数を知りたがっています。共有ストレージを使用して、ユーザーが広告、埋め込み動画、またはパブリケーションを最初に見た時刻を記録し、同じユーザーが異なるサイトで重複してカウントされないようにします。Private Aggregation API を使用して、リーチの概要レポートを生成できます。

Shared Storage API はプライバシー さまざまな用途をサポートする汎用のクロスサイト ストレージ向けのサンドボックス案 見ていきましょう。Private Aggregation API は、共有ストレージで使用できる出力で、クロスサイト データを集約できます。 こうした測定を実施する方法について詳しくは、リーチに関するホワイトペーパーをご覧ください。

ユニークリーチ測定をお試しください

共有ストレージとプライベート集計を使用してユニークリーチの測定をテストするには、Chrome M107 以降を使用していることを確認してください。chrome://settings/adPrivacy で、すべての広告プライバシー API を有効にします。

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

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

複数のサイトでコンテンツを閲覧したユニーク ユーザーの数をトラッキングしたい場合もあるでしょう。この例では、Content ID ディメンションが集計キー(バケット)にエンコードされ、カウントが集計可能な値として使用されます。概要レポートには、「コンテンツ ID 123 を視聴した約 391 人のユーザー」などの情報が含まれます。

この例では、 * unique-reach-measurement.js はフレームを介して読み込まれ、共有ストレージ ワークレットを読み込む役割を担います。 * unique-reach-measurement-worklet.js は、共有ストレージのフラグを確認し、Private Aggregation API を介してレポートを送信する共有ストレージ ワークレットです。

reach-measurement.js

async function measureUniqueReach() {
  // Load the Shared Storage worklet
  await window.sharedStorage.worklet.addModule('reach-measurement-worklet.js');

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

measureUniqueReach();

reach-measurement-worklet.js

// Learn more about noise and scaling from the Private Aggregation fundamentals
// documentation on Chrome blog
const SCALE_FACTOR = 65536;

function convertContentIdToBucket(contentId) {
  return BigInt(contentId);
}

class ReachMeasurementOperation {
  async run(data) {
    const { contentId } = data;

    // Read from Shared Storage
    const key = 'has-reported-content';
    const hasReportedContent = (await this.sharedStorage.get(key)) === 'true';

    // Do not report if a report has been sent already
    if (hasReportedContent) {
      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(key, true);
  }
}

// Register the operation
register('reach-measurement', ReachMeasurementOperation);

対応してフィードバックを共有する

共有ストレージの提案は現在検討中であり、変更される可能性があります 使用できます。この API をお試しいただき、ご意見やご感想がございましたら、ぜひお聞かせください。