Add this line to your application's Gemfile:
gem 'trakio-ruby'
And then execute:
$ bundle
Or install it yourself as:
$ gem install trakio-ruby
For more indepth documentation see: http://docs.trak.io/ruby.html
# create the instance
trakio = Trakio.new 'my_api_token'
# track my-event
resp = trakio.track distinct_id: 'user@example.com', event: 'my-event'
# resp will look like { 'status': 'success', 'trak_id': '12345' }
# set token on default instance
Trakio.init 'my_api_token'
# track our event
resp = Trakio.track distinct_id: 'user@example.com', event: 'my-event'
# resp will look like { 'status': 'success', 'trak_id': '12345' }
# set token on default instance
Trakio.init 'my_api_token'
resp = Trakio.alias distinct_id: 'u1@example.com', alias: ['u2@example.com']
# resp will look like { 'status': 'success', 'trak_id': '12345', 'distinct_ids': ['u1@example.com', 'u2@example.com'] }
# an equivilent is shown below
resp = Trakio.alias distinct_id: 'u1@example.com', alias: 'u2@example.com'
# resp will look like { 'status': 'success', 'trak_id': '12345', 'distinct_ids': ['u1@example.com', 'u2@example.com'] }
# set token on default instance
Trakio.init 'my_api_token'
resp = Trakio.identify distinct_id: 'user@example.com', properties: { name: 'Tobie' }
# resp will look like { 'status': 'success', 'trak_id': '12345', 'distinct_ids': ['user@example.com'] }
# set token on default instance
Trakio.init 'my_api_token'
resp = Trakio.annotate event: 'event', channel: 'channel'
# resp will look like { 'status': 'success', 'trak_id': '12345', 'properties': {} }
- Tests can be run by running the following commands
bundle exec rspec
- Tests can be added by either adding into an existing spec file, or creating a new one.
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request