Trackster
A lightweight plugin to record visits to supplied URL.
This gem is written using Rails version 5.1.4 and Ruby version ruby 2.4.2p198.
Installation
Add this line to your application's Gemfile:
gem 'trackster'
And then execute:
$ bundle install
Or install it yourself as:
$ gem install trackster
Generate the pageviews table
$ rake db:migrate
Usage
- Create trackster.rb as follwing:
Trackster::Engine.setup do |config|
config.trackable_regex = ["/a+", "/a[a-z]+"]
config.trackable_urls = ["/tests"]
config.results_page_username = "hello"
config.results_page_password = "world"
end
- Add following to you routes.rb
mount Trackster::Engine => "/trackster"
- To enable Trackster to count pageview, add following to your ApplicationController:
trackster
- The url for pageview list page is "/trackster/pageviews"
License
The gem is available as open source under the terms of the MIT License.