1
Fork 0

Add piwik analytics

This commit is contained in:
Jake Howard 2016-08-16 22:23:02 +01:00
parent 92e8062a26
commit a9a8d6711c
Signed by: jake
GPG key ID: 57AFB45680EDD477
2 changed files with 23 additions and 3 deletions

View file

@ -26,7 +26,10 @@ import links
ACCOUNTS = links.accounts()
FOOTER_LINKS = links.footer()
INDEX_PROJECTS = links.index_projects()
# Extra config
REPO = Repo(search_parent_directories=True)
BUILD_PRODUCTION = 'BUILD_PRODUCTION' in os.environ
# Disable some pages
TAG_URL = False
@ -59,11 +62,10 @@ PLUGINS = [
"filetime_from_git",
"pelican-jinja2content",
"metatags",
"autopages",
"minify"
"autopages"
]
if "BUILD_PRODUCTION" in os.environ:
if BUILD_PRODUCTION:
PLUGINS.append("minify") # only minify on production build
SITEMAP = {

View file

@ -27,6 +27,24 @@
<script src="/static/js/libs.js" type="text/javascript"></script>
<script src="/static/js/app.js" type="text/javascript"></script>
{% if BUILD_PRODUCTION %}
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="https://piwik.theorangeone.net/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '1']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.type='text/javascript'; g.async=true; g.defer=true; g.src=u+'piwik.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="https://piwik.theorangeone.net/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
{% endif %}
<noscript>
<style>html, body { display: none }</style>
<meta http-equiv="refresh" content="0.0;url=/no-js/" />