テストモード
    
    
      
    
    
      
      コレクションでコンテンツを整理
    
    
      
      必要に応じて、コンテンツの保存と分類を行います。
    
  
    
  
      
    
  
  
  
  
  
  
    
    
    
adBreak() の統合をテストする
adBreak() API を使用する JavaScript コードをテストするために、adsbygoogle.js に data-adbreak-test="on" 属性を追加することで有効にできるテストモードが用意されています。
<script async
      data-adbreak-test="on"
      src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-123456789"
      crossorigin="anonymous">
</script>
<script>
   window.adsbygoogle = window.adsbygoogle || [];
   var adBreak = adConfig = function(o) {adsbygoogle.push(o);}
</script>
テストモード:
- 実際の広告をリクエストするのではなく、疑似広告を表示します。
 
- 設定されている広告の表示頻度など、実際の広告の動作を模倣します。
 
console.log またはブレークポイントを使用して、adBreakDone() と placementInfo をデバッグします。 
注: テストモードでは、広告リクエストを Google サーバーに送信せずにクライアント側の JavaScript のみをテストできます。AdSense コードの誤設定(無効な「data-ad-client」など)に関する問題を検出することはできません。
テストモードは、広告が読み込まれる状況と広告が読み込まれない状況の 2 つのシナリオで繰り返されます。これは、広告が常に利用できるとは限らない実際の環境をエミュレートするためです。
  
  
  
 
  
    
    
      
    
    
  
       
    
    
  
  
  特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
  最終更新日 2025-07-26 UTC。
  
  
  
    
      [[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-07-26 UTC。"],[],["To test `adBreak()` API integration, enable testing mode by adding `data-adbreak-test=\"on\"` to the `adsbygoogle.js` script. This mode displays mock ads, mimicking real ad behavior, but does not send real ad requests. It cycles between ad loaded and not loaded scenarios. Use `console.log` or breakpoints to debug `adBreakDone()` and `placementInfo`. This method helps test client-side JavaScript, but it cannot detect issues related to AdSense code misconfiguration.\n"]]