But KISSmetrics has a Ruby API!
It's true, but why settle for either or?
How do I use it?
gem install snogmetrics
- Edit your layout(s) and add
- Replace all your
Have a look at the included example application to see it in action.
Does it use the asynchronous API?
Yes it does.
Just do it. You need to make sure that the
_kmq array exists, though. SNOGmetrics will define it where you place
<%= km.js! %>, but that is usually at the bottom of the page (with the async API you could probably put it at the top if you wanted to), so if you want to add things to
_kmq before that you need to define it yourself. Just add
var _kmq = _kmq ||  and you're set.
What about A/B testing
SNOGmetrics implements #set, which is equivalent to
_kmq.push(["set", ...]), the preferred way of recording which version a user saw in an A/B test. SNOGmetrics does not support the
Anything else I should know?
Yes, SNOGmetrics will not output the KISSmetrics API code unless
production. Instead it will output code that logs all calls to the console (if
console is defined).
In a future version this behaviour might be overrideable.
Note on Patches/Pull Requests
- Fork the project.
- Make your feature addition or bug fix.
- Add tests for it. This is important so I don't break it in a future version unintentionally.
- Commit, do not mess with rakefile, version, or history. (if you want to have your own version, that is fine but bump version in a commit by itself I can ignore when I pull)
- Send me a pull request. Bonus points for topic branches.
Copyright (c) 2010 Theo Hultberg / Burt. See LICENSE for details.