BehaviorLens
BehaviorLens is a Ruby gem designed to provide insights into user behavior and interaction patterns, enabling developers to understand and optimize user experiences.
Installation
Add this line to your application's Gemfile:
gem 'behavior_lens'
Then execute:
bundle install
Or install it yourself as:
gem install behavior_lens
Database Setup
BehaviorLens requires a MySQL database to store tracked data.
1. Create a Database
CREATE DATABASE behavior_lens;
2. Connect to database
require 'behavior_lens'
BehaviorLens::Database.connect(
database: 'your_database_name',
username: 'your_username',
password: 'your_password',
host: 'your_host' # Usually 'localhost'
)
3. Initialize the Database Schema
BehaviorLens::Database.setup
Usage
To use BehaviorLens in your project, require the gem and start analyzing behavior patterns. Here's a quick example:
require 'behavior_lens'
# Example: Analyzing a set of user actions
analyzer = BehaviorLens::Tracker.new
analyzer.track_event("user_clicked_button", {name: 'btn1'})
analyzer.track_click("https://example.com")
report = analyzer.generate_report
puts report
Detailed documentation for advanced usage will be available soon.
Development
To get started with development:
- Clone the repository:
git clone https://github.com/aayush502/behavior_lens.git
cd behavior_lens
- Install dependencies:
bin/setup
- Run the interactive console for experimentation:
bin/console
- To build and install the gem locally:
bundle exec rake install
- To release a new version:
- Update the version number in
lib/behavior_lens/version.rb. - Run:
bash bundle exec rake release - This will tag the version, push changes to GitHub, and publish the gem to RubyGems.
Contributing
Bug reports and pull requests are welcome on GitHub at https://github.com/aayush502/behavior_lens. Contributions are expected to adhere to the Code of Conduct.
License
BehaviorLens is open source and available under the terms of the MIT License.
Code of Conduct
All participants in the BehaviorLens project are expected to follow the Code of Conduct.