Track simple metrics via metric.io.
Installation
Add the following anywhere in your Gemfile and run bundle install
.
gem 'metric'
And create the following initializer:
Metric.configure do |config|
config.api_key = "YOUR_API_KEY"
config.secret_key = "YOUR_SECRET_KEY"
end
Now you are all set to start tracking some metrics!
Note: If you are using Rails it will only track events in Production mode.
Usage
You can track whatever metric you want, it will automatically show up in your dashboard.
Metric.track("article_view")
You can also add a custom amount to log multiple metrics in one go:
Metric.track("email_notifications", {:amount => 301})
If you want to push old statistics into metric.io you can use the date parameter:
Metric.track("signup", {:date => "20120101"})
To give the live event view in your dashboard some more context you can pass in meta information:
Metric.track("email", {:meta => "user 1021"})
Documentation
Although the code is pretty lightweight and self-explanatory, documentation is available via rdoc.info.
Thanks
jeffkreeftmeijer for providing me with the awesome domainname!