youthtree-helpers 0.1.2 → 0.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -3,17 +3,18 @@ module YouthTree
|
|
|
3
3
|
module AnalyticsHelper
|
|
4
4
|
|
|
5
5
|
def clicky_snippet_js(site_id)
|
|
6
|
-
|
|
6
|
+
value = <<-END_OF_JS
|
|
7
7
|
var clicky = { log: function(){ return; }, goal: function(){ return; }};
|
|
8
8
|
var clicky_site_id = #{site_id};
|
|
9
9
|
(function() {
|
|
10
10
|
var s = document.createElement('script');
|
|
11
11
|
s.type = 'text/javascript';
|
|
12
12
|
s.async = true;
|
|
13
|
-
s.src = (document.location.protocol + '
|
|
13
|
+
s.src = (document.location.protocol + '//static.getclicky.com/js');
|
|
14
14
|
(document.getElementsByTagName('head')[0] || document.getElementsByTagName('body')[0]).appendChild(s);
|
|
15
15
|
})();
|
|
16
16
|
END_OF_JS
|
|
17
|
+
value.gsub(/^\s{10}/, '')
|
|
17
18
|
end
|
|
18
19
|
|
|
19
20
|
def clicky_analytics
|
|
@@ -21,7 +22,7 @@ module YouthTree
|
|
|
21
22
|
content = ActiveSupport::SafeBuffer.new
|
|
22
23
|
site_id = Settings.clicky.site_id.to_i;
|
|
23
24
|
content << javascript_tag(clicky_snippet_js(site_id))
|
|
24
|
-
static_image_tag = tag(:img, :width => 1, :height => 1, :src => "#{request.protocol}
|
|
25
|
+
static_image_tag = tag(:img, :width => 1, :height => 1, :src => "#{request.protocol}in.getclicky.com/#{site_id}ns.gif")
|
|
25
26
|
content << content_tag(:noscript, content_tag(:div, static_image_tag, :class => 'clicky-tracker'))
|
|
26
27
|
content
|
|
27
28
|
end
|
|
@@ -38,7 +39,7 @@ module YouthTree
|
|
|
38
39
|
end
|
|
39
40
|
|
|
40
41
|
def google_analytics_snippet_js(identifier)
|
|
41
|
-
|
|
42
|
+
value = <<-END_OF_JS
|
|
42
43
|
var _gaq = _gaq || [];
|
|
43
44
|
_gaq.push(['_setAccount', #{identifier.to_json}]);
|
|
44
45
|
_gaq.push(['_trackPageview']);
|
|
@@ -49,6 +50,7 @@ module YouthTree
|
|
|
49
50
|
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
|
|
50
51
|
})();
|
|
51
52
|
END_OF_JS
|
|
53
|
+
value.gsub(/^\s{10}/, '')
|
|
52
54
|
end
|
|
53
55
|
end
|
|
54
56
|
end
|
data/lib/youth_tree/helpers.rb
CHANGED
data/youthtree-helpers.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: youthtree-helpers
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 29
|
|
5
5
|
prerelease: false
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 1
|
|
9
|
-
-
|
|
10
|
-
version: 0.1.
|
|
9
|
+
- 3
|
|
10
|
+
version: 0.1.3
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- Darcy Laycock
|