순 사용자 도달범위 측정

많은 콘텐츠 제작자와 광고주는 콘텐츠를 본 순 시청자 수를 알고 싶어 합니다. 공유 저장공간을 사용하여 사용자가 처음 광고, 삽입된 동영상 또는 간행물을 보았을 때를 기록하고, 다른 사이트에서 동일한 사용자가 중복되어 집계되지 않도록 할 수 있습니다. 그런 다음 Private Aggregation API를 사용하여 도달범위에 대한 요약 보고서를 출력할 수 있습니다.

Shared Storage API는 가능한 많은 사용 사례를 지원하는 범용 크로스 사이트 스토리지용 개인 정보 보호 샌드박스 제안서입니다. Private Aggregation API는 Shared Storage에서 사용할 수 있는 출력으로, 이를 통해 크로스 사이트 데이터를 집계할 수 있습니다.

순 사용자 도달범위 측정 사용해 보기

공유 저장소 및 비공개 집계로 순 사용자 도달범위 측정을 실험하려면 Chrome M107 이상을 사용하고 있는지 확인하세요. 그런 다음 chrome://flags/#privacy-sandbox-ads-apis에서 개인 정보 보호 샌드박스 광고 API 실험 플래그를 사용 설정합니다.

이 API를 사용하려면 개인 정보 보호 샌드박스 Ads API 실험을 사용 설정하세요.

명령줄에서 --enable-features=PrivacySandboxAdsAPIsOverride,OverridePrivacySandboxSettingsLocalTesting,SharedStorageAPI,FencedFrames 플래그를 사용하여 공유 저장소를 사용 설정할 수도 있습니다.

코드 샘플로 실험

여러 사이트에서 콘텐츠를 본 순 사용자 수를 추적하고 싶을 수 있습니다. 이 예에서는 콘텐츠 ID 측정기준이 집계 키 (버킷)에 인코딩되며, 개수는 집계 가능한 값으로 사용됩니다. 요약 보고서에는 '약 391명의 사용자가 콘텐츠 ID 123을 확인했습니다.'와 같은 정보가 포함됩니다.

이 예에서 unique-reach-measurement.js는 프레임을 통해 로드되며 공유 저장소 Worklet을 로드하는 역할을 합니다. * unique-reach-measurement-worklet.js는 공유 스토리지의 플래그를 확인하고 Private Aggregation API를 통해 보고서를 전송하는 공유 스토리지 Worklet입니다.

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.sendHistogramReport({ bucket, value });

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

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

참여 및 의견 공유

공유 저장소 제안은 논의 중이며 향후 변경될 수 있습니다. 이 API를 사용해 보고 의견을 보내 주세요.