기사 페이지에 CMS 동기화 스니펫이 있는 경우 스크립트의 기본 동작을 수정할 수 있습니다. 기존 참여자 또는 구독자를 위해 광고를 숨길 수 있습니다.
팁
- 광고를 숨기려면 자바스크립트 사용 방법을 알아야 합니다.
- CMS 동기화 스니펫을 수정하려면 초기화 후
setOnEntitlementsResponse
함수 블록을 삽입하세요. 이 함수는swg-basic.js
Entitlements API를 호출하여 독자가 이미 참여자 또는 구독자인지 확인하고 프로미스를 반환합니다.
- 반환된 사용 권한이 있는지 확인하려면
dismissSwgUI
함수를 호출하여 대화상자를 숨깁니다.
업데이트된 코드 스니펫 사용 예시
자바스크립트
(self.SWG_BASIC = self.SWG_BASIC || []).push(basicSubscriptions => {
basicSubscriptions.setOnEntitlementsResponse(entitlementsPromise => {
entitlementsPromise.then(entitlements => {
// Indicates that the user is subscriber or contributor
if (entitlements.enablesThisWithCacheableEntitlements()) {
// hide the SwG dialog
basicSubscriptions.dismissSwgUI();
// Insert logic to disable ads, depending on your ad network provider
}
});
});
basicSubscriptions.init({
type: "NewsArticle",
isPartOfType: ["Product"],
isPartOfProductId: "<your product id>",
clientOptions: { lang: "en" },
});
});