Commit cbce7e93 authored by Killian Kemps's avatar Killian Kemps
Browse files

Add Piwik stats to evaluate audience.

This feature is disabled by default. To activate, you need to set two
environnement variables accordingly: QOWALA_PIWIK_URL and
QOWALA_PIWIK_ID.
parent a6b3266f
......@@ -9,7 +9,9 @@ exports.getDashboard = function(req, res) {
users.getUserName(userId, function(username){
res.render('home/dashboard', {
userId : userId,
username: username
username: username,
piwikUrl: process.env.QOWALA_PIWIK_URL,
piwikId: process.env.QOWALA_PIWIK_ID
});
});
}
......
......@@ -3,6 +3,9 @@ exports.getLogin = function(req, res) {
res.redirect('/dashboard');
}
else {
res.render('home/login');
res.render('home/login', {
piwikUrl: process.env.QOWALA_PIWIK_URL,
piwikId: process.env.QOWALA_PIWIK_ID
});
}
};
......@@ -11,5 +11,22 @@
</head>
<body>
<%- body %>
<% if (piwikUrl && piwikId) { %>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//<%= piwikUrl %>/";
_paq.push(['setTrackerUrl', u+'piwik.php']);
_paq.push(['setSiteId', <%= piwikId %>]);
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="//<%= piwikUrl %>/piwik.php?idsite=<%= piwikId %>" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
<% } %>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment