알림

최근에 간행물 페이지에 대한 업데이트를 공지해 드렸습니다. 자세한 내용은 여기를 참고하세요.

광고 숨기기

기사 페이지에 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" },

    });

  });

검색
검색어 지우기
검색 닫기
기본 메뉴
788468232655957277
true
도움말 센터 검색
true
true
true
true
true
100499
false
false