広告スクリプトを静的に読み込む
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
概要
この監査では、広告スクリプトがページに挿入されているかどうかを確認します。
ページ上の他のリソースにより、挿入されたファイルの取得と読み込みが遅延する可能性がある
変更すると広告の読み込みが遅れます。場合によっては
スクリプトがまったく取得されず、広告をすべて読み込めない
説明します。
推奨事項
非同期スクリプトタグを使用してスクリプトを読み込むと、処理速度が向上します。ブラウザのプリロード スキャナ
レンダリング ブロック リソースがブロックされていても、スクリプトタグを早期に取得できる
自動的にスケールします。
誤 |
<script>
var el = document.createElement('script');
el.src = 'https://securepubads.g.doubleclick.net/tag/js/gpt.js';
var node = document.getElementsByTagName('script')[0];
node.parentNode.insertBefore(el, node);
</script>
|
正 |
<script async src="https://securepubads.g.doubleclick.net/tag/js/gpt.js"></script>
|
挿入された広告スクリプトのソースを特定する
広告スクリプトがページにどのように挿入されているか、
注入される可能性もありますたとえば、ソースを調べるときに
挿入されたスクリプトタグが表示されることがあります
静的に読み込まれたタグと区別が付きません。
このような場合は、Chrome DevTools の [Network] タブを使用してソースを確認します。
挿入された広告スクリプトが含まれます
Control+Shift+J
または Command+Option+J
(Mac)を押して DevTools を開きます。
- [ネットワーク] タブに移動します。
- まだ表示されていない場合は、[フィルタ] をクリックします。
: フィルタバーを開き、
この監査でフラグが付けられたスクリプトの名前をテキスト ボックスに入力します。
- まだ表示されていない場合は、テーブル ヘッダーを右クリックして [
イニシエータ: ネットワーク リクエストにイニシエータ列を含めます。
ウォーターフォールテーブル
- ページを再読み込みして、ネットワーク トラフィックを取得します。
![Chrome DevTools の [Network] タブのスクリーンショット](https://developers-dot-devsite-v2-prod.appspot.com/publisher-ads-audits/reference/audits/images/script-injected-tags-devtools.png?hl=ja)
上のスクリーンショットに示すように、[Initiator(開始者)] 列には
該当するスクリプトのソースに関する情報を入力します。ソースリンクをクリックすると
広告リクエストを発行するコードに直接移動できます。
ソースリンクにカーソルを合わせると、リクエストに至るまでのすべての呼び出しが表示されます。
この監査は、安全性が確認されている広告スクリプトの許可リストに基づいて行われます。
静的に読み込みます現在のリストは次のとおりです。
ライブラリ |
スクリプト |
AdSense |
pagead2.googlesyndication.com/pagead/js/adsbygoogle.js
|
Amazon パブリッシャー サービス |
amazon-adsystem.com/aax2/apstag.js
|
Criteo 直接ビッダー |
static.criteo.net/js/*/publishertag.js
|
Google パブリッシャー タグ |
googletagservices.com/tag/js/gpt.js
securepubads.g.doubleclick.net/tag/js/gpt.js
|
Index Exchange |
js-sec.indexww.com/ht/p/*.js
|
document.write() に対する介入
スクリプト挿入の「非同期スクリプト」有害とみなした
非同期スニペットの高速化
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2024-08-22 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"]],["最終更新日 2024-08-22 UTC。"],[[["\u003cp\u003eThis audit identifies ad scripts injected into the page that may delay or prevent ad loading.\u003c/p\u003e\n"],["\u003cp\u003eUse async script tags to improve loading speed, enabling the browser to fetch scripts earlier.\u003c/p\u003e\n"],["\u003cp\u003eIf the source of an injected ad script is unclear, Chrome DevTools' Network tab can be used to identify it.\u003c/p\u003e\n"],["\u003cp\u003eA list of safe-to-load ad scripts is provided, including those from AdSense, Amazon, Criteo, Google Publisher Tag, and Index Exchange.\u003c/p\u003e\n"]]],["Ad scripts injected into a page can delay or prevent ad loading. To improve speed, load scripts using `async` script tags, allowing the browser to fetch them earlier. To identify injected scripts, use Chrome DevTools' Network tab: filter by the script name and enable the \"Initiator\" column to find the source. The document provides examples of correct and incorrect code for loading scripts and includes a list of ad scripts from AdSense, Amazon, Criteo, Google Publisher Tag, and Index Exchange.\n"],null,[]]