Skip to content
Permalink
Browse files

Piwik serverside

  • Loading branch information...
Depado committed Dec 4, 2014
1 parent af69f50 commit 6cf4d6b5f1580bdc0268bf8d3700045c013c63cc
Showing with 8 additions and 16 deletions.
  1. +7 −1 app.js
  2. +1 −0 package.json
  3. +0 −15 views/index.html
8 app.js
@@ -7,14 +7,19 @@ var express = require('express'),
compress = require('compression'),
staticData = require('./static_data'),
generation = require('./generation'),
validUrl = require('valid-url');
validUrl = require('valid-url'),
PiwikTracker = require('piwik-tracker');

// Nunjucks configuration
nunjucks.configure('views', {
autoescape: true,
express: app
});

// Piwik
var piwik = new PiwikTracker(1, 'http://analytics.depado.eu/piwik.php');
var baseUrl = 'http://unicorn.depado.eu';

// Use the compress middleware to send gzipped content
app.use(compress());
app.use(express.static(__dirname + '/bower_components'));
@@ -111,6 +116,7 @@ io.sockets.on('connection', function (socket) {

// Simple route with websocket inside it
app.get('/', function(req, res) {
piwik.track(baseUrl + req.url);
res.render('index.html');
});

@@ -8,6 +8,7 @@
"compression": "^1.0.2",
"express": "^4.2.0",
"nunjucks": "^1.0.5",
"piwik-tracker": "^0.1.1",
"socket.io": "^0.9.16",
"valid-url": "^1.0.9",
"validator": "^3.12.0"
@@ -52,20 +52,5 @@
</div>
</div>
</div>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//analytics.depado.eu/";
_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="//analytics.depado.eu/piwik.php?idsite=1" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>
</html>

0 comments on commit 6cf4d6b

Please sign in to comment.
You can’t perform that action at this time.