https://github.com/timakin/uucounter
Simple UU (indicator of pageview from unique user) counter for rails app
https://github.com/timakin/uucounter
Last synced: over 1 year ago
JSON representation
Simple UU (indicator of pageview from unique user) counter for rails app
- Host: GitHub
- URL: https://github.com/timakin/uucounter
- Owner: timakin
- License: mit
- Created: 2016-05-03T08:53:15.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2016-09-11T04:19:38.000Z (almost 10 years ago)
- Last Synced: 2025-01-23T19:19:47.110Z (over 1 year ago)
- Language: JavaScript
- Size: 1.12 MB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.rdoc
- License: MIT-LICENSE
Awesome Lists containing this project
README
= [WIP] UUCounter
## Overview
UUCounter is the plugin to trace unique user pageviews with easy integration.
It is inspired by [Ahoy](https://github.com/ankane/ahoy), but limited to a few functions for simplicity.
## Installation
In your Gemfile,
```
gem 'uu_counter'
```
After installation, copy the migration files to your project.
```
rake uu_counter:install:migrations
```
## Overview
This command will generate pageview tracing model.
Table schema is...
```
id: integer
uuid: string
path: string
created_at: datetime
updated_at: datetime
```
You can get the count of UU in the specified path through a module function.
```
UUCounter::Accessor#get_count(path): Returns UU count to the path
```
## Usage
At first, write this line on your project's config/routes.rb.
```
mount UuCounter::Engine => "/uu_counter"
```
In the page you'd track pageview, you should embed this js script.
```
$(function(){
UUCounter.track();
});
```
And you must assign schema to your database with `db:migrate`
After that, when you check UU count, you can get it with following code.
```
class TestController < ActionController::Base
...
def foo
@pageview_count = UUCounter::Accessor.get_count("/test/path")
end
...
end
```
This project rocks and uses MIT-LICENSE.