googlets 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/googlets/analytics.rb +9 -7
- data/lib/googlets/version.rb +1 -1
- metadata +4 -4
data/lib/googlets/analytics.rb
CHANGED
@@ -13,14 +13,14 @@ module Googlets
|
|
13
13
|
|
14
14
|
# Google Analytics Asynchronous Tracking
|
15
15
|
# http://code.google.com/intl/pl-PL/apis/analytics/docs/tracking/asyncUsageGuide.html
|
16
|
-
def include_google_analytics(part =
|
16
|
+
def include_google_analytics(part, options = {})
|
17
17
|
return unless Googlets::Analytics.enabled?
|
18
18
|
|
19
19
|
javascript_tag do
|
20
20
|
case part
|
21
|
-
when :head then Googlets::Analytics.
|
22
|
-
when :body then Googlets::Analytics.
|
23
|
-
else Googlets::Analytics.
|
21
|
+
when :head then Googlets::Analytics.head(options[:queue])
|
22
|
+
when :body then Googlets::Analytics.body
|
23
|
+
else Googlets::Analytics.head(options[:queue]) + Googlets::Analytics.body
|
24
24
|
end
|
25
25
|
end
|
26
26
|
end
|
@@ -30,11 +30,13 @@ module Googlets
|
|
30
30
|
|
31
31
|
protected ##########################################################################################################
|
32
32
|
|
33
|
-
def self.
|
34
|
-
|
33
|
+
def self.head(queue = [])
|
34
|
+
queue = [queue] unless queue.blank? || queue.first.is_a?(Array)
|
35
|
+
|
36
|
+
"var _gaq = _gaq || []; _gaq.push(['_setAccount', '#{analytics_web_property_id}'], #{queue.map(&:to_json).join(', ') + ', ' unless queue.blank?}['_trackPageview']);".html_safe
|
35
37
|
end
|
36
38
|
|
37
|
-
def self.
|
39
|
+
def self.body
|
38
40
|
"(function() { " +
|
39
41
|
"var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true; " +
|
40
42
|
"ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js'; " +
|
data/lib/googlets/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: googlets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 19
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 6
|
10
|
+
version: 0.0.6
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- sodercober
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-03-
|
18
|
+
date: 2011-03-16 00:00:00 +00:00
|
19
19
|
default_executable:
|
20
20
|
dependencies: []
|
21
21
|
|