Giter Club home page Giter Club logo

statsmix's Introduction

A Ruby gem for the StatsMix API - http://www.statsmix.com/developers

What is StatsMix?

StatsMix makes it easy to track, chart, and share application and business metrics. Use StatsMix to:

  • Log every time a particular event happens (such as a user creating a new blog post)
  • View a real-time chart of these application events in StatsMix's web UI
  • Share the charts with users inside and outside your organization
  • Create and share custom dashboards that aggregate multiple metrics together

To get started, you'll need an API key for StatsMix. You can get a free developer account here: http://www.statsmix.com/try?plan=developer

Full gem documentation is at http://www.statsmix.com/developers/ruby_gem

Partner API documentation is at http://www.statsmix.com/developers/partner_api

Quick Start

Install the gem from the command line.

gem install statsmix

The basic pattern in your code:

require "statsmix"
StatsMix.api_key = "YOUR API KEY"
StatsMix.track(name_of_metric, value = 1, options = {})

Push a stat with the value 1 (default) to a metric called "My First Metric":

StatsMix.track("My First Metric")

Push the value 20:

StatsMix.track("My First Metric",20)

Add metadata via the :meta option in the options hash. Metadata is useful for adding granularity to your stats. This example tracks file uploads by file type:

StatsMix.track("File Uploads", 1, {:meta => {"file type" => "PDF"}})

If you need the ability to update a stat after the fact, you can pass in a unique identifier ref_id (scoped to that metric, so you can use the same ref_id across metrics). This example use's today's date, which is useful if you want to do intraday updates to a stat:

StatsMix.track("File Uploads", 1, {:ref_id => Time.now.strftime('%Y-%m-%d'), :meta => {"file type" => "PDF"}})

If you need to timestamp the stat for something other than now, pass in a UTC datetime called :generated_at:

StatsMix.track("File Uploads", 1, {:generated_at => 1.days.ago})

To turn off tracking in your development environment:

StatsMix.ignore = true

To redirect all stats in dev environment to a test metric:

StatsMix.test_metric_name = "My Test Metric"

More Documentation

The StatsMix gem supports all the methods documented at http://www.statsmix.com/developers/documentation

Partner API

We recently added ALPHA-LEVEL support for our Partner API, which allows you to provision users and metrics in StatsMix. The methods are:

StatsMix.create_user({}) 
StatsMix.update_user(id,{})  
StatsMix.delete_user(id) 

In all cases, the affected user's api key will be available via StatsMix.user_api_key. You can use the api key for updating and deleting users as well. In other words, there is no need to store another identifier besides the user's api key.

Full Partner API documentation is at http://www.statsmix.com/developers/partner_api

Contributing to statsmix

  • Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet
  • Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it
  • Fork the project
  • Start a feature/bugfix branch
  • Commit and push until you are happy with your contribution
  • Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
  • Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.

Copyright

Copyright (c) 2011 StatsMix, Inc. See LICENSE.txt for further details.

statsmix's People

Contributors

tmarkiewicz avatar djscruggs avatar ernesto-jimenez avatar peterklipfel avatar

Watchers

Paul Zabelin avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.