If you developed an application in your life you probably wondered how many times it has been installed or how many copies are out there. You probably started using one of those wonderful tools that can track almost everything.

I did exactly this in the past with my android apps and found that the tools I used offered a free tier that was easy to fulfill. The I decided to create a personal tracking app. This took the name MTrack.

MTrack is a system for tracking data coming from your apps or websites. It is written in node.js and can be easily hosted in low powered devices like a Raspberry Pi 2 or an existing server without consuming much CPU. This is an important aspect of the project, which is targeted to all those developers who don’t want to spend additional money and need an easy and effective tool.

The whole project is composed by a backend part which receives data from the clients, a client library for node.js (more to come in the future) and a UI for visualizing the stored data.

MTrack is really easy to setup and use. Just clone the github repo, configure a couple of aspects and start it up. It is ready to receive your data!

##Storage Storing data coming from application is a key point to analyze and solve in an intelligent way. Developing MTrack i decided to have the possibility to support several storage technologies. The aim was to give an easy to setup and zero cost local file system storage and a more sophisticated, growth supporting AWS based storage. The architecture is also ready for being extended supporting other data storage technologies like couchdb or other nosql databases.

##Backend APIs APIs exposed to clients have been split from the administrative UI. This choice has been made to have a minimal installation running without unneeded overhead. Moreover a similar instllation easy the server security configuration since it is only needs to have one port open to let clients requests pass through. The Administration UI can be installed locally and be not accessible from the outside.

##Data collected Currently a reduced set of data is collected from clients. Client GEOIP, Locale, OS Version , Application Version can be collected and stored. The Administrative UI will let you visualize the daily Hbeat (unique contacts in a day), monthly Hbeats and unique clients in a customizable time interval.

##Source code The projects can be found on Github at the following addresses:

The client for node.js can be downloaded through npm here: https://www.npmjs.com/package/mtrack-node


Installing MTrack is quite easy. Clone the Git repo

git clone https://github.com/fanciulli/MTrack.git

Install all dependencies from NPM by executing the following on the MTrack source code folder

npm install

Edit file config.properties and update the following variables depending on your needs:

  1. PORT Change to whatever port you wnt MTrack to listen to. Default is 9080

  2. STORAGE Put one of the expected values (LOCAL, AWS) to choose your storage strategy.

  3. LOGGING_TYPE Put one of the expected values (CONSOLE, FILE) to choose the media that will store your logs.

  4. LOGGING_FILE_FULL_PATH Change to whatever folder you want to store your logging data. This field has any meaning only when the LOGGING_TYPE is set to FILE

  5. ENABLED_GEOIP Set to true or false to enable GeoIP. When enabled MTrack will try to obtain geographical information from the client IP and will store them. This option uses an external service thus will generate an outboud network traffic.

##Data storage As said in the introduction several storages are provided. Below additional configuration.

###Local filesystem If you configured the variable STORAGE in config.properties to the value LOCAL you choose to locally store all data on disk. It is up to you to decide wether or not to mount anetwork partition in order to allow data sharing between several MTrack instances. The system will not be aware of this. If you choose the local file system storage you also have to edit the STORAGE_LOCAL_DATA_DIR variable in config.properties. Set it to a valid folder in your host.

###AWS DynamoDB If you configured the variable STORAGE in config.properties to the value AWS you choose to store all data on DynamoDB. In order to do this table have to be created on DynamoDB and an additional configuration performed on MTrack.

Edit the file api/1/conf/aws-credentials.json and update the keys and the AWS region. If you don’t know how to create access keys please refere at the official Amazon documentation that you can find here.

On the DynamoDB console create the following tables:

#Startup To start MTrack simply go to the source code folder a run

node MTrack.js