소개
Offerwall Custom Choice API를 사용하면 Google Ad Manager의 Offerwall에 자체 맞춤 수익 창출 솔루션을 통합할 수 있습니다.
자체 수익 창출 솔루션을 Offerwall과 통합하려면 맞춤 선택 설정 단계를 따르세요. 요약:
Ad Manager의 개인 정보 보호 및 메시지 탭에서 Offerwall의 '맞춤 선택' 옵션을 사용 설정합니다.
Offerwall을 게시한 사이트의
<head>
및</head>
태그 사이에 맞춤 JavaScript를 추가합니다.다음 섹션에 정의된 대로
CustomOfferwallChoice
객체를 인스턴스화하고 창에서 Offerwall에 등록합니다.
샘플 코드
빠르게 시작하려면 Offerwall Custom Choice API 구현의 작동하는 샘플을 참고하세요.
API 사용량
CustomOfferwallChoice
는 맞춤 수익 창출 구현을 통합하기 위해 Offerwall에 플러그인하는 JavaScript 객체입니다.
// Define your custom choice.
class CustomOfferwallChoice {
// Initialize your custom choice, which may include loading or preparing any
// resources required to function.
async initialize(params: InitializeParams): Promise<InitializeResponseEnum> {...}
// Show your custom choice on the web page, which may be a subscription
// service, micropayments service, rewarded ad, etc.
async show(): Promise<boolean> {...}
}
// Register your custom choice with your Offerwall.
window.googlefc = window.googlefc || {};
window.googlefc.offerwall = window.googlefc.offerwall || {};
window.googlefc.offerwall.customchoice = window.googlefc.offerwall.customchoice || {};
window.googlefc.offerwall.customchoice.registry = new CustomOfferwallChoice();
메서드 정의
이 섹션에서는 CustomOfferwallChoice
가 구현해야 하는 각 메서드를 설명합니다.
initialize
initialize(params: InitializeParams): Promise<InitializeResponseEnum>
맞춤 수익 창출 솔루션을 초기화합니다. 이 함수는 다른 함수보다 먼저 호출되며, 지정된 페이지 로드에서 최대 한 번 호출될 수 있습니다.
예
async initialize(params: InitializeParams): Promise<InitializeResponseEnum> {
// If your custom choice is inoperable on this page, return CUSTOM_CHOICE_DISABLED,
// causing your Offerwall to exclude the custom choice option when rendering.
const isCustomChoiceEnabled: boolean = await this.initializeCustomOfferwallChoice(params);
if (!isCustomChoiceEnabled) {
resolve(googlefc.offerwall.customchoice.InitializeResponseEnum.CUSTOM_CHOICE_DISABLED);
}
// If the user should automatically be granted page access on page load, return
// ACCESS_GRANTED, causing your Offerwall to be ineligible to render on this page.
const isAccessGranted: boolean = await this.shouldUserBeGrantedPageAccess();
if (isAccessGranted) {
resolve(googlefc.offerwall.customchoice.InitializeResponseEnum.ACCESS_GRANTED);
}
// If the user shouldn't automatically be granted page access on page load, return
// ACCESS_NOT_GRANTED, causing your Offerwall to be eligible to render on this page.
resolve(googlefc.offerwall.customchoice.InitializeResponseEnum.ACCESS_NOT_GRANTED);
}
표시
show(): Promise<boolean>
맞춤 수익 창출 솔루션을 렌더링하고 사용자의 수익 창출 작업을 처리합니다. 이 메서드는 사용자가 맞춤 선택 옵션을 클릭할 때 Offerwall에 의해 호출됩니다. 수익 창출은 구독 서비스, 소액 결제 서비스, 보상형 광고 등 다양한 형태로 이루어질 수 있습니다. 호출되면 이 프로미스가 해결될 때까지 오퍼월이 숨겨지며 그동안 페이지 콘텐츠를 관리하는 것은 CustomOfferwallChoice
의 책임입니다. 이 약속이 해결되면 CustomOfferwallChoice
가 웹페이지에 더 이상 표시되지 않아야 합니다.
show()
함수의 프로미스가 해결되면 다음을 수행해야 합니다.
렌더링된 수익 창출 솔루션을 숨깁니다.
사용자가 페이지 콘텐츠에 액세스했는지 여부를 나타내는 불리언 값을 반환합니다.
true
: 사용자가 페이지 콘텐츠에 액세스했습니다. 이 경우 약속이 해결되면 Offerwall이 다시 렌더링되지 않습니다.false
: 사용자가 페이지 콘텐츠에 액세스하지 못했습니다. 이 경우 프로미스가 해결되면 Offerwall이 다시 렌더링됩니다.
예
async show(): Promise<boolean> {
// Show your custom choice dialog and hide it once the user completes an action.
const didUserGainAccessToPage: boolean = await this.showCustomChoiceDialogUntilUserAction();
resolve(didUserGainAccessToPage);
}
맞춤 선택 등록
등록에는 인스턴스화된 CustomOfferwallChoice
객체를 다음 창 등록 기관에 전달하는 작업이 포함됩니다.
window.googlefc.offerwall.customchoice.registry
예
// Register your custom choice with your Offerwall.
window.googlefc = window.googlefc || {};
window.googlefc.offerwall = window.googlefc.offerwall || {};
window.googlefc.offerwall.customchoice = window.googlefc.offerwall.customchoice || {};
window.googlefc.offerwall.customchoice.registry = new CustomOfferwallChoice();
API 유형 정의
이 섹션에서는 API의 각 데이터 유형을 설명합니다.
개체 정의
이 섹션에서는 API의 각 객체 정의를 설명합니다.
InitializeParams
initialize 함수의 매개변수 객체 유형입니다.
속성 | 유형 | 설명 |
---|---|---|
offerwallLanguageCode |
string | undefined |
BCP 47에 정의된 대로 게재되는 오퍼월의 언어 코드입니다. |
열거형 정의
이 섹션에서는 API의 각 enum 정의를 설명합니다.
googlefc.offerwall.customchoice.InitializeResponseEnum
initialize 함수의 응답 enum 유형입니다.
열거형 멤버 | 설명 |
---|---|
CUSTOM_CHOICE_DISABLED
|
Offerwall에서 맞춤 선택 옵션을 사용 중지합니다. 맞춤 선택이 사용 중지된 경우 Offerwall은 자격 요건을 충족하는 다른 선택사항과 함께만 렌더링될 수 있습니다. 자격 요건을 충족하는 다른 선택사항이 없는 경우 Offerwall은 페이지에 렌더링되지 않습니다. |
ACCESS_GRANTED |
페이지 로드 시 사용자 페이지 액세스 권한을 부여합니다. 이 응답이 반환되면 Offerwall이 페이지에 렌더링되지 않습니다. |
ACCESS_NOT_GRANTED |
페이지 로드 시 사용자 페이지 액세스 권한을 부여하지 마세요. 이 응답이 반환되면 Offerwall이 페이지에 렌더링될 수 있습니다. |