ahoy_matey 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1a219da19a81b96724452cfbdc4286539398e821
4
- data.tar.gz: 59f20f3824b077697868421296e70833d3e11f95
3
+ metadata.gz: 0885adb69bce04e71f7fd609edc8c780355faf3d
4
+ data.tar.gz: 0f28e71f18107dfd51a323a451e1c688dc14434c
5
5
  SHA512:
6
- metadata.gz: 79846a0acf1bb30aca352d9d5bd00a92ce4eb16aac5970ddbc1c7ca04046d7cb4789b0127d70371ed2652f0f778087eab3eba2134e9b7e6b72dd129eb61113ea
7
- data.tar.gz: a21aa44815dca19d629f53a29bdcf37b239068c8238b9cda947a9eadb9bcc8514413655ae99da3b81d7ec9a0a906aa404636ddc227f112d43d2ccf6bd5c263cc
6
+ metadata.gz: ee3c5d227ab4ee129e986bc315acac53569664f99c99e5a131b286c6a1f6822ac148891e7c44e60e0edb5fc76e5d494e5a665f89fdba03a190c442db134aecac
7
+ data.tar.gz: 1ecec9955ebed58e57ea78e22fafaaae7a8fc8c24a4f3debc928a5da109fc8be4db9174c257c5c32b1dde228d13aa53745d4b4c3c57d99625a702be6a3c673cd
data/README.md CHANGED
@@ -1,8 +1,16 @@
1
1
  # Ahoy
2
2
 
3
- Simple, powerful visit tracking for Rails.
3
+ :fire: Simple, powerful visit tracking for Rails.
4
4
 
5
- ## Get Started
5
+ In under a minute, start learning more about your visitors.
6
+
7
+ - traffic source - referrer, referring domain, campaign, landing page
8
+ - location - country, region, and city
9
+ - technology - browser, OS, and device type
10
+
11
+ It’s all stored in **your database** so you can easily combine it with other models.
12
+
13
+ ## Ready, Set, Go!
6
14
 
7
15
  Add this line to your application’s Gemfile:
8
16
 
@@ -17,20 +25,18 @@ rails generate ahoy:install
17
25
  rake db:migrate
18
26
  ```
19
27
 
20
- Next, include the javascript file in your `app/assets/javascripts/application.js` after jQuery.
28
+ Lastly, include the javascript file in `app/assets/javascripts/application.js` after jQuery.
21
29
 
22
30
  ```javascript
23
31
  //= require jquery
24
32
  //= require ahoy
25
33
  ```
26
34
 
27
- That’s it.
28
-
29
35
  ## What You Get
30
36
 
31
37
  When a person visits your website, Ahoy creates a visit with lots of useful information.
32
38
 
33
- - source (referrer, referring domain, campaign, landing page)
39
+ - traffic source (referrer, referring domain, campaign, landing page)
34
40
  - location (country, region, and city)
35
41
  - technology (browser, OS, and device type)
36
42
 
@@ -40,7 +46,7 @@ You can store the visit id on any model. For instance, when someone places an or
40
46
 
41
47
  ```ruby
42
48
  Order.create!(
43
- visit_id: ahoy_visit.id,
49
+ ahoy_visit_id: ahoy_visit.id,
44
50
  # ... more attributes ...
45
51
  )
46
52
  ```
@@ -67,6 +73,14 @@ It sends the event to the server.
67
73
 
68
74
  A visit cookie is set for 4 hours, and a visitor cookie is set for 2 years.
69
75
 
76
+ ## TODO
77
+
78
+ - better readme
79
+ - model integration
80
+ - update visit when user logs in
81
+ - better browser / OS detection
82
+ - set ahoy_visit_id automatically on `visitable` models
83
+
70
84
  ## Contributing
71
85
 
72
86
  Everyone is encouraged to help improve this project. Here are a few ways you can help:
@@ -0,0 +1,9 @@
1
+ module Ahoy
2
+ module ControllerExtensions
3
+
4
+ def ahoy_visit
5
+ @ahoy_visit ||= Ahoy::Visit.where(visit_token: cookies[:ahoy_visit]).first if cookies[:ahoy_visit]
6
+ end
7
+
8
+ end
9
+ end
data/lib/ahoy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ahoy
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
data/lib/ahoy_matey.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  require "ahoy/version"
2
+ require "ahoy/controller_extensions"
2
3
  require "addressable/uri"
3
4
  require "browser"
4
5
  require "geocoder"
@@ -8,3 +9,5 @@ module Ahoy
8
9
  isolate_namespace Ahoy
9
10
  end
10
11
  end
12
+
13
+ ActionController::Base.send :include, Ahoy::ControllerExtensions
@@ -8,13 +8,10 @@ class <%= migration_class_name %> < ActiveRecord::Migration
8
8
  t.string :ip
9
9
  t.text :user_agent
10
10
 
11
- # acquisition
11
+ # traffic source
12
12
  t.text :referrer
13
13
  t.string :referring_domain
14
14
  t.string :campaign
15
- # t.string :social_network
16
- # t.string :search_engine
17
- # t.string :search_keyword
18
15
  t.text :landing_page
19
16
 
20
17
  # technology
@@ -1,14 +1,9 @@
1
- /*
2
- * Ahoy.js - 0.0.1
3
- * Super simple visit tracking
4
- * https://github.com/ankane/ahoy
5
- * MIT License
6
- */
1
+ /*jslint browser: true, indent: 2, plusplus: true, vars: true */
7
2
 
8
3
  (function () {
9
4
  "use strict";
10
5
 
11
- var debugMode = true;
6
+ var debugMode = false;
12
7
  var visitTtl, visitorTtl;
13
8
 
14
9
  if (debugMode) {
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ahoy_matey
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Kane
@@ -96,6 +96,7 @@ files:
96
96
  - app/controllers/ahoy/visits_controller.rb
97
97
  - app/models/ahoy/visit.rb
98
98
  - config/routes.rb
99
+ - lib/ahoy/controller_extensions.rb
99
100
  - lib/ahoy/version.rb
100
101
  - lib/ahoy_matey.rb
101
102
  - lib/generators/ahoy/install_generator.rb