Skip to content

Commit

Permalink
Add analyticsUseExample.js
Browse files Browse the repository at this point in the history
  • Loading branch information
Luchanso committed Nov 4, 2015
1 parent e4a952d commit 43e5e8e
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions examples/analyticsUseExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
var Bot = require('../lib/Bot');
var tokenBotanIO = '1234qwer-tyuio-56789-asdf';
var tokenTelegram = '123456789:qwertyuiopasdf';

var bot = new Bot({
token: tokenTelegram
})
.enableAnalytics(token)
.on('message', function (message) {
// Not necessary use analytics.track
if (message.text == '/levelup') {
this.analytics.track(message, 'Get new level');
}
if (message.text == '/exit') {
this.analytics.track(message, 'Left users');
}
}})
.start();

0 comments on commit 43e5e8e

Please sign in to comment.