README.md in keen-0.6.0 vs README.md in keen-0.6.1

- old
+ new

@@ -27,17 +27,19 @@ (If you need a Keen IO account, [sign up here](https://keen.io/) - it's free.) The recommended way to do this is to set `KEEN_PROJECT_ID` in your environment. If you're using [foreman](http://ddollar.github.com/foreman/), add this to your `.env` file: - KEEN_PROJECT_ID=your-project-id + KEEN_PROJECT_ID=xxxxxxxxxxxxxxxx -When you deploy, make sure your production environment variables are also set. For example, +If not, make to to export the variable into your shell or put it before the command you use to start your server. + +When you deploy, make sure your production environment variables are set. For example, set [config vars](https://devcenter.heroku.com/articles/config-vars) on Heroku. (We recommend this environment-based approach because it keeps sensitive information out of the codebase. If you can't do this, see the alternatives below.) -If your environment is set up property, `Keen` is ready go immediately. Publish an event like this: +If your environment is set up property, `Keen` is ready to go immediately. Publish an event like this: ```ruby Keen.publish("sign_ups", { :username => "lloyd", :referred_by => "harry" }) ``` @@ -58,12 +60,16 @@ method to send events. To compare asychronous vs. synchronous performance, check out the [keen-gem-example](http://keen-gem-example.herokuapp.com/) app. To publish asynchronously, first add -[em-http-request](https://github.com/igrigorik/em-http-request) to your Gemfile. +[em-http-request](https://github.com/igrigorik/em-http-request) to your Gemfile. Make sure it's version 1.0 or above. +```ruby +gem "em-http-request", "~> 1.0" +``` + Next, run an instance of EventMachine. If you're using an EventMachine-based web server like thin or goliath you're already doing this. Otherwise, you'll need to start an EventMachine loop manually as follows: ```ruby Thread.new { EventMachine.run } @@ -91,11 +97,11 @@ Unlike event publishing, queries require that an API Key is provided. Just like project ID, we encourage that you set this as an environment variable: KEEN_API_KEY=your-api-key -Here's are some examples of querying with the Ruby gem. Let's assume you've added some events to the "purchases" collection. +Here's are some examples of querying with keen-gem. Let's assume you've added some events to the "purchases" collection. ```ruby Keen.count("purchases") # => 100 Keen.sum("purchases", :target_property => "price") # => 10000 Keen.minimum("purchases", :target_property => "price") # => 20 @@ -108,13 +114,18 @@ Keen.select_unique("purchases", :target_property => "username") # => ["bob", "linda", "travis"] Keen.extraction("purchases") # => [{ "price" => 20, ... }, { ... }] Keen.funnel(:steps => [ - { :actor_property => "username", "event_collection" => "purchases" }, - { :actor_property => "username", "event_collection" => "referrals" }, + { :actor_property => "username", :event_collection => "purchases" }, + { :actor_property => "username", :event_collection => "referrals" }, { ... }]) # => [20, 15 ...] + +Keen.multi_analysis("purchases", analyses: { + :gross => { :analysis_type => "sum", :target_property => "price" }, + :customers => { :analysis_type => "count_unique", :target_property => "username" } }, + :timeframe => 'today', :group_by => "item.id") # => [{"item.id"=>2, "gross"=>314.49, "customers"=> 8}, { ... }] ``` Many of there queries can be performed with group by, filters, series and intervals. The API response for these is converted directly into Ruby Hash or Array. Detailed information on available parameters for each API resource can be found on the [API Technical Reference](https://keen.io/docs/api/reference/). @@ -157,10 +168,13 @@ To track email opens, simply add an image to your email template that points to this URL. ### Changelog +##### 0.6.1 ++ Improved logging and exception handling. + ##### 0.6.0 + Added querying capabilities. A big thanks to [ifeelgoods](http://www.ifeelgoods.com/) for contributing! ##### 0.5.0 + Removed API Key as a required field on Keen::Client. Only the Project ID is required to publish events. @@ -183,5 +197,12 @@ at [users.keen.io](http://users.keen.io). We'd love to hear your feedback and ideas! ### Contributing keen-gem is an open source project and we welcome your contributions. Fire away with issues and pull requests! + +### Community Contributors ++ [alexkwolfe](https://github.com/alexkwolfe) ++ [peteygao](https://github.com/peteygao) ++ [obieq](https://github.com/obieq) + +Thanks everyone, you rock!