Skip to content
Permalink
Browse files

Modified Piwik to work with AdBlock

  • Loading branch information...
Depado committed Dec 5, 2014
1 parent d40759a commit 52a180d594ab3973cd1bfda6ddb7dd1eed5b9867
Showing with 17 additions and 13 deletions.
  1. +1 −13 app.js
  2. +16 −0 views/index.html
14 app.js
@@ -8,23 +8,18 @@ var express = require('express'),
staticData = require('./static_data'),
generation = require('./generation'),
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.enable('trust proxy');
app.use(compress());
app.use(express.static(__dirname + '/bower_components'));
app.use('/custom', express.static(__dirname + '/static'));
app.enable('trust proxy');

var usernames = {};
var anon_users = 0;
@@ -117,13 +112,6 @@ io.sockets.on('connection', function (socket) {

// Simple route with websocket inside it
app.get('/', function(req, res) {
piwik.track({
url: baseUrl + req.url,
action_name: req.url,
ua: req.header('User-Agent'),
lang: req.header('Accept-Language'),
cip: req.ip
});
res.render('index.html');
});

@@ -52,5 +52,21 @@
</div>
</div>
</div>
<!-- Piwik -->
<script type="text/javascript">
var _paq = _paq || [];
_paq.push(["setDocumentTitle", document.domain + "/" + document.title]);
_paq.push(['trackPageView']);
_paq.push(['enableLinkTracking']);
(function() {
var u="//analytics.depado.eu/";
_paq.push(['setTrackerUrl', u+'mypi.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+'mypi.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<noscript><p><img src="//analytics.depado.eu/mypi.php?idsite=2" style="border:0;" alt="" /></p></noscript>
<!-- End Piwik Code -->
</body>
</html>

0 comments on commit 52a180d

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