Add GA tracking to docs, only when not local
Project: http://git-wip-us.apache.org/repos/asf/couchdb/repo Commit: http://git-wip-us.apache.org/repos/asf/couchdb/commit/0b317319 Tree: http://git-wip-us.apache.org/repos/asf/couchdb/tree/0b317319 Diff: http://git-wip-us.apache.org/repos/asf/couchdb/diff/0b317319 Branch: refs/heads/Query-UI-Cleanup Commit: 0b31731982f8edf1ec52166d4b7fc54f21723951 Parents: bbcd98b Author: Noah Slater <[email protected]> Authored: Thu Apr 10 12:45:40 2014 +0200 Committer: Noah Slater <[email protected]> Committed: Thu Apr 10 12:45:40 2014 +0200 ---------------------------------------------------------------------- share/doc/src/conf.py | 5 ++++- share/doc/templates/help.html | 4 ++-- share/doc/templates/tracking.html | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/couchdb/blob/0b317319/share/doc/src/conf.py ---------------------------------------------------------------------- diff --git a/share/doc/src/conf.py b/share/doc/src/conf.py index 14a93f5..03c5dd6 100644 --- a/share/doc/src/conf.py +++ b/share/doc/src/conf.py @@ -106,7 +106,9 @@ html_additional_pages = { 'index': 'pages/index.html' } -html_context = {} +html_context = { + "ga_code": "UA-658988-6" +} html_sidebars = { "**": [ @@ -115,6 +117,7 @@ html_sidebars = { "relations.html", "utilities.html", "help.html", + "tracking.html", ] } http://git-wip-us.apache.org/repos/asf/couchdb/blob/0b317319/share/doc/templates/help.html ---------------------------------------------------------------------- diff --git a/share/doc/templates/help.html b/share/doc/templates/help.html index be0cb91..a6b7859 100644 --- a/share/doc/templates/help.html +++ b/share/doc/templates/help.html @@ -16,9 +16,9 @@ specific language governing permissions and limitations under the License. <h3>More Help</h3> <ul> -<li><a href="https://couchdb.apache.org/">Homepage</a></li> +<li><a href="https://couchdb.apache.org/"{% if not local %} onclick="_gaq.push(['_link', 'https://couchdb.apache.org/']); return false;"{% endif %}>Homepage</a></li> <li><a href="http://wiki.apache.org/couchdb/">Wiki</a></li> -<li><a href="https://couchdb.apache.org/#mailing-list">Mailing Lists</a></li> +<li><a href="https://couchdb.apache.org/#mailing-list"{% if not local %} onclick="_gaq.push(['_link', 'https://couchdb.apache.org/#mailing-list']); return false;"{% endif %}>Mailing Lists</a></li> <li><a href="http://webchat.freenode.net/?channels=couchdb">IRC</a></li> <li><a href="https://issues.apache.org/jira/browse/CouchDB">Issues</a></li> <li><a href="{{ pathto('download') }}">Download</a></li> http://git-wip-us.apache.org/repos/asf/couchdb/blob/0b317319/share/doc/templates/tracking.html ---------------------------------------------------------------------- diff --git a/share/doc/templates/tracking.html b/share/doc/templates/tracking.html new file mode 100644 index 0000000..e6d4037 --- /dev/null +++ b/share/doc/templates/tracking.html @@ -0,0 +1,15 @@ +{% if not local %} +<script type="text/javascript"> + var _gaq = _gaq || []; + _gaq.push(['_setAccount', '{{ ga_code }}']); + _gaq.push(['_setDomainName', 'couchdb.org']); + _gaq.push(['_setAllowLinker', true]); + _gaq.push(['_trackPageview']); + + (function() { + var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; + ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; + var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s); + })(); +</script> +{% endif %}
