Skip to content

Commit

Permalink
analytics and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Volodarsky committed Jan 2, 2015
1 parent 79a32dc commit be90383
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
11 changes: 10 additions & 1 deletion app.js
@@ -1,8 +1,11 @@
var koa = require('koa');
var animals = require('./lib/animals');
var app = koa();
app.proxy = true; // support x-forwarded-for as ctx.ip
var bodyParser = require('koa-bodyparser');
var logger = require('koa-logger')
var logger = require('koa-logger');
var Analytics = require('analytics-node');
var analytics = new Analytics('e2L9GzC8gZBUv3EMch6jDjvOMaLOv98o');

/**
* Exports.
Expand Down Expand Up @@ -42,6 +45,12 @@ app.use(function *(){
animal = '\x1b[2K\r' + '\x1b[1F' + animal;
}

analytics.track({
userId: this.ip,
event: 'Requested Animal',
properties: { terminal: terminal, index: index, reverse: reverse }
});

this.type = 'text/plain; charset=utf-8';
this.body = animal;
});
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -14,6 +14,7 @@
"node": ">= 0.11.x"
},
"dependencies": {
"analytics-node": "^1.1.0",
"ascii-art-reverse": "0.0.0",
"koa": "^0.14.0",
"koa-bodyparser": "^1.3.0",
Expand Down
4 changes: 2 additions & 2 deletions readme.md
Expand Up @@ -26,11 +26,11 @@ Animal Meetspace.
## Try it yourself:

```bash
curl -s https://raw.github.com/ivolo/animals/master/examples/loading.sh | sh
curl -s https://raw.githubusercontent.com/ivolo/animals/master/examples/loading.sh | sh
```

```bash
curl -s https://raw.github.com/ivolo/animals/master/examples/loading.py | python
curl -s https://raw.githubusercontent.com/ivolo/animals/master/examples/loading.py | python
```

Please contain your excitement.
Expand Down

0 comments on commit be90383

Please sign in to comment.