DokuWiki で Google Adsense

DokuWiki に Google Adsense 広告を載せる方法に挑戦してみた。

(1)DokuWiki に、Bernd Zeimetz という人が出している「Google Adsense Plugin」というプラグインをインストールする。

(2)Google Adsense で「My ads>Ad units>New ad unit」をクリック。新しい ad unit を追加することで、Google Adsense 用のコードを取得できる。

(3)「DokuWiki>Admin>Additional Plugins>Google Adsense」をクリック。「Please set the following options…>Javascript Code as shown by the Adsense setup」に2のコードをペースト。Save をクリック。

(4)「dokuwikiディレクトリ/lib/tpl/dokuwiki/main.php」の広告を表示したい箇所に、3のページの「To use it, you’ll have to insert the following code into your template:」の部分に表示されているコードをコピーアンドペースト。保存。

20 分ほど待つと、広告が表示されるようになった。

DokuWiki のアップデートで4のコードが削除されてしまうみたいなので、アップデート時には再度記入が必要。

参考:
【DokuWiki】Google AdSenseの広告を表示する | The modern stone age.
https://www.yokoweb.net/2017/05/28/dokuwiki-adsense/

【最新版】Googleアドセンスで広告コードを取得する方法とオススメの広告サイズについて! | 素晴らしくNiceChoiceな世界
https://gukkin222.com/archives/1441