การวัด Unique Reach

ผู้ผลิตเนื้อหาและผู้ลงโฆษณาหลายรายต้องการทราบจำนวนผู้ใช้ที่ไม่ซ้ำที่ดูเนื้อหาของตน ใช้พื้นที่เก็บข้อมูลที่ใช้ร่วมกันเพื่อบันทึกครั้งแรกที่ผู้ใช้เห็นโฆษณา วิดีโอที่ฝัง หรือสื่อเผยแพร่ และป้องกันไม่ให้มีการนับผู้ใช้รายเดียวกันซ้ำในเว็บไซต์ต่างๆ จากนั้นก็ใช้ Private Aggregation API เพื่อแสดงรายงานสรุปสำหรับการเข้าถึงได้

Shared Storage API เป็นนโยบายความเป็นส่วนตัว ข้อเสนอแซนด์บ็อกซ์สำหรับจุดประสงค์ทั่วไป พื้นที่เก็บข้อมูลข้ามเว็บไซต์ ซึ่งสนับสนุน Use Case ที่เป็นไปได้ Private Aggregation API เป็นเอาต์พุตที่พร้อมใช้งานในพื้นที่เก็บข้อมูลที่ใช้ร่วมกันซึ่งช่วยให้คุณรวบรวมข้อมูลข้ามเว็บไซต์ได้ ดูข้อมูลเพิ่มเติมเกี่ยวกับวิธีดำเนินการตามการวัดผลได้จากสมุดปกขาวเพื่อการเข้าถึง

ลองใช้การวัด Unique Reach

หากต้องการทดสอบการวัด Unique Reach กับพื้นที่เก็บข้อมูลที่ใช้ร่วมกันและการรวมข้อมูลส่วนตัว โปรดยืนยันว่าคุณกำลังใช้ Chrome M107 ขึ้นไป เปิดใช้ API ความเป็นส่วนตัวเกี่ยวกับโฆษณาทั้งหมดใน chrome://settings/adPrivacy

นอกจากนี้คุณยังเปิดใช้พื้นที่เก็บข้อมูลที่ใช้ร่วมกันได้ด้วยแฟล็ก --enable-features=PrivacySandboxAdsAPIsOverride,OverridePrivacySandboxSettingsLocalTesting,SharedStorageAPI,FencedFrames ในบรรทัดคำสั่ง

การทดสอบกับตัวอย่างโค้ด

คุณอาจต้องการติดตามจำนวนผู้ใช้ที่ไม่ซ้ำที่ดูเนื้อหาของคุณในเว็บไซต์ต่างๆ ในตัวอย่างนี้ มิติข้อมูล Content ID จะเข้ารหัสลงในคีย์การรวม (ที่เก็บข้อมูล) และระบบจะใช้จำนวนนับเป็นค่าที่รวมได้ รายงานสรุปจะมีข้อมูล เช่น "ผู้ใช้ประมาณ 391 คนเห็น Content ID 123"

ซึ่งในตัวอย่างนี้ * 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';

    // 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 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?