Shared Storage 워크렛을 사용하여 사전 분류된 고객을 식별합니다.
Shared Storage API는 다양한 사용 사례를 지원하는 범용 크로스 사이트 스토리지를 위한 개인 정보 보호 샌드박스 제안입니다. 한 가지 예로 Chrome 104.0.5086.0 이상에서 테스트할 수 있는 알려진 고객 식별을 들 수 있습니다.
사용자가 사이트에 등록했는지 여부를 Shared Storage에 저장한 다음 저장된 사용자 상태 (사용자가 '알려진' 고객인지 여부)에 따라 별도의 요소를 렌더링할 수 있습니다.
알려진 고객 설정
공유 저장소에서 알려진 고객을 식별하는 실험을 하려면 Chrome 104.0.5086.0 이상을 사용하고 있는지 확인하세요. chrome://settings/adPrivacy
아래의 모든 광고 개인 정보 보호 API를 사용 설정합니다.
명령줄에서 --enable-features=PrivacySandboxAdsAPIsOverride,OverridePrivacySandboxSettingsLocalTesting,SharedStorageAPI,FencedFrames
플래그를 사용하여 공유 저장소를 사용 설정할 수도 있습니다.
코드 샘플로 실험하기
사용자가 다른 사이트에서 확인되었는지에 따라 다른 요소를 렌더링할 수 있습니다. 예를 들어 결제 제공업체는 사용자가 결제 제공업체의 사이트에 등록했는지에 따라 '등록' 또는 '지금 구매' 버튼을 렌더링할 수 있습니다. 공유 저장소는 사용자 상태를 설정하고 해당 상태에 따라 사용자 환경을 맞춤설정하는 데 사용할 수 있습니다.
이 예에서는 다음과 같이 정의됩니다.
known-customer.js
가 프레임에 삽입됩니다. 이 스크립트는 사이트에 표시할 버튼('등록' 또는 '지금 구매')의 옵션을 설정합니다.known-customer-worklet.js
는 사용자가 알려진 사용자인지 확인하는 공유 저장소 워크렛입니다. 사용자가 알려진 경우 정보가 반환됩니다. 알 수 없는 사용자인 경우 이 정보가 반환되어 '등록' 버튼이 표시되고 나중에 사용자를 알 수 있는 사용자로 표시됩니다.
// The first URL for the "register" button is rendered for unknown users.
const BUTTON_URLS = [
{ url: `https://${advertiserUrl}/ads/register-button.html` },
{ url: `https://${advertiserUrl}/ads/buy-now-button.html` },
];
async function injectButton() {
// Load the worklet module
await window.sharedStorage.worklet.addModule('known-customer-worklet.js');
// Set the initial status to unknown ('0' is unknown and '1' is known)
window.sharedStorage.set('known-customer', 0, {
ignoreIfPresent: true,
});
// Run the URL selection operation to choose the button based on the user status
const fencedFrameConfig = await window.sharedStorage.selectURL('known-customer', BUTTON_URLS, {
resolveToConfig: true
});
// Render the opaque URL into a fenced frame
document.getElementById('button-slot').src = fencedFrameConfig;
}
injectButton();
class SelectURLOperation {
async run(urls) {
const knownCustomer = await sharedStorage.get('known-customer');
// '0' is unknown and '1' is known
return parseInt(knownCustomer);
}
}
register('known-customer', SelectURLOperation);
사용 사례
Select URL API의 사용 가능한 모든 사용 사례는 이 섹션에서 확인할 수 있습니다. Google은 의견을 받고 새로운 테스트 사례를 발견할 때마다 예시를 계속 추가할 예정입니다.
- 광고 소재 순환: 광고 소재 ID 및 사용자 상호작용과 같은 데이터를 저장하여 사용자가 여러 사이트에서 어떤 광고 소재를 보게 될지 결정합니다.
- 게재빈도별 광고 소재 선택: 조회수 데이터를 사용하여 사용자가 여러 사이트에서 보는 광고 소재를 결정합니다.
- A/B 테스트 실행: 사용자를 실험 그룹에 할당한 후 해당 그룹을 Shared Storage에 저장하여 교차 사이트에서 액세스할 수 있습니다.
- 알려진 고객을 위한 환경 맞춤설정: 사용자의 등록 상태 또는 기타 사용자 상태를 기반으로 맞춤 콘텐츠와 클릭 유도 문구를 공유합니다.
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.