A simple interface for the KISSmetrics API that plays nicely with Delayed Job and Heroku.
Include the gem in your gemfile:
gem 'delayed_kiss'
Configure your API key:
- run
rails g delayed_kiss:install
- update the config in
config/delayed_kiss.yml
#in config/delayed_kiss.yml development: key: yourkey whiny_config: true test: key: yourkey production: key: yourkey
#in config/kiss_metrics.yml development: key: yourkey test: key: yourkey production: key: yourkey #in config/initializers KM_CONFIG = YAML::load(ERB.new(IO.read(File.join(Rails.root, "config/kissmetrics.yml"))).result)[Rails.env] if !KM_CONFIG.blank? DelayedKiss.configure do |config| config.key = KM_CONFIG['key'] end end
Follow the instructions for setting up Delayed Job: https://github.com/collectiveidea/delayed_job
Start recording events anywhere in your application:
DelayedKiss.alias(anonymous_user, user.km_id)
DelayedKiss.record(user.km_id, ‘signed up’)
DelayedKiss is derived and gemified from https://github.com/vbrendel/delayed_km
(The MIT License)
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
‘Software’), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED ‘AS IS’, WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.