A/B পরীক্ষা চালানোর জন্য একটি শেয়ার্ড স্টোরেজ ওয়ার্কলেট ব্যবহার করুন।
শেয়ার্ড স্টোরেজ API হল সাধারণ উদ্দেশ্যে, ক্রস-সাইট স্টোরেজের জন্য একটি গোপনীয়তা স্যান্ডবক্স প্রস্তাব, যা অনেক সম্ভাব্য ব্যবহারের ক্ষেত্রে সমর্থন করে। এরকম একটি উদাহরণ হল A/B টেস্টিং, যা Chrome 104.0.5086.0 এবং পরবর্তীতে পরীক্ষা করার জন্য উপলব্ধ৷
আপনি একটি ব্যবহারকারীকে একটি পরীক্ষামূলক গোষ্ঠীতে বরাদ্দ করতে পারেন, তারপর একটি ক্রস-সাইট পরিবেশে অ্যাক্সেস করার জন্য শেয়ার্ড স্টোরেজে সেই গ্রুপটিকে সংরক্ষণ করুন৷
A/B পরীক্ষা করে দেখুন
শেয়ার্ড স্টোরেজের সাথে A/B টেস্টিং পরীক্ষা করতে, আপনি Chrome 104.0.5086.0 বা তার পরে ব্যবহার করছেন তা নিশ্চিত করুন। chrome://settings/adPrivacy
এর অধীনে সমস্ত বিজ্ঞাপন গোপনীয়তা API সক্রিয় করুন।
আপনি কমান্ড লাইনে --enable-features=PrivacySandboxAdsAPIsOverride,OverridePrivacySandboxSettingsLocalTesting,SharedStorageAPI,FencedFrames
পতাকা সহ শেয়ার করা স্টোরেজ সক্ষম করতে পারেন।
কোড নমুনা সঙ্গে পরীক্ষা
একটি পরীক্ষার পছন্দসই প্রভাব আছে কিনা তা দেখতে, আপনি একাধিক সাইট জুড়ে A/B পরীক্ষা চালাতে পারেন। একজন বিজ্ঞাপনদাতা বা বিষয়বস্তু প্রযোজক হিসেবে, ব্যবহারকারীকে কোন গ্রুপে নিয়োগ করা হয়েছে তার উপর ভিত্তি করে আপনি বিভিন্ন বিষয়বস্তু বা বিজ্ঞাপন রেন্ডার করতে বেছে নিতে পারেন। গ্রুপ অ্যাসাইনমেন্ট শেয়ার্ড স্টোরেজ সংরক্ষণ করা হয়, কিন্তু exfiltrated করা যাবে না.
এই উদাহরণে:
-
ab-testing.js
একটি ফ্রেমে এম্বেড করা উচিত, যা একটি নিয়ন্ত্রণ এবং দুটি পরীক্ষার বিষয়বস্তু ম্যাপ করে। স্ক্রিপ্টটি পরীক্ষার জন্য ভাগ করা স্টোরেজ ওয়ার্কলেটকে কল করে। -
ab-testing-worklet.js
হল শেয়ার্ড স্টোরেজ ওয়ার্কলেট যা ব্যবহারকারীকে কোন গ্রুপে বরাদ্দ করা হয়েছে, কোন বিজ্ঞাপন দেখানো হবে তা নির্ধারণ করে।
// Randomly assigns a user to a group 0 or 1
function getExperimentGroup() {
return Math.round(Math.random());
}
async function injectContent() {
// Register the Shared Storage worklet
await window.sharedStorage.worklet.addModule('ab-testing-worklet.js');
// Assign user to a random group (0 or 1) and store it in Shared Storage
window.sharedStorage.set('ab-testing-group', getExperimentGroup(), {
ignoreIfPresent: true,
});
// Run the URL selection operation
const fencedFrameConfig = await window.sharedStorage.selectURL(
'ab-testing',
[
{ url: `https://your-server.example/content/default-content.html` },
{ url: `https://your-server.example/content/experiment-content-a.html` }
],
{
resolveToConfig: true
}
);
// Render the chosen URL into a fenced frame
document.getElementById('content-slot').config = fencedFrameConfig;
}
injectContent();
class SelectURLOperation {
async run(urls, data) {
// Read the user's experiment group from Shared Storage
const experimentGroup = await sharedStorage.get('ab-testing-group');
// Return the corresponding URL (first or second item in the array)
return urls.indexOf(experimentGroup);
}
}
register('ab-testing', SelectURLOperation);
Use cases
All available use cases for Select URL API can be found in this section. We'll continue to add examples as we receive feedback and discover new test cases.
- Rotate ad creatives: Store data, such as creative ID and user interaction, to determine which creative users' see across different sites.
- Select ad creatives by frequency: Use view count data to determine which creative users' see across different sites.
- Run A/B testing: You can assign a user to an experiment group, then store that group in Shared Storage to be accessed cross-site.
- Customize experience for known customers: Share custom content and calls-to-action based on a user's registration status or other user states.
Engage and share feedback
Note that the Select URL API proposal is under active discussion and development and subject to change.
We're eager to hear your thoughts on the Select URL API.
- Proposal: Review the detailed proposal.
- Discussion: Join the ongoing discussion to ask questions and share your insights.
Stay Informed
- Mailing List: Subscribe to our mailing list for the latest updates and announcements related to the Select URL and Shared Storage APIs.
Need Help?
- Developer Support: Connect with other developers and get answers to your questions in the Privacy Sandbox Developer Support repository.