K+ 게재빈도 도달범위 측정

'유효 게재빈도'라고도 하며, 최소 조회수가 있어야 사용자가 특정 콘텐츠를 인식하거나 떠올릴 수 있습니다 (보통 광고 조회수와 관련됨). 공유 저장소를 사용하여 콘텐츠를 K회 이상 본 순 사용자에 대한 보고서를 작성할 수 있습니다.

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

K+ 게재빈도 측정 사용해 보기

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

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

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

코드 샘플로 실험

여러 사이트에서 특정 고객에 대해 내 콘텐츠를 K회 이상 본 사용자 수를 측정할 수 있습니다. 이 예에서는 공유 저장공간에 노출수가 추가되어 콘텐츠가 로드될 때마다 노출수가 1씩 증가합니다. 노출 수가 3에 도달하면 Private Aggregation API가 호출됩니다. 콘텐츠 ID 측정기준은 집계 키로 인코딩되며 개수는 집계 가능한 값으로 사용됩니다. 요약 보고서는 '약 391명의 사용자가 광고 캠페인 ID 123을 3번 이상 봤습니다.'와 같은 정보를 제공합니다.

이 예에서

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

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

// Register the operation

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

참여 및 의견 공유

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