VuepressでGoogle AdSense広告を表示する
/
VuepressでGoogle AdSense広告を表示できるようにします.
本稿の設定の利点は,自分で広告コードを貼り付ける必要がなくなることです.
# Google AdSenseに登録
# .vuepress/config.jsの書き換え
以下のコードをに追記します.
module.exports = {
...
head: [
...
[
"script",
{
"async src": "//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"
}
],
[
"script",
{},
'(adsbygoogle = window.adsbygoogle || []).push({ google_ad_client: "ca-pub-0000000000000000", enable_page_level_ads: true });'
]
],
...
}
あとは,Google AdSense (opens new window)に飛んで,自動最適化の設定をします.
# 参考サイト
Google AdSense (opens new window)