কন্টেন্ট নির্মাতারা প্রায়শই তাদের দর্শকদের জনসংখ্যাতাত্ত্বিক তথ্য বুঝতে চান। আপনি শেয়ার্ড স্টোরেজ ব্যবহার করে ব্যবহারকারীর জনসংখ্যাতাত্ত্বিক তথ্য রেকর্ড করতে পারেন যেখানে আপনার কাছে এটি আছে, যেমন আপনার প্রথম পক্ষের সাইট, এবং তারপর সমষ্টিগত প্রতিবেদন ব্যবহার করে অন্যান্য সাইটের প্রতিবেদনে, যেমন আপনার এমবেডেড কন্টেন্ট, সেই তথ্য অন্তর্ভুক্ত করতে পারেন।
শেয়ার্ড স্টোরেজ API হল সাধারণ উদ্দেশ্যে, ক্রস-সাইট স্টোরেজের জন্য একটি প্রাইভেসি স্যান্ডবক্স প্রস্তাব, যা অনেক সম্ভাব্য ব্যবহারের ক্ষেত্রে সমর্থন করে। প্রাইভেট অ্যাগ্রিগেশন API হল শেয়ার্ড স্টোরেজে উপলব্ধ একটি আউটপুট যা আপনাকে ক্রস-সাইট ডেটা একত্রিত করতে দেয়।
ব্যবহারকারীর জনসংখ্যাতাত্ত্বিক পরিমাপ চেষ্টা করুন
শেয়ার্ড স্টোরেজ এবং প্রাইভেট অ্যাগ্রিগেশনের মাধ্যমে ব্যবহারকারীর জনসংখ্যাতাত্ত্বিক পরিমাপ পরীক্ষা করতে, নিশ্চিত করুন যে আপনি Chrome Canary এবং Dev M107 বা তার পরবর্তী সংস্করণ ব্যবহার করছেন। chrome://settings/adPrivacy এর অধীনে সমস্ত বিজ্ঞাপন গোপনীয়তা API সক্ষম করুন।
আপনি কমান্ড লাইনে --enable-features=PrivacySandboxAdsAPIsOverride,OverridePrivacySandboxSettingsLocalTesting,SharedStorageAPI,FencedFrames ফ্ল্যাগ ব্যবহার করেও Shared Storage সক্ষম করতে পারেন।
কোড নমুনা নিয়ে পরীক্ষা-নিরীক্ষা করুন
আপনি বিভিন্ন সাইট জুড়ে আপনার কন্টেন্ট দেখেছেন এমন ব্যবহারকারীদের নির্দিষ্ট জনসংখ্যাতাত্ত্বিক তথ্য পরিমাপ করতে চাইতে পারেন, উদাহরণস্বরূপ বয়সসীমা বা ভৌগোলিক অবস্থান। এই উদাহরণে, কন্টেন্ট আইডি, বয়স গ্রুপ আইডি এবং ভৌগোলিক আইডির মাত্রাগুলি অ্যাগ্রিগেশন কী (বাকেট) তে এনকোড করা হয়েছে এবং গণনাটি সমষ্টিগত মান হিসাবে ব্যবহৃত হয়। তৈরি করা সারসংক্ষেপ প্রতিবেদনে "প্রায় ৩৯১ জন ব্যবহারকারী যারা কন্টেন্ট আইডি ১২৩ দেখেছেন তাদের বয়স ১৮-৩৯ বছরের মধ্যে এবং তারা ইউরোপ থেকে এসেছেন" এর মতো তথ্য প্রদান করা হবে।
এই উদাহরণে:
-
demographic-measurement.jsএকটি ফ্রেম ব্যবহার করে লোড করা হয় এবং শেয়ার্ড স্টোরেজ ওয়ার্কলেট লোড করার জন্য দায়ী। -
demographic-measurement-worklet.jsহল শেয়ার্ড স্টোরেজ ওয়ার্কলেট যা শেয়ার্ড স্টোরেজে ডেমোগ্রাফিক ডেটা পড়ে এবং Private Aggregation API ব্যবহার করে একটি রিপোর্ট পাঠায়।
(জনসংখ্যাগত তথ্য শেয়ার্ড স্টোরেজে সেট করার জন্য পরিমাপ করার আগে কোনও এক সময়ে এটি চলে)
function getDemogrationsData() {
// Collect age group and continent data
return {
ageGroup,
continent
}
}
async function storeDemographics() {
const { ageGroup, continent } = getDemographicsData();
await window.sharedStorage.set('age-group', ageGroup);
await window.sharedStorage.set('continent', continent);
}
storeDemographics();
async function measureDemographics() {
// Load the Shared Storage worklet
await window.sharedStorage.worklet.addModule('demographics-measurement-worklet.js');
// Run the demographics measurement operation
await window.sharedStorage.run('demographics-measurement', { data: { contentId: '123' } });
}
measureDemographics();
demographic-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 just the ad campaign
* ID itself. For more complex bucket key construction, see other use cases in
* this demo.
*/
const AGGREGATION_KEY_MAP = {
ageGroupId: {
'18-39': '1',
'40-64': '2',
'65+': '3',
},
continentId: {
africa: '1',
antarctica: '2',
asia: '3',
australia: '4',
europe: '5',
'north-america': '6',
'south-america': '7',
},
};
/**
* The aggregation key will be in the format of:
* contentId | ageGroupId | continentId
*
* For example, a user from Australia between the age of 40-64, who has
* seen the Content ID 321 will be represented by the key:
* 321 | 2 | 4 or 32124
*/
function generateAggregationKey(contentId, ageGroup, continent) {
const ageGroupId = AGGREGATION_KEY_MAP.ageGroupId[ageGroup];
const continentId = AGGREGATION_KEY_MAP.continentId[continent];
const aggregationKey = BigInt(`${contentId}${ageGroupId}${continentId}`);
return aggregationKey;
}
class DemographicsMeasurementOperation {
async run(data) {
const { contentId } = data;
// Read from Shared Storage
const key = 'has-reported-content';
const hasReportedContent = (await sharedStorage.get(key)) === 'true';
const ageGroup = await sharedStorage.get('age-group');
const continent = await sharedStorage.get('continent');
// Don't report if a report has been sent already
if (hasReportedContent) {
return;
}
// Generate the aggregation key and the aggregatable value
const bucket = generateAggregationKey(contentId, ageGroup, continent);
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('demographics-measurement', DemographicsMeasurementOperation); \
অংশগ্রহণ করুন এবং মতামত শেয়ার করুন
মনে রাখবেন যে শেয়ার্ড স্টোরেজ API প্রস্তাবটি সক্রিয় আলোচনা এবং উন্নয়নাধীন এবং তাই পরিবর্তন সাপেক্ষে।
শেয়ার্ড স্টোরেজ API সম্পর্কে আপনার মতামত শুনতে আমরা আগ্রহী।
- প্রস্তাব : বিস্তারিত প্রস্তাবটি পর্যালোচনা করুন।
- আলোচনা : প্রশ্ন জিজ্ঞাসা করতে এবং আপনার অন্তর্দৃষ্টি ভাগ করে নিতে চলমান আলোচনায় যোগ দিন।