diff options
author | Johannes Reinhardt <jreinhardt@ist-dein-freund.de> | 2014-07-14 16:21:07 +0200 |
---|---|---|
committer | Johannes Reinhardt <jreinhardt@ist-dein-freund.de> | 2014-07-14 16:33:10 +0200 |
commit | 06532aa2d45fac14131fa360cf5daaa842def8e1 (patch) | |
tree | a94f61fb488cd3745458d3672d8ed1b5af2a6b73 | |
parent | 94c269398742725fc359719851d0b39e4570a073 (diff) | |
download | pelican-themes-06532aa2d45fac14131fa360cf5daaa842def8e1.tar.gz |
[gum] Add support for Piwik Analytics
-rw-r--r-- | gum/README.md | 9 | ||||
-rw-r--r-- | gum/templates/base.html | 17 |
2 files changed, 24 insertions, 2 deletions
diff --git a/gum/README.md b/gum/README.md index 41db49d..ffaefb3 100644 --- a/gum/README.md +++ b/gum/README.md @@ -24,6 +24,15 @@ GOOGLE_ANALYTICS_ID = '' GOOGLE_ANALYTICS_SITENAME = '' ``` +Alternatively you can use [Piwik](http://piwik.org/) for analytics if you set the following settings, where the url has to be given without leading `http://` and trailing `/`. + +``` +PIWIK_ID = '' +PIWIK_URL = '' +``` + + + ### Screenshot ### diff --git a/gum/templates/base.html b/gum/templates/base.html index af0f3d8..55feaaa 100644 --- a/gum/templates/base.html +++ b/gum/templates/base.html @@ -54,8 +54,21 @@ </script> {% endif %} - - + {% if PIWIK_URL%} + <script type="text/javascript"> + var _paq = _paq || []; + _paq.push(['trackPageView']); + _paq.push(['enableLinkTracking']); + (function() { + var u=(("https:" == document.location.protocol) ? "https" : "http") + "://{{ PIWIK_URL }}/"; + _paq.push(['setTrackerUrl', u+'piwik.php']); + _paq.push(['setSiteId', {{ PIWIK_ID }}]); + var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0]; g.type='text/javascript'; + g.defer=true; g.async=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s); + })(); + </script> + <noscript><p><img src="http://{{ PIWIK_URL }}/piwik.php?idsite={{ PIWIK_ID }}" style="border:0;" alt="" /></p></noscript> + {% endif %} {% endblock head %} </head> |