sugar 0.0.38 → 0.0.39
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/lib/sugar/actionview/stats.rb +6 -4
- data/sugar.gemspec +1 -1
- metadata +1 -1
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0.
|
1
|
+
0.0.39
|
@@ -1,6 +1,8 @@
|
|
1
1
|
module Sugar
|
2
2
|
module Actionview
|
3
3
|
module Stats
|
4
|
+
# Set online statistics trackers
|
5
|
+
# @options
|
4
6
|
def online_stats(options = {})
|
5
7
|
static_includes = []
|
6
8
|
dynamic_includes = ''
|
@@ -9,20 +11,20 @@ module Sugar
|
|
9
11
|
|
10
12
|
if piwik = options.delete(:piwik)
|
11
13
|
static_includes << "//#{piwik[:site]}/piwik.js"
|
12
|
-
initializers << "var piwikTracker=Piwik.getTracker('#{piwik[:site]}/piwik.php'
|
14
|
+
initializers << "var piwikTracker=Piwik.getTracker('#{piwik[:site]}/piwik.php',#{piwik[:id]});piwikTracker.trackPageView();piwikTracker.enableLinkTracking();"
|
13
15
|
noscript_includes << "//#{piwik[:site]}/piwik.php?idsite=#{piwik[:id]}"
|
14
16
|
end
|
15
17
|
|
16
18
|
if metrika = options.delete(:metrika)
|
17
19
|
static_includes << '//mc.yandex.ru/resource/watch.js'
|
18
|
-
initializers << "var yaCounter#{metrika}
|
20
|
+
initializers << "var yaCounter#{metrika}=new Ya.Metrika(#{metrika});"
|
19
21
|
noscript_includes << "//mc.yandex.ru/watch/#{metrika}"
|
20
22
|
end
|
21
23
|
|
22
24
|
if analytics = options.delete(:analytics)
|
23
25
|
dynamic_includes << 'var gaJsHost=("https:"==document.location.protocol)?"https://ssl.":"http://www.";'
|
24
|
-
dynamic_includes << 'document.write(unescape("%3Cscript src=\'"+gaJsHost+"google-analytics.com/ga.js
|
25
|
-
initializers << "var pageTracker
|
26
|
+
dynamic_includes << 'document.write(unescape("%3Cscript src=\'"+gaJsHost+"google-analytics.com/ga.js\' type=\'text/javascript\'%3E%3C/script%3Ei"));'
|
27
|
+
initializers << "var pageTracker=_gat._getTracker('#{analytics}');pageTracker._trackPageview();"
|
26
28
|
end
|
27
29
|
|
28
30
|
returning('') do |result|
|
data/sugar.gemspec
CHANGED