rack-google-analytics 0.9.2 → 0.10.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +34 -13
- data/lib/rack/google-analytics.rb +1 -1
- data/lib/rack/templates/async.erb +1 -0
- metadata +30 -47
- data/Rakefile +0 -33
data/README.md
CHANGED
@@ -8,15 +8,35 @@ Formerly this gem had an environments setting, that has been removed pending ref
|
|
8
8
|
|
9
9
|
## Usage
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
11
|
+
#### Gemfile:
|
12
|
+
gem 'rack-google-analytics', :require => 'rack/google-analytics'
|
13
|
+
|
14
|
+
#### Sinatra
|
15
|
+
## app.rb
|
16
|
+
use Rack::GoogleAnalytics, :tracker => 'UA-xxxxxx-x'
|
17
|
+
|
18
|
+
#### Padrino
|
19
|
+
|
20
|
+
## app/app.rb
|
21
|
+
use Rack::GoogleAnalytics, :tracker => 'UA-xxxxxx-x'
|
22
|
+
|
23
|
+
#### Rails
|
24
|
+
|
25
|
+
## environment.rb:
|
26
|
+
config.gem 'rack-google-analytics', :lib => 'rack/google-analytics'
|
27
|
+
config.middleware.use Rack::GoogleAnalytics, :tracker => 'UA-xxxxxx-x'
|
28
|
+
|
29
|
+
### Options
|
30
|
+
|
31
|
+
* :async - sets to use asyncronous tracker
|
32
|
+
* :multiple - sets track for multiple sub domains. (must also set :domain)
|
33
|
+
* :top_level - sets tracker for multiple top-level domains. (must also set :domain)
|
34
|
+
|
14
35
|
Note: since 0.2.0 this will use the asynchronous google tracker code, for the traditional behaviour please use:
|
15
36
|
|
16
|
-
|
17
|
-
use Rack::GoogleAnalytics, :tracker => 'UA-xxxxxx-x', :async => false
|
37
|
+
use Rack::GoogleAnalytics, :tracker => 'UA-xxxxxx-x', :async => false
|
18
38
|
|
19
|
-
If you are not sure what's best, go with the defaults, and read here if you should opt-out
|
39
|
+
If you are not sure what's best, go with the defaults, and read here if you should opt-out
|
20
40
|
|
21
41
|
## Thread Safety
|
22
42
|
|
@@ -24,18 +44,19 @@ This middleware *should* be thread safe. Although my experience in such areas is
|
|
24
44
|
|
25
45
|
## Change Log
|
26
46
|
|
27
|
-
* 0.
|
28
|
-
* 0.9.
|
29
|
-
* 0.9.
|
30
|
-
* 0.
|
31
|
-
* 0.
|
47
|
+
* 0.10.0 Include the Google pagespeed code, and `README` typos fixed.
|
48
|
+
* 0.9.2 Fixed a bug with lots of missing files from the Gem... how silly!
|
49
|
+
* 0.9.1 Updated readme to reflect 0.9.0 merge from achiu
|
50
|
+
* 0.9.0 Include name changed from 'rack-google-analytics' to 'rack/google-analytics' more inline with the norm
|
51
|
+
* 0.6.0 Class now named Rack::GoogleAnalytics, in 0.5 and earlier this was incorrectly documented as Rack::GoogleTracker
|
52
|
+
* 0.2.0 Asynchronous code is now the default.
|
32
53
|
|
33
54
|
* 22-07-2010 Major re-write from Arthur Chiu, now correctly writes the Content-Length leader, and comes with tests (High five to @achiu) - this patch also backs-out the changes from @cimm - but they were un-tested (I intend to bring these back as soon as possible; this will probably constitute a 1.0 release when it happens)
|
34
55
|
* 19-01-2010 Second Release, patch from github.com/ralph - makes the default snippet the async version from google. Use regular synchronous code with: `:async => false`
|
35
56
|
* 27-12-2009 First Release, extracted from the Capistrano-Website project and packaged with Jeweler.
|
36
57
|
|
37
58
|
## Note on Patches/Pull Requests
|
38
|
-
|
59
|
+
|
39
60
|
* Fork the project.
|
40
61
|
* Make your feature addition or bug fix.
|
41
62
|
* Add tests for it. This is important so I don't break it in a
|
@@ -46,5 +67,5 @@ This middleware *should* be thread safe. Although my experience in such areas is
|
|
46
67
|
|
47
68
|
## Copyright
|
48
69
|
|
49
|
-
Copyright (c) 2009 Lee Hambley. See LICENSE for details.
|
70
|
+
Copyright (c) 2009-2011 Lee Hambley. See LICENSE for details.
|
50
71
|
With thanks to Ralph von der Heyden http://github.com/ralph/ and Simon `cimm` Schoeters http://github.com/cimm/ - And the biggest hand to Arthur `achiu` Chiu for the huge work that went into the massive 0.9 re-factor.
|
@@ -32,7 +32,7 @@ module Rack
|
|
32
32
|
if @options[:async]
|
33
33
|
response.gsub(%r{</head>}, @template.result(binding) + "</head>")
|
34
34
|
else
|
35
|
-
response.gsub(%r{</body>},
|
35
|
+
response.gsub(%r{</body>}, @template.result(binding) + "</body>")
|
36
36
|
end
|
37
37
|
end
|
38
38
|
|
metadata
CHANGED
@@ -1,70 +1,53 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: rack-google-analytics
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 2
|
9
|
-
version: 0.9.2
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.10.0
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Lee Hambley
|
13
|
-
- Arthur Chiu
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
date: 2010-07-22 00:00:00 +02:00
|
19
|
-
default_executable:
|
12
|
+
date: 2011-11-15 00:00:00.000000000Z
|
20
13
|
dependencies: []
|
21
|
-
|
22
|
-
|
23
|
-
|
14
|
+
description: Simple Rack middleware for implementing google analytics tracking in
|
15
|
+
your Ruby-Rack based project. Supports synchronous and asynchronous insertion and
|
16
|
+
configurable load options.
|
17
|
+
email:
|
18
|
+
- lee.hambley@gmail.com
|
24
19
|
executables: []
|
25
|
-
|
26
20
|
extensions: []
|
27
|
-
|
28
21
|
extra_rdoc_files: []
|
29
|
-
|
30
|
-
files:
|
31
|
-
- LICENSE
|
32
|
-
- README.md
|
33
|
-
- Rakefile
|
22
|
+
files:
|
34
23
|
- lib/rack/google-analytics.rb
|
35
24
|
- lib/rack/templates/async.erb
|
36
25
|
- lib/rack/templates/sync.erb
|
37
|
-
|
38
|
-
|
26
|
+
- README.md
|
27
|
+
- LICENSE
|
28
|
+
homepage: https://github.com/leehambley/rack-google-analytics
|
39
29
|
licenses: []
|
40
|
-
|
41
30
|
post_install_message:
|
42
|
-
rdoc_options:
|
43
|
-
|
44
|
-
require_paths:
|
31
|
+
rdoc_options: []
|
32
|
+
require_paths:
|
45
33
|
- lib
|
46
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
47
35
|
none: false
|
48
|
-
requirements:
|
49
|
-
- -
|
50
|
-
- !ruby/object:Gem::Version
|
51
|
-
|
52
|
-
|
53
|
-
version: "0"
|
54
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ! '>='
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0'
|
40
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
55
41
|
none: false
|
56
|
-
requirements:
|
57
|
-
- -
|
58
|
-
- !ruby/object:Gem::Version
|
59
|
-
|
60
|
-
- 0
|
61
|
-
version: "0"
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
62
46
|
requirements: []
|
63
|
-
|
64
47
|
rubyforge_project:
|
65
|
-
rubygems_version: 1.
|
48
|
+
rubygems_version: 1.8.10
|
66
49
|
signing_key:
|
67
50
|
specification_version: 3
|
68
|
-
summary: Rack middleware to
|
51
|
+
summary: Rack middleware to inject the Google Analytics tracking code into outgoing
|
52
|
+
responses.
|
69
53
|
test_files: []
|
70
|
-
|
data/Rakefile
DELETED
@@ -1,33 +0,0 @@
|
|
1
|
-
require 'rubygems'
|
2
|
-
require 'rake'
|
3
|
-
|
4
|
-
require 'rake/testtask'
|
5
|
-
Rake::TestTask.new(:test) do |test|
|
6
|
-
test.libs << 'lib' << 'test'
|
7
|
-
test.pattern = 'test/**/test_*.rb'
|
8
|
-
test.verbose = true
|
9
|
-
end
|
10
|
-
|
11
|
-
begin
|
12
|
-
require 'rcov/rcovtask'
|
13
|
-
Rcov::RcovTask.new do |test|
|
14
|
-
test.libs << 'test'
|
15
|
-
test.pattern = 'test/**/test_*.rb'
|
16
|
-
test.verbose = true
|
17
|
-
end
|
18
|
-
rescue LoadError
|
19
|
-
task :rcov do
|
20
|
-
abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
task :default => :test
|
25
|
-
|
26
|
-
begin
|
27
|
-
require 'yard'
|
28
|
-
YARD::Rake::YardocTask.new
|
29
|
-
rescue LoadError
|
30
|
-
task :yardoc do
|
31
|
-
abort "YARD is not available. In order to run yardoc, you must: sudo gem install yard"
|
32
|
-
end
|
33
|
-
end
|