Added piwik integration.

This commit is contained in:
Fredrik Jonsson 2017-06-16 16:58:08 +02:00
commit 4047401c37
3 changed files with 16 additions and 0 deletions

View file

@ -17,6 +17,7 @@ This is a port of that theme for [Hugo :: A fast and modern static website engin
* jQuery 2
* Slicknav mobile menu
* Search with DuckDuckGo
* Analytics with Piwik
## On the large screen
@ -61,6 +62,8 @@ params:
icon: "" # Relative path to icon in json feed, no leading slash.
jquery: true # Add jQuery
logo: false # Turn off the logo.
piwikSiteId: # Piwik site id
piwikTrackerUrl: "" # Piwik url, schemaless and no slash on end (example.com/piwik).
poweredby: true # Show powered by hugo in footer
search: true # Site search with DuckDuckGo.
searchSize: 20 # Search field size, default 20.

View file

@ -6,6 +6,7 @@
{{ block "meta" . }}{{ end }}
{{- partialCached "meta.html" . -}}
<link rel="canonical" href="{{ .Permalink }}">
{{ if and .Site.Params.piwikTrackerUrl .Site.Params.piwikSiteID }}{{ partialCached "piwik.html" . }}{{ end -}}
</head>
<body class="{{ if $.Param "sidebar" | default true }}one-sidebar sidebar-second{{ else }}no-sidebars{{ end }}">

View file

@ -0,0 +1,12 @@
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//{{ .Site.Params.piwikTrackerUrl }}/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', '{{ .Site.Params.piwikSiteID }}']);
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>