piwik tracker config option
This commit is contained in:
parent
a2bea009a2
commit
4e2fd77e9c
@ -51,6 +51,11 @@ app.use((req, res, next) => {
|
||||
csrf: req.session.csrf
|
||||
})
|
||||
|
||||
// Add Piwik tracker if configured
|
||||
if (config.piwik && config.piwik.site_id) {
|
||||
res.locals.piwik = config.piwik
|
||||
}
|
||||
|
||||
next()
|
||||
})
|
||||
|
||||
|
@ -3,6 +3,19 @@ html
|
||||
head
|
||||
meta(charset="utf8")
|
||||
meta(name="viewport", content="width=device-width, initial-scale=1")
|
||||
if piwik
|
||||
script(type="text/javascript").
|
||||
var _paq = _paq || [];
|
||||
/* tracker methods like "setCustomDimension" should be called before "trackPageView" */
|
||||
_paq.push(['trackPageView']);
|
||||
_paq.push(['enableLinkTracking']);
|
||||
(function() {
|
||||
var u="#{piwik.track_url}";
|
||||
_paq.push(['setTrackerUrl', u+'piwik.php']);
|
||||
_paq.push(['setSiteId', '#{piwik.site_id}']);
|
||||
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);
|
||||
})();
|
||||
block links
|
||||
link(rel="stylesheet", type="text/css", href="/style/main.css")
|
||||
link(rel="stylesheet", type="text/css", href="/style/footer.css")
|
||||
|
Reference in New Issue
Block a user