An open API service indexing awesome lists of open source software.

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

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.