1. Takafumi Arakaki
  2. railgun

Commits

Takafumi Arakaki  committed f2fc2c4

added google analytics in document

  • Participants
  • Parent commits de20e91
  • Branches default

Comments (0)

Files changed (3)

File .hgignore

View file
 dist/
 *.egg-info/
 MANIFEST
+doc/source/_templates

File doc/Makefile

View file
 PAPEROPT_letter = -D latex_paper_size=letter
 ALLSPHINXOPTS   = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
 
-.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest samples samples-clean
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest samples samples-clean google-analytics-on google-analytics-off
 
 help:
 	@echo "Please use \`make <target>' where <target> is one of"
 	for sdir in source/samples/*; do \
 		[ -e $$sdir/Makefile ] && make -C $$sdir clean; \
 		done
+
+
+google-analytics-on:
+	@[ ! -e source/_templates ] && ln -s __templates source/_templates \
+		|| echo 'already on'
+
+google-analytics-off:
+	@[ -L source/_templates ] && rm source/_templates || echo 'not on'

File doc/source/__templates/layout.html

View file
+{% extends "!layout.html" %}
+
+{%- block extrahead %}
+{{ super() }}
+<script type="text/javascript">
+  var _gaq = _gaq || [];
+  _gaq.push(['_setAccount', 'UA-22829655-1']);
+  _gaq.push(['_trackPageview']);
+</script>
+{% endblock %}
+
+{% block footer %}
+{{ super() }}
+<div class="footer">This page uses <a href="http://analytics.google.com/">
+Google Analytics</a> to collect statistics. You can disable it by blocking
+the JavaScript coming from www.google-analytics.com.
+<script type="text/javascript">
+  (function() {
+    var ga = document.createElement('script');
+    ga.src = ('https:' == document.location.protocol ?
+              'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
+    ga.setAttribute('async', 'true');
+    document.documentElement.firstChild.appendChild(ga);
+  })();
+</script>
+</div>
+{% endblock %}