Sha256: 281e63657aca218a00dd4555143c2b815b4b1bde900416c3b305a841bd25bd1d

Contents?: true

Size: 1.36 KB

Versions: 2

Compression:

Stored size: 1.36 KB

Contents

# Metric [![Build Status](https://secure.travis-ci.org/bittersweet/metric.png)](http://travis-ci.org/bittersweet/metric)

Track simple metrics via [metric.io](metric.io).

## Installation

Add the following anywhere in your Gemfile and run `bundle install`.

``` ruby
gem 'metric'
```

And create the following initializer:

``` ruby
Metric.configure do |config|
  config.api_key = "YOUR_API_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.

``` ruby
def show
  @article = Article.find(params[:id])
  Metric.track("article_view")
end
```

You can also add a custom amount to log multiple metrics in one go:

``` ruby
def notify(users)
  # send mails to everyone involved
  Metric.track("email_notifications", {:amount => users.count})
end
```

To receive emails whenever a metric gets tracked pass in `trigger => true`

``` ruby
def register
  Metric.track("user_signup", {:trigger => true})
end
```

## Documentation

Although the code is pretty lightweight and self-explanatory, [documentation](http://rdoc.info/github/bittersweet/metric/master/frames) is available via rdoc.info.

## Thanks

[jeffkreeftmeijer](https://github.com/jeffkreeftmeijer) for providing me with the awesome domainname!

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
metric-0.0.8 README.markdown
metric-0.0.7 README.markdown