panmind-bigbro 0.8.2 → 0.8.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/panmind/bigbro.rb +11 -6
- metadata +3 -3
data/lib/panmind/bigbro.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
module Panmind
|
2
2
|
module BigBro
|
3
|
-
Version = '0.8.
|
3
|
+
Version = '0.8.3'
|
4
4
|
|
5
5
|
module Helpers
|
6
6
|
# Embeds the optimized Analytics code and the noscript tag with
|
@@ -17,7 +17,9 @@ module Panmind
|
|
17
17
|
|
18
18
|
ga_host = BigBro.host_for(request)
|
19
19
|
ga_cmds = [['_setAccount', BigBro.account]]
|
20
|
-
ga_cmds.push
|
20
|
+
ga_cmds.push ['_setDomainName', BigBro.domain] if BigBro.domain
|
21
|
+
ga_cmds.concat(options[:commands]) if options[:commands]
|
22
|
+
ga_cmds.push ['_trackPageview'] if track
|
21
23
|
|
22
24
|
code = ''
|
23
25
|
code.concat javascript_tag(%(
|
@@ -42,8 +44,7 @@ module Panmind
|
|
42
44
|
end
|
43
45
|
|
44
46
|
class << self
|
45
|
-
attr_accessor :account
|
46
|
-
attr_accessor :disabled
|
47
|
+
attr_accessor :account, :domain, :disabled
|
47
48
|
|
48
49
|
# Sets the Analytics account and *enforces* it to be set
|
49
50
|
# in production mode.
|
@@ -60,13 +61,17 @@ module Panmind
|
|
60
61
|
#
|
61
62
|
# Panmind::BigBro.set(:account => 'UA-12345-67')
|
62
63
|
#
|
64
|
+
# Sets the 'UA-12345-67' account and the 'foo.com' domain:
|
65
|
+
#
|
66
|
+
# Panmind::BigBro.set(:account => 'UA-12345-67', :domain => 'foo.com')
|
67
|
+
#
|
63
68
|
# Disables analytics code generation:
|
64
69
|
#
|
65
70
|
# Panmind::BigBro.set(:disabled => true)
|
66
71
|
#
|
67
72
|
def set(options = {})
|
68
|
-
self.account
|
69
|
-
|
73
|
+
self.account, self.disabled, self.domain =
|
74
|
+
options.values_at(:account, :disabled, :domain)
|
70
75
|
|
71
76
|
if Rails.env.production?
|
72
77
|
if self.account.blank? && !self.disabled
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 8
|
8
|
-
-
|
9
|
-
version: 0.8.
|
8
|
+
- 3
|
9
|
+
version: 0.8.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Marcello Barnaba
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-08
|
17
|
+
date: 2010-09-08 00:00:00 +02:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|