0.0
No commit activity in last 3 years
No release in over 3 years
Make use of Webtrends gem to allow server-side tracking in a Rails application.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 3.1
 Project Readme

Webtrends::Rails

Gem Version Code Climate Build Status Coverage Status Dependency Status

Make use of Webtrends gem to allow server-side tracking in a Rails application.

Installation

Add this line to your application's Gemfile:

gem 'webtrends-rails'

And then execute:

$ bundle install

Or install it yourself as:

$ gem install webtrends-rails

Usage

Controller configuration

Track hook

track :object_to_track, options, optional_block

NOTE: Any options that can be passed to before_action can be used as options.

By default the track hook will use the following tags:

  • dcsuri: request path (ex. /path/to/service)
  • dcsdat: milliseconds since epoch
  • dcssip: hostname
  • WT.es: hostname + dcsuri
  • WT.co_f: webtrends visitor id

NOTE: dcsuri is the only mandatory tag for event tracking. If dcsuri is not passed you will get a 400 Bad Request response

Tracking with custom tags

track :object_to_track, only: :create do |tags|
  tags.store('your_custom_tag', 'custom_tag_value')
end

Tracking with default tags

track :object_to_track, only: [:create, :update]

Model configuration

ActiveRecord

Make use of an after_save hook to call track_event

after_save :track_event

ActiveModel

Make use of an after_validation hook to call track_event

after_validation :track_event, if: 'errors.blank?'

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Create tests for your feature
  4. Make sure coverage meets minimum requirements
  5. Commit your changes (git commit -am 'Add some feature')
  6. Push to the branch (git push origin my-new-feature)
  7. Create new Pull Request