rakwik 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -25,7 +25,9 @@ support since the server has no way to detect details like such.
25
25
 
26
26
  Add this line to your application's Gemfile:
27
27
 
28
- gem 'rakwik'
28
+ ``` ruby
29
+ gem 'rakwik'
30
+ ```
29
31
 
30
32
  And then execute:
31
33
 
@@ -40,10 +42,12 @@ Or install it yourself as:
40
42
  Rakwik comes as a Rack-compatible middleware which needs to be added to your application's
41
43
  middleware stack on startup.
42
44
 
43
- config.middleware.use Rakwik::Tracker,
44
- :piwik_url => 'http://your.piwik.host/piwik.php',
45
- :site_id => 'your_site_id', # eg. 1
46
- :token_auth => 'yoursecrettoken'
45
+ ``` ruby
46
+ config.middleware.use Rakwik::Tracker,
47
+ :piwik_url => 'http://your.piwik.host/piwik.php',
48
+ :site_id => 'your_site_id', # eg. 1
49
+ :token_auth => 'yoursecrettoken'
50
+ ```
47
51
 
48
52
  The `:token_auth` is needed since Rakwik will tell Piwik to record hits from another IP
49
53
  than its own. The token_auth must be either the Super User token_auth, or a user with
@@ -54,28 +58,32 @@ than its own. The token_auth must be either the Super User token_auth, or a user
54
58
  Piwik allows to set a custom action name which will be used in reports instead of the original
55
59
  URL. To use it from your Rails application, include it into your controller like such:
56
60
 
57
- require 'rakwik/helpers'
61
+ ``` ruby
62
+ require 'rakwik/helpers'
58
63
 
59
- class ApplicationController < ActionController::Base
60
- # ...
61
- include Rakwik::Helpers
62
- end
64
+ class ApplicationController < ActionController::Base
65
+ # ...
66
+ include Rakwik::Helpers
67
+ end
68
+ ```
63
69
 
64
70
  In the particular controller activate it by using the `action_name` class method:
65
71
 
66
- class BooksController < ApplicationController
67
- action_name :page_title
68
-
69
- # GET /books
70
- # GET /books.xml
71
- def index
72
- @books = Book.all
73
- @page_title = "Books"
74
-
75
- respond_with @books
76
- end
77
- end
78
-
72
+ ``` ruby
73
+ class BooksController < ApplicationController
74
+ action_name :page_title
75
+
76
+ # GET /books
77
+ # GET /books.xml
78
+ def index
79
+ @books = Book.all
80
+ @page_title = "Books"
81
+
82
+ respond_with @books
83
+ end
84
+ end
85
+ ```
86
+
79
87
  Currently, `action_name` points to a instance variable.
80
88
 
81
89
  ## TODO
@@ -45,6 +45,15 @@ module Rakwik
45
45
  }
46
46
  header['Accept-Language'] = request.env['HTTP_ACCEPT_LANGUAGE'] unless request.env['HTTP_ACCEPT_LANGUAGE'].nil?
47
47
  header['DNT'] = request.env['HTTP_DNT'] unless request.env['HTTP_DNT'].nil?
48
+
49
+ if c=request.cookies
50
+ # we'll forward piwik cookies only
51
+ c.delete_if{ |name, value| !(name =~ /^_pk_id\.|^_pk_ses\./) }
52
+ unless c.empty?
53
+ header['Cookie'] = c.map{|k,v| "#{k}=#{v}"}.join(';')
54
+ end
55
+ end
56
+
48
57
  data = {
49
58
  'idsite' => piwik_id,
50
59
  'token_auth' => token_auth,
@@ -1,3 +1,3 @@
1
1
  module Rakwik
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rakwik
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
4
+ hash: 23
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 1
8
+ - 2
9
9
  - 0
10
- version: 0.1.0
10
+ version: 0.2.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Christian Aust
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-06-20 00:00:00 Z
18
+ date: 2012-06-21 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: rack
@@ -113,7 +113,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
113
113
  requirements: []
114
114
 
115
115
  rubyforge_project:
116
- rubygems_version: 1.8.24
116
+ rubygems_version: 1.8.10
117
117
  signing_key:
118
118
  specification_version: 3
119
119
  summary: Rack-based server-side asynchronous Piwik tracker integration.