यूनीक रीच का मेज़रमेंट

कॉन्टेंट बनाने वाले कई लोग और विज्ञापन देने वाले लोग यह जानना चाहते हैं कि कितने यूनीक लोगों ने उनका कॉन्टेंट देखा. Shared Storage का इस्तेमाल करके, यह रिकॉर्ड करें कि किसी उपयोगकर्ता ने पहली बार आपका विज्ञापन, एम्बेड किया गया वीडियो या पब्लिकेशन कब देखा. इससे, अलग-अलग साइटों पर उसी उपयोगकर्ता की डुप्लीकेट गिनती को रोका जा सकता है. इसके बाद, अपनी पहुंच की खास जानकारी वाली रिपोर्ट आउटपुट करने के लिए, Private Aggregation API का इस्तेमाल किया जा सकता है.

Shared Storage API, Privacy Sandbox का एक प्रस्ताव है. इसका मकसद, अलग-अलग कामों के लिए क्रॉस-साइट स्टोरेज उपलब्ध कराना है. इस स्टोरेज का इस्तेमाल कई कामों के लिए किया जा सकता है. Private Aggregation API, Shared Storage में उपलब्ध एक आउटपुट है. इसकी मदद से, अलग-अलग साइटों से जुड़ा डेटा इकट्ठा किया जा सकता है. इन मेज़रमेंट को लागू करने के तरीकों के बारे में ज़्यादा जानने के लिए, पहुंच से जुड़ा व्हाइट पेपर देखें.

यूनीक रीच का मेज़रमेंट आज़माना

Shared Storage और Private Aggregation की मदद से, यूनीक रीच मेज़रमेंट को आज़माने के लिए, पक्का करें कि आपके पास Chrome M107 या उसके बाद का वर्शन हो. chrome://settings/adPrivacy में जाकर, विज्ञापन देखने वाले की निजता बनाए रखने से जुड़े सभी एपीआई चालू करें.

कमांड लाइन में --enable-features=PrivacySandboxAdsAPIsOverride,OverridePrivacySandboxSettingsLocalTesting,SharedStorageAPI,FencedFrames फ़्लैग की मदद से भी, शेयर किया गया स्टोरेज चालू किया जा सकता है.

कोड सैंपल आज़माना

हो सकता है कि आप यह ट्रैक करना चाहें कि अलग-अलग साइटों पर कितने यूनीक उपयोगकर्ताओं ने आपका कॉन्टेंट देखा है. इस उदाहरण में, कॉन्टेंट आईडी डाइमेंशन को एग्रीगेशन बटन (बकेट) में एन्कोड किया गया है. साथ ही, गिनती का इस्तेमाल एग्रीगेट की जा सकने वाली वैल्यू के तौर पर किया गया है. खास जानकारी वाली रिपोर्ट में, "लगभग 391 उपयोगकर्ताओं ने कॉन्टेंट आईडी 123 को देखा है" जैसी जानकारी शामिल होगी.

इस उदाहरण में:

  • unique-reach-measurement.js को फ़्रेम का इस्तेमाल करके लोड किया जाता है. साथ ही, यह शेयर किए गए स्टोरेज के वर्कलेट को लोड करने के लिए ज़िम्मेदार होता है.
  • unique-reach-measurement-worklet.js, Shared Storage के लिए वर्कलेट है. यह Shared Storage में फ़्लैग की जांच करता है और 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);

दर्शकों से जुड़ना और सुझाव, राय या शिकायत शेयर करना

ध्यान दें कि Shared Storage API के प्रस्ताव पर फ़िलहाल चर्चा की जा रही है और इसे डेवलप किया जा रहा है. इसलिए, इसमें बदलाव हो सकते हैं.

हम शेयर किए गए स्टोरेज के एपीआई के बारे में आपके विचार जानना चाहते हैं.

अप-टू-डेट रहना

  • मेल सूची: Shared Storage API से जुड़े नए अपडेट और सूचनाओं के लिए, हमारी मेल सूची की सदस्यता लें.

क्या आपको मदद चाहिए?