순 사용자 도달범위 측정

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

Shared Storage API는 다양한 사용 사례를 지원하는 범용 크로스 사이트 스토리지를 위한 개인 정보 보호 샌드박스 제안입니다. Private Aggregation API는 크로스 사이트 데이터를 집계할 수 있는 Shared Storage의 출력입니다. 이러한 측정을 구현하는 방법을 자세히 알아보려면 도달범위 백서를 확인하세요.

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

Shared Storage 및 Private Aggregation으로 고유 도달범위 측정을 실험하려면 Chrome M107 이상을 사용하고 있는지 확인하세요. chrome://settings/adPrivacy 아래의 모든 광고 개인 정보 보호 API를 사용 설정합니다.

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

코드 샘플로 실험하기

여러 사이트에서 내 콘텐츠를 본 순수 사용자 수를 추적할 수 있습니다. 이 예시에서 콘텐츠 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 sharedStorage.get(key)) === 'true';

    // Don't 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 using the Private Aggregation API
    privateAggregation.contributeToHistogram({ bucket, value });

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

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

Engage and share feedback

Note that the Shared Storage API proposal is under active discussion and development and therefore subject to change.

We're eager to hear your thoughts on the Shared Storage API.

Stay Informed

  • Mailing List: Subscribe to our mailing list for the latest updates and announcements related to the Shared Storage API.

Need Help?