Sphinx で Google Analytics を利用する。
Sphinx で Google Analytics をトラックするスクリプトを埋めるのは
どうすればいいんだろと思っていたら、 sphinx-contrib にプラグインが
公開されていました。
sphinxcontrib-googleanalytics
https://bitbucket.org/birkenfeld/sphinx-contrib/src/bb0b2036aa45/googleanalytics/
sphinxcontrib-googleanalytics の使い方を紹介します。
1. Google Analytics のIDを取得する。
2. Sphinx / sphinxcontrib-googleanalytics をインストールする。
$ easy_install -ZU sphinx $ easy_install -ZU sphinxcontrib-googleanalytics
3. sphinxプロジェクトを作成する。
4. conf.py に sphinxcontrib-googleanalytics の設定をします。
プラグインを有効にします。
extensions = ['sphinxcontrib.googleanalytics']
Google Analytics の設定をします。
# Google Analytics
googleanalytics_id = 'UA-123-456'
5. make html をして、HTMLページを生成する。
以上の手順で簡単に Google Analytics を利用できます。
Google Analytics を埋め込んだページ例 http://aohta.github.com/nose_tutorial/