Skip to content

Repository files navigation

Official trak.io Ruby Library

Gem VersionDependency StatusCode ClimateBuild StatusCoverage StatusBitdeli Badge

Installation

Add this line to your application's Gemfile:

gem 'trakio-ruby'

And then execute:

$ bundle

Or install it yourself as:

$ gem install trakio-ruby

Examples

For more indepth documentation see: http://docs.trak.io/ruby.html

Creating an instance, and then tracking an event.

# create the instancetrakio=Trakio.new'my_api_token'# track my-eventresp=trakio.trackdistinct_id: 'user@example.com',event: 'my-event'# resp will look like { 'status': 'success' }

Creating a default instance, and then tracking an event.

# set token on default instanceTrakio.init'my_api_token'# track our eventresp=Trakio.trackdistinct_id: 'user@example.com',company_id: 'acme_ltd',event: 'my-event'# resp will look like { 'status': 'success' }

Creating an instance and aliasing an entry

# set token on default instanceTrakio.init'my_api_token'resp=Trakio.aliasdistinct_id: 'u1@example.com',alias: ['u2@example.com']# resp will look like { 'status': 'success' }# an equivilent is shown belowresp=Trakio.aliasdistinct_id: 'u1@example.com',alias: 'u2@example.com'# resp will look like { 'status': 'success' }

Creating an instance and using identify

# set token on default instanceTrakio.init'my_api_token'resp=Trakio.identifydistinct_id: 'user@example.com',properties: {name: 'Tobie'}# resp will look like { 'status': 'success' }

Creating an instance and using company

# set token on default instanceTrakio.init'my_api_token'resp=Trakio.companycompany_id: 'acme_ltd',properties: {name: 'Tobie'}# resp will look like { 'status': 'success' }

Creating an instance and using annotate

# set token on default instanceTrakio.init'my_api_token'resp=Trakio.annotateevent: 'event',channel: 'channel'# resp will look like { 'status': 'success' }

Creating and Running Tests

  • 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.

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

1 watching

Forks

Releases

Packages

Contributors