通知

Google は先日、パブリケーション ページに関する最新情報を発表しました。詳しくは、こちらをご覧ください。

広告を非表示

CMS 同期スニペットを記事のページに実装したら、スクリプトのデフォルトの動作を変更できます。既存の寄付者や定期購読者向けの広告を非表示にできます。

ヒント: 

  • 広告を非表示にするには、JavaScript の使用方法の確認が必要です。
  • CMS 同期スニペットを編集するには、初期化後に setOnEntitlementsResponse 関数ブロックを挿入します。この関数は、swg-basic.js Entitlements API を呼び出して、読者がすでに寄付者や定期購読者であるかを確認し、Promise を返します。
  • 利用資格が返されているかどうかを確認するには、dismissSwgUI 関数を呼び出してダイアログを非表示にします。

更新されたコード スニペットの使用例

JavaScript

(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" },

    });

  });

検索
検索をクリア
検索を終了
メインメニュー
16309914531603212233
true
ヘルプセンターを検索
true
true
true
true
true
100499
false
false