Sha256: 08425c1064c0493d1f9edc51525e844e41e14a93afb3b9a9a7bd2cd3fc7eb438

Contents?: true

Size: 759 Bytes

Versions: 1

Compression:

Stored size: 759 Bytes

Contents

require 'rubygems'
require 'keen'
 
# Get these from the keen.io website:
project_id = 'asdfasldkfjalsdkfalskdfj'
api_key = 'asldfjklj325tkl32jaskdlfjaf'

# First you must setup the client:
keen = Keen::Client.new(project_id, api_key, :storage_mode => :redis)

# Then, you can use that client to send events.  

keen.add_event("purchases", {
  :quantity   => @quantity,
  :user       => @user.hashify,
  :item       => @item.hashify,
  :session    => @session.hashify,
})

keen.add_event("pageviews", {
  :user       => @user.hashify,
  :route      => @current_route,
  :session    => @session.hashify,
})

# (These examples pretend your important objects all have a method called
# "hashify", and that method serializes state information you wish to track.)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
keen-0.2.2 examples.rb